-
Notifications
You must be signed in to change notification settings - Fork 20
/
notes.txt
134 lines (107 loc) · 5.55 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Top level "methods"
===================
*done* const char* sqlite3_libversion(void)
*done* int sqlite3_libversion_number(void)
*done* int sqlite3_threadsave(void)
*done* int sqlite3_complete(const char*sql);
*done* int sqlite3_complete16(const void *sql);
*done* sqlite3_int64 sqlite3_memory_used(void);
*done* sqlite3_int64 sqtlie3_memory_highwater(int resetFlag);
*done* void sqlite3_randomness(int N, void *p)
*future* int sqlite3_enabled_shared_cache(int); # TODO maybe
*future* int sqlite3_release_memory(int); // maybe, hook into gc calls ?
*future* void sqlite3_soft_heap_limit(int);
*future* char* sqlite3_temp_directory;
UTF-8 vs. UTF-16
----------------
in cases where there is a xxx16() method in the C api, the ruby methods add a
flag to the method.
Core 'Objects'
==============
sqlite3 (typdef struct sqlite3) -> main database handle
-------
*done* int sqlite3_open_v2(*filename, sqlite3**, flags, NULL)
*done* int sqlite3_open16
*done* int sqlite3_extended_result_codes(sqlite3, int onoff) # default to turning this on
*skipped* called during rb_raise
*skipped* const char *sqlite3_errmsg(sqlite3*);
*skipped* const void *sqlite3_errmsg16(sqlite3*);
*done* int sqlite3_close(sqlite3 *)
*skipped* int sqlite3_exec -> don't use, wrap in ruby exec
*done* sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*)
*done* int sqlite3_get_autocommit(sqlite3*)
*done* int sqlite3_changes(sqlite3*)
*done* int sqlite3_total_changes(sqlite3*)
*skipped* int sqlite3_errcode(sqlite3 *db)
*done* int sqlite3_prepare_v2(sqlite3* db, sql, nbyte, sqlite3_stmt**, const char **tail)
int sqlite3_prepare16_v2(sqlite3* db, sql, nbyte, sqlite3_stmt**, const char **tail)
// not yet, but implement if/when a purchase of sqlite3 encryption works
TODO: int sqlite3_key(sqlite3* db, const void *pKey, int nKey);
TODO: int sqlite3_rekey(sqlite3* db, const void *pKey, int nKey);
// BLOB
TODO: int sqlite3_blob_open(sqlite3*, *db, *table, *column, rowid, flags, **blob);
TODO: int sqlite3_busy_timeout(sqlite3*)
TODO: void sqlite3_progress_hander(sqlite3*, int, int(*)(void*), void*)
*done* tracing should be an IO object, if it is true then send it to STDERR
*done* tracing should also yield a block like a transaction so that during the block the db has tracing turned on.
*done* sqlite3_trace
TODO: create Table and Column classes
TODO: int sqlite3_table_column_metadata();
for later implementation
________________________
sqlite3_enable_load_extensions
sqlite3_load_extension
sqlite3_interrupt
sqlite3_busy_handler(sqlite3*, function pointer, void *)
*skip - experimental* sqlite3_profile
*Skip - experimental* sqlite3_limit(sqlite3*, int id, int newVal) -- maybe implement
*skip - experimental* sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
*skip - experimental* sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);
*skip - experimental* sqlite3_update_hook(sqlite3*, function ponter, void*);
sqlite3_stmt (typedef struct sqlite3_stmt) -> handle for statements
------------
*done* const char *sqlite3_sql(sqlite3_stmt *pStmt)
*done* int sqlite3_bind_parameter_count(sqlite3_stmt*);
*done* sqlite3_bind_double(sqlite3_stmt*, int, double);
*done* sqlite3_bind_int(sqlite3_stmt*, int, int);
*done* sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
*done* sqlite3_bind_null(sqlite3_stmt*, int);
*done* sqlite3_bind_text(sqlite3_stmt*, int, constc char*, int n, void(*)(void*));
* skipping *sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
*done* const char* sqlite3_bind_parameter_name(sqlite3_stmt*, int )
*done* sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);
*done* sqlite3_clear_bindings(sqlite3_stmt*);
*done* sqlite3_column_count(sqlite3_stmt *pStmt);
*done* sqlite3_column_name(sqlite3_stmt*, int N);
*skip - used internally* sqlite3 *sqlite3_db_handle(sqlite3_stmt*);
*done* sqlite3_column_database_name(sqlite3_stmt*, int);
*done* sqlite3_column_table_name(sqlite3_stmt*, int);
*done* sqlite3_column_origin_name(sqlite3_stmt*, int);
*done* sqlite3_step(sqlite3_stmt*);
*done - as 'close' *int sqlite3_finalize(sqlite3_stmt *pStmt);
*done* int sqlite3_reset(sqlite3_stmt *pStmt);
*done - same as sqlite3_column_count* sqlite3_data_count(sqlite3_stmt *pStmt);
*do not use* sqlite3_value* sqlite3_column_value(sqlite3_stmt*, int iCol);
sqlite3_bind_text16(sqlite3_stmt*, int, constc char*, int, void(*)(void*));
sqlite3_column_database_name16(sqlite3_stmt*, int);
sqlite3_column_table_name16(sqlite3_stmt*, int);
sqlite3_column_origin_name16(sqlite3_stmt*, int);
sqlite3_column_name16(sqlite3_stmt*, int N);
sqlite3_column_decltype(sqlite3_stmt*, int);
sqlite3_column_decltype16(sqlite3_stmt*, int);
// use this to find the type and then call the appropriate method afterwards.
sqlite3_column_type(sqlite3_stmt*, int iCol);
# binding by name or index, if passed in an array to the bind() method then
# bind by index, if passed in a hash, bind by name, using hte keys of the hash
sqlite3_bind_blob(sqlite3_stmt*, int, const void *, int n, void(*)(void*));
sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
sqlite3_blob
------------
sqlite3_blob_close(sqlite3_blob*)
sqlite3_blob_bytes(sqlite3_blob*)
sqlite3_blob_read(sqlite3_blob*, *to_buffer, bytes_to_read, starting_at_offset);
sqlite3_blob_write(sqlite3_blob*, *from_buffer, bytes_to_write, starting_at_offset);
Result Codes
============
*done* Convert to Individual Exceptions and allow the top level module generate them
based upon integer value