Last active
August 29, 2015 14:14
-
-
Save billymeltdown/485b73bf81ca4ea7cfe6 to your computer and use it in GitHub Desktop.
A snippet of ditto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void ditto_createFunc(sqlite3_context *context, int argc, sqlite3_value **argv) { | |
sqlite3 *db = sqlite3_context_db_handle(context); | |
if(ditto_exec(db, | |
"CREATE TABLE ditto_log (" | |
" rep_id TEXT NOT NULL," | |
" csn INTEGER NOT NULL," | |
" timestamp DATETIME NOT NULL," | |
" type TEXT NOT NULL," | |
" object_name TEXT NOT NULL," | |
" object_guid TEXT NOT NULL," | |
" operation TEXT NOT NULL," | |
" diff TEXT" | |
");", | |
-1) != SQLITE_OK) { | |
sqlite3_result_error(context, "ditto create error creating ditto_log table ", -1); | |
} | |
if(ditto_exec(db, | |
"CREATE TABLE ditto_reps (" | |
" rep_id TEXT PRIMARY KEY," | |
" is_local INTEGER NOT NULL," | |
" csn INTEGER NOT NULL" | |
");", | |
-1) != SQLITE_OK) { | |
sqlite3_result_error(context, "ditto create error creating ditto_reps table ", -1); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment