Fossil SCM

Add SQLITE_DETERMINISTIC and SQLITE_INNOCUOUS flags to some app-defined SQL functions for which those flags are valid and would help performance.

drh 2024-12-25 23:24 trunk
Commit bd7f5c0b3780286f344a868212e38a5160b56b3995577c900e8aae3ccd3266b1
1 file changed +20 -13
+20 -13
--- src/db.c
+++ src/db.c
@@ -1561,24 +1561,31 @@
15611561
** Register the SQL functions that are useful both to the internal
15621562
** representation and to the "fossil sql" command.
15631563
*/
15641564
void db_add_aux_functions(sqlite3 *db){
15651565
sqlite3_create_collation(db, "uintnocase", SQLITE_UTF8,0,uintNocaseCollFunc);
1566
- sqlite3_create_function(db, "checkin_mtime", 2, SQLITE_UTF8, 0,
1567
- db_checkin_mtime_function, 0, 0);
1568
- sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0,
1569
- db_sym2rid_function, 0, 0);
1570
- sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0,
1571
- db_sym2rid_function, 0, 0);
1572
- sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0,
1566
+ sqlite3_create_function(db, "checkin_mtime", 2,
1567
+ SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1568
+ 0, db_checkin_mtime_function, 0, 0);
1569
+ sqlite3_create_function(db, "symbolic_name_to_rid", 1,
1570
+ SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1571
+ 0, db_sym2rid_function, 0, 0);
1572
+ sqlite3_create_function(db, "symbolic_name_to_rid", 2,
1573
+ SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1574
+ 0, db_sym2rid_function, 0, 0);
1575
+ sqlite3_create_function(db, "now", 0,
1576
+ SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
15731577
db_now_function, 0, 0);
1574
- sqlite3_create_function(db, "toLocal", 0, SQLITE_UTF8, 0,
1575
- db_tolocal_function, 0, 0);
1576
- sqlite3_create_function(db, "fromLocal", 0, SQLITE_UTF8, 0,
1577
- db_fromlocal_function, 0, 0);
1578
- sqlite3_create_function(db, "hextoblob", 1, SQLITE_UTF8, 0,
1579
- db_hextoblob, 0, 0);
1578
+ sqlite3_create_function(db, "toLocal", 0,
1579
+ SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1580
+ 0, db_tolocal_function, 0, 0);
1581
+ sqlite3_create_function(db, "fromLocal", 0,
1582
+ SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1583
+ 0, db_fromlocal_function, 0, 0);
1584
+ sqlite3_create_function(db, "hextoblob", 1,
1585
+ SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1586
+ 0, db_hextoblob, 0, 0);
15801587
sqlite3_create_function(db, "capunion", 1, SQLITE_UTF8, 0,
15811588
0, capability_union_step, capability_union_finalize);
15821589
sqlite3_create_function(db, "fullcap", 1, SQLITE_UTF8, 0,
15831590
capability_fullcap, 0, 0);
15841591
sqlite3_create_function(db, "find_emailaddr", 1, SQLITE_UTF8, 0,
15851592
--- src/db.c
+++ src/db.c
@@ -1561,24 +1561,31 @@
1561 ** Register the SQL functions that are useful both to the internal
1562 ** representation and to the "fossil sql" command.
1563 */
1564 void db_add_aux_functions(sqlite3 *db){
1565 sqlite3_create_collation(db, "uintnocase", SQLITE_UTF8,0,uintNocaseCollFunc);
1566 sqlite3_create_function(db, "checkin_mtime", 2, SQLITE_UTF8, 0,
1567 db_checkin_mtime_function, 0, 0);
1568 sqlite3_create_function(db, "symbolic_name_to_rid", 1, SQLITE_UTF8, 0,
1569 db_sym2rid_function, 0, 0);
1570 sqlite3_create_function(db, "symbolic_name_to_rid", 2, SQLITE_UTF8, 0,
1571 db_sym2rid_function, 0, 0);
1572 sqlite3_create_function(db, "now", 0, SQLITE_UTF8, 0,
 
 
 
 
1573 db_now_function, 0, 0);
1574 sqlite3_create_function(db, "toLocal", 0, SQLITE_UTF8, 0,
1575 db_tolocal_function, 0, 0);
1576 sqlite3_create_function(db, "fromLocal", 0, SQLITE_UTF8, 0,
1577 db_fromlocal_function, 0, 0);
1578 sqlite3_create_function(db, "hextoblob", 1, SQLITE_UTF8, 0,
1579 db_hextoblob, 0, 0);
 
 
 
1580 sqlite3_create_function(db, "capunion", 1, SQLITE_UTF8, 0,
1581 0, capability_union_step, capability_union_finalize);
1582 sqlite3_create_function(db, "fullcap", 1, SQLITE_UTF8, 0,
1583 capability_fullcap, 0, 0);
1584 sqlite3_create_function(db, "find_emailaddr", 1, SQLITE_UTF8, 0,
1585
--- src/db.c
+++ src/db.c
@@ -1561,24 +1561,31 @@
1561 ** Register the SQL functions that are useful both to the internal
1562 ** representation and to the "fossil sql" command.
1563 */
1564 void db_add_aux_functions(sqlite3 *db){
1565 sqlite3_create_collation(db, "uintnocase", SQLITE_UTF8,0,uintNocaseCollFunc);
1566 sqlite3_create_function(db, "checkin_mtime", 2,
1567 SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1568 0, db_checkin_mtime_function, 0, 0);
1569 sqlite3_create_function(db, "symbolic_name_to_rid", 1,
1570 SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1571 0, db_sym2rid_function, 0, 0);
1572 sqlite3_create_function(db, "symbolic_name_to_rid", 2,
1573 SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1574 0, db_sym2rid_function, 0, 0);
1575 sqlite3_create_function(db, "now", 0,
1576 SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
1577 db_now_function, 0, 0);
1578 sqlite3_create_function(db, "toLocal", 0,
1579 SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1580 0, db_tolocal_function, 0, 0);
1581 sqlite3_create_function(db, "fromLocal", 0,
1582 SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1583 0, db_fromlocal_function, 0, 0);
1584 sqlite3_create_function(db, "hextoblob", 1,
1585 SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS,
1586 0, db_hextoblob, 0, 0);
1587 sqlite3_create_function(db, "capunion", 1, SQLITE_UTF8, 0,
1588 0, capability_union_step, capability_union_finalize);
1589 sqlite3_create_function(db, "fullcap", 1, SQLITE_UTF8, 0,
1590 capability_fullcap, 0, 0);
1591 sqlite3_create_function(db, "find_emailaddr", 1, SQLITE_UTF8, 0,
1592

Keyboard Shortcuts

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