|
| 1 | +sqlite3_open = Module['cwrap'] 'sqlite3_open', 'number', ['string', 'number'] |
| 2 | +sqlite3_close_v2 = Module['cwrap'] 'sqlite3_close_v2', 'number', ['number'] |
| 3 | +sqlite3_exec = Module['cwrap'] 'sqlite3_exec', 'number', ['number', 'string', 'number', 'number', 'number'] |
| 4 | +sqlite3_free = Module['cwrap'] 'sqlite3_free', '', ['number'] |
| 5 | + |
| 6 | +# Prepared statements |
| 7 | +## prepare |
| 8 | +sqlite3_prepare_v2 = Module['cwrap'] 'sqlite3_prepare_v2', 'number', ['number', 'string', 'number', 'number', 'number'] |
| 9 | +# Version of sqlite3_prepare_v2 to which a pointer to a string that is already |
| 10 | +# in memory is passed. |
| 11 | +sqlite3_prepare_v2_sqlptr = Module['cwrap'] 'sqlite3_prepare_v2', 'number', ['number', 'number', 'number', 'number', 'number'] |
| 12 | +## Bind parameters |
| 13 | + |
| 14 | +#int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); |
| 15 | +# We declare const char* as a number, because we will manually allocate the memory and pass a pointer to the function |
| 16 | +sqlite3_bind_text = Module['cwrap'] 'sqlite3_bind_text', 'number', ['number', 'number', 'number', 'number', 'number'] |
| 17 | +sqlite3_bind_blob = Module['cwrap'] 'sqlite3_bind_blob', 'number', ['number', 'number', 'number', 'number', 'number'] |
| 18 | +#int sqlite3_bind_double(sqlite3_stmt*, int, double); |
| 19 | +sqlite3_bind_double = Module['cwrap'] 'sqlite3_bind_double', 'number', ['number', 'number', 'number'] |
| 20 | +#int sqlite3_bind_double(sqlite3_stmt*, int, int); |
| 21 | +sqlite3_bind_int = Module['cwrap'] 'sqlite3_bind_int', 'number', ['number', 'number', 'number'] |
| 22 | +#int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); |
| 23 | +sqlite3_bind_parameter_index = Module['cwrap'] 'sqlite3_bind_parameter_index', 'number', ['number', 'string'] |
| 24 | + |
| 25 | +## Get values |
| 26 | +# int sqlite3_step(sqlite3_stmt*) |
| 27 | +sqlite3_step = Module['cwrap'] 'sqlite3_step', 'number', ['number'] |
| 28 | +sqlite3_errmsg = Module['cwrap'] 'sqlite3_errmsg', 'string', ['number'] |
| 29 | +# int sqlite3_data_count(sqlite3_stmt *pStmt); |
| 30 | +sqlite3_data_count = Module['cwrap'] 'sqlite3_data_count', 'number', ['number'] |
| 31 | +sqlite3_column_double = Module['cwrap'] 'sqlite3_column_double', 'number', ['number', 'number'] |
| 32 | +sqlite3_column_text = Module['cwrap'] 'sqlite3_column_text', 'string', ['number', 'number'] |
| 33 | +sqlite3_column_blob = Module['cwrap'] 'sqlite3_column_blob', 'number', ['number', 'number'] |
| 34 | +sqlite3_column_bytes = Module['cwrap'] 'sqlite3_column_bytes', 'number', ['number', 'number'] |
| 35 | +sqlite3_column_type = Module['cwrap'] 'sqlite3_column_type', 'number', ['number', 'number'] |
| 36 | +#const char *sqlite3_column_name(sqlite3_stmt*, int N); |
| 37 | +sqlite3_column_name = Module['cwrap'] 'sqlite3_column_name', 'string', ['number', 'number'] |
| 38 | +# int sqlite3_reset(sqlite3_stmt *pStmt); |
| 39 | +sqlite3_reset = Module['cwrap'] 'sqlite3_reset', 'number', ['number'] |
| 40 | +sqlite3_clear_bindings = Module['cwrap'] 'sqlite3_clear_bindings', 'number', ['number'] |
| 41 | +# int sqlite3_finalize(sqlite3_stmt *pStmt); |
| 42 | +sqlite3_finalize = Module['cwrap'] 'sqlite3_finalize', 'number', ['number'] |
| 43 | + |
| 44 | +## Create custom functions |
| 45 | +sqlite3_create_function_v2 = Module['cwrap'] 'sqlite3_create_function_v2', 'number', ['number', 'string', 'number', 'number', 'number', 'number', 'number', 'number', 'number'] |
| 46 | +sqlite3_value_type = Module['cwrap'] 'sqlite3_value_type', 'number', ['number'] |
| 47 | +sqlite3_value_bytes = Module['cwrap'] 'sqlite3_value_bytes', 'number', ['number'] |
| 48 | +sqlite3_value_text = Module['cwrap'] 'sqlite3_value_text', 'string', ['number'] |
| 49 | +sqlite3_value_int = Module['cwrap'] 'sqlite3_value_int', 'number', ['number'] |
| 50 | +sqlite3_value_blob = Module['cwrap'] 'sqlite3_value_blob', 'number', ['number'] |
| 51 | +sqlite3_value_double = Module['cwrap'] 'sqlite3_value_double', 'number', ['number'] |
| 52 | +sqlite3_result_double = Module['cwrap'] 'sqlite3_result_double', '', ['number', 'number'] |
| 53 | +sqlite3_result_null = Module['cwrap'] 'sqlite3_result_null', '', ['number'] |
| 54 | +sqlite3_result_text = Module['cwrap'] 'sqlite3_result_text', '', ['number', 'string', 'number', 'number'] |
| 55 | +RegisterExtensionFunctions = Module['cwrap'] 'RegisterExtensionFunctions', 'number', ['number'] |
| 56 | + |
| 57 | +# Export the API |
| 58 | +this['SQL'] = {'Database':Database} |
| 59 | +Module[i] = this['SQL'][i] for i of this['SQL'] |
0 commit comments