Fossil SCM

Make the now() SQL function available in the "fossil sql" command.

drh 2015-01-23 14:03 trunk
Commit 0134654db60898d91ede721843d2831ca7f3d3de
2 files changed +2 -2 +2
+2 -2
--- src/db.c
+++ src/db.c
@@ -805,10 +805,12 @@
805805
db_checkin_mtime_function, 0, 0);
806806
sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0,
807807
db_sym2rid_function, 0, 0);
808808
sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0,
809809
db_sym2rid_function, 0, 0);
810
+ sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0,
811
+ db_now_function, 0, 0);
810812
}
811813
812814
813815
/*
814816
** Open a database file. Return a pointer to the new database
@@ -827,12 +829,10 @@
827829
if( rc!=SQLITE_OK ){
828830
db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
829831
}
830832
sqlite3_busy_timeout(db, 5000);
831833
sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
832
- sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0,
833
- db_now_function, 0, 0);
834834
sqlite3_create_function(db, "user", 0, SQLITE_UTF8, 0, db_sql_user, 0, 0);
835835
sqlite3_create_function(db, "cgi", 1, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
836836
sqlite3_create_function(db, "cgi", 2, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
837837
sqlite3_create_function(db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
838838
sqlite3_create_function(
839839
--- src/db.c
+++ src/db.c
@@ -805,10 +805,12 @@
805 db_checkin_mtime_function, 0, 0);
806 sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0,
807 db_sym2rid_function, 0, 0);
808 sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0,
809 db_sym2rid_function, 0, 0);
 
 
810 }
811
812
813 /*
814 ** Open a database file. Return a pointer to the new database
@@ -827,12 +829,10 @@
827 if( rc!=SQLITE_OK ){
828 db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
829 }
830 sqlite3_busy_timeout(db, 5000);
831 sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
832 sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0,
833 db_now_function, 0, 0);
834 sqlite3_create_function(db, "user", 0, SQLITE_UTF8, 0, db_sql_user, 0, 0);
835 sqlite3_create_function(db, "cgi", 1, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
836 sqlite3_create_function(db, "cgi", 2, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
837 sqlite3_create_function(db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
838 sqlite3_create_function(
839
--- src/db.c
+++ src/db.c
@@ -805,10 +805,12 @@
805 db_checkin_mtime_function, 0, 0);
806 sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0,
807 db_sym2rid_function, 0, 0);
808 sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0,
809 db_sym2rid_function, 0, 0);
810 sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0,
811 db_now_function, 0, 0);
812 }
813
814
815 /*
816 ** Open a database file. Return a pointer to the new database
@@ -827,12 +829,10 @@
829 if( rc!=SQLITE_OK ){
830 db_err("[%s]: %s", zDbName, sqlite3_errmsg(db));
831 }
832 sqlite3_busy_timeout(db, 5000);
833 sqlite3_wal_autocheckpoint(db, 1); /* Set to checkpoint frequently */
 
 
834 sqlite3_create_function(db, "user", 0, SQLITE_UTF8, 0, db_sql_user, 0, 0);
835 sqlite3_create_function(db, "cgi", 1, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
836 sqlite3_create_function(db, "cgi", 2, SQLITE_UTF8, 0, db_sql_cgi, 0, 0);
837 sqlite3_create_function(db, "print", -1, SQLITE_UTF8, 0,db_sql_print,0,0);
838 sqlite3_create_function(
839
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -170,10 +170,12 @@
170170
** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID)
171171
** found in check-in X (another BLOB.RID value).
172172
**
173173
** symbolic_name_to_rid(X) Return a the BLOB.RID corresponding to symbolic
174174
** name X.
175
+**
176
+** now() Return the number of seconds since 1970.
175177
**
176178
** REGEXP The REGEXP operator works, unlike in
177179
** standard SQLite.
178180
**
179181
** files_of_checkin The "files_of_check" virtual table is
180182
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -170,10 +170,12 @@
170 ** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID)
171 ** found in check-in X (another BLOB.RID value).
172 **
173 ** symbolic_name_to_rid(X) Return a the BLOB.RID corresponding to symbolic
174 ** name X.
 
 
175 **
176 ** REGEXP The REGEXP operator works, unlike in
177 ** standard SQLite.
178 **
179 ** files_of_checkin The "files_of_check" virtual table is
180
--- src/sqlcmd.c
+++ src/sqlcmd.c
@@ -170,10 +170,12 @@
170 ** checkin_mtime(X,Y) Return the mtime for the file Y (a BLOB.RID)
171 ** found in check-in X (another BLOB.RID value).
172 **
173 ** symbolic_name_to_rid(X) Return a the BLOB.RID corresponding to symbolic
174 ** name X.
175 **
176 ** now() Return the number of seconds since 1970.
177 **
178 ** REGEXP The REGEXP operator works, unlike in
179 ** standard SQLite.
180 **
181 ** files_of_checkin The "files_of_check" virtual table is
182

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button