read_table_data

Function read_table_data 

Source
pub fn read_table_data(
    conn: &Connection,
    table: &str,
) -> Result<Vec<HashMap<String, Value>>>
Expand description

Read all data from a SQLite table

Returns all rows as a vector of HashMaps, where each HashMap maps column names to their values.

§Arguments

  • conn - SQLite database connection
  • table - Table name (should be validated)

§Returns

Vector of rows, each row is a HashMap<column_name, value>

§Security

Table name should be validated before calling this function.

§Performance

Loads all rows into memory. For very large tables, consider pagination or streaming approaches.

§Examples

let conn = open_sqlite("database.db")?;
let table = "users";
validate_table_name(table)?;
let rows = read_table_data(&conn, table)?;
println!("Read {} rows from {}", rows.len(), table);