/ Check-in [f7806e03]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the (deliberately undocumented) sqlite_log() SQL function as a built-in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f7806e03995b314771aa72a08ce55d56d60096cf
User & Date: drh 2011-04-25 18:03:10
Context
2011-04-25
18:20
Test case for the ".log" command to the command-line shell. check-in: 7d0ff26a user: drh tags: trunk
18:03
Add the (deliberately undocumented) sqlite_log() SQL function as a built-in. check-in: f7806e03 user: drh tags: trunk
18:01
Invoke the unix open() system call through a wrapper to avoid problems resulting from differing declarations to that function in various systems. check-in: 4c7ff4dd user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/func.c.

   769    769     sqlite3_value **NotUsed2
   770    770   ){
   771    771     UNUSED_PARAMETER2(NotUsed, NotUsed2);
   772    772     /* IMP: R-24470-31136 This function is an SQL wrapper around the
   773    773     ** sqlite3_sourceid() C interface. */
   774    774     sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC);
   775    775   }
          776  +
          777  +/*
          778  +** Implementation of the sqlite_log() function.  This is a wrapper around
          779  +** sqlite3_log().  The return value is NULL.  The function exists purely for
          780  +** its side-effects.
          781  +*/
          782  +static void logFunc(
          783  +  sqlite3_context *context,
          784  +  int argc,
          785  +  sqlite3_value **argv
          786  +){
          787  +  UNUSED_PARAMETER(argc);
          788  +  UNUSED_PARAMETER(context);
          789  +  sqlite3_log(sqlite3_value_int(argv[0]), "%s", sqlite3_value_text(argv[1]));
          790  +}
   776    791   
   777    792   /*
   778    793   ** Implementation of the sqlite_compileoption_used() function.
   779    794   ** The result is an integer that identifies if the compiler option
   780    795   ** was used to build SQLite.
   781    796   */
   782    797   #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
................................................................................
  1537   1552   /*  FUNCTION(ifnull,             2, 0, 0, ifnullFunc       ), */
  1538   1553       {2,SQLITE_UTF8,SQLITE_FUNC_COALESCE,0,0,ifnullFunc,0,0,"ifnull",0,0},
  1539   1554       FUNCTION(random,             0, 0, 0, randomFunc       ),
  1540   1555       FUNCTION(randomblob,         1, 0, 0, randomBlob       ),
  1541   1556       FUNCTION(nullif,             2, 0, 1, nullifFunc       ),
  1542   1557       FUNCTION(sqlite_version,     0, 0, 0, versionFunc      ),
  1543   1558       FUNCTION(sqlite_source_id,   0, 0, 0, sourceidFunc     ),
         1559  +    FUNCTION(sqlite_log,         2, 0, 0, logFunc          ),
  1544   1560   #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
  1545   1561       FUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc  ),
  1546   1562       FUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc  ),
  1547   1563   #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
  1548   1564       FUNCTION(quote,              1, 0, 0, quoteFunc        ),
  1549   1565       FUNCTION(last_insert_rowid,  0, 0, 0, last_insert_rowid),
  1550   1566       FUNCTION(changes,            0, 0, 0, changes          ),