Differences From:
File
src/db.c
part of check-in
[8dbee6731d]
- The push, pull, and sync commands remember the last server and reuse it
if the URL argument is omitted. Sync via network only now.
by
drh on
2007-07-31 01:34:45.
[view]
To:
File
src/db.c
part of check-in
[22552fb803]
- Extend the commit command so that specific files can be committed. There are still some problems with doing this after a merge.
by
dan on
2007-08-03 15:31:33.
[view]
@@ -725,15 +725,49 @@
printf("%s\n", zSql);
}
/*
+** This is used by the [commit] command.
+**
+** Return true if either:
+**
+** a) Global.aCommitFile is NULL, or
+** b) Global.aCommitFile contains the integer passed as an argument.
+**
+** Otherwise return false.
+*/
+static void file_is_selected(
+ sqlite3_context *context,
+ int argc,
+ sqlite3_value **argv
+){
+ assert(argc==1);
+ if( g.aCommitFile ){
+ int iId = sqlite3_value_int(argv[0]);
+ int ii;
+ for(ii=0; g.aCommitFile[ii]; ii++){
+ if( iId==g.aCommitFile[ii] ){
+ sqlite3_result_int(context, 1);
+ return;
+ }
+ }
+ sqlite3_result_int(context, 0);
+ }else{
+ sqlite3_result_int(context, 1);
+ }
+}
+
+/*
** This function registers auxiliary functions when the SQLite
** database connection is first established.
*/
LOCAL void db_connection_init(void){
static int once = 1;
if( once ){
sqlite3_create_function(g.db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
+ sqlite3_create_function(
+ g.db, "file_is_selected", 1, SQLITE_UTF8, 0, file_is_selected,0,0
+ );
if( g.fSqlTrace ){
sqlite3_trace(g.db, db_sql_trace, 0);
}
once = 0;