![]() |
Fun 0.41.5
The programming language that makes you have fun!
|
Implements the OP_SQLITE_QUERY opcode (conditional build). More...
Go to the source code of this file.
Functions | |
| free_value (vh) | |
| free_value (vsql) | |
| if (!h||!h->db||!sql) | |
| if (sqlite3_prepare_v2(h->db, sql, -1, &stmt, NULL) !=SQLITE_OK) | |
| free (sql) | |
| while (sqlite3_step(stmt)==SQLITE_ROW) | |
| sqlite3_finalize (stmt) | |
| push_value (vm, rows) | |
Variables | |
| case | OP_SQLITE_QUERY |
| Value | vh = pop_value(vm) |
| int | hid = (int)vh.i |
| char * | sql = value_to_string_alloc(&vsql) |
| SqlHandle * | h = sql_reg_get(hid) |
| sqlite3_stmt * | stmt = NULL |
| Value | rows = make_array_from_values(NULL, 0) |
| int | ncols = sqlite3_column_count(stmt) |
| break | |
Implements the OP_SQLITE_QUERY opcode (conditional build).
Prepares and steps through a SQLite statement to produce an array of row maps when FUN_WITH_SQLITE is enabled. Returns an empty array otherwise.
OP_SQLITE_QUERY: (handle:int, sql:string) -> array<map<string,any>>
Definition in file query.c.
| free | ( | sql | ) |
| free_value | ( | vh | ) |
| free_value | ( | vsql | ) |
| push_value | ( | vm | , |
| rows | ) |
| sqlite3_finalize | ( | stmt | ) |
| SqlHandle* h = sql_reg_get(hid) |
| Value rows = make_array_from_values(NULL, 0) |
| char* sql = value_to_string_alloc(&vsql) |