static int registerTestFunctions(sqlite3 db, ref string dummy1, sqlite3_api_routines dummy2)
        {
            _aFuncs[] aFuncs = new _aFuncs[]  {
                new _aFuncs("randstr", 2, SQLITE_UTF8, randStr),
                new _aFuncs("test_destructor", 1, SQLITE_UTF8, test_destructor),
#if !SQLITE_OMIT_UTF16
                { "test_destructor16", 1, SQLITE_UTF8, test_destructor16 },
#endif
                new _aFuncs("test_destructor_count", 0, SQLITE_UTF8, test_destructor_count),
                new _aFuncs("test_auxdata", -1, SQLITE_UTF8, test_auxdata),
                new _aFuncs("test_error", 1, SQLITE_UTF8, test_error),
                new _aFuncs("test_error", 2, SQLITE_UTF8, test_error),
                new _aFuncs("test_eval", 1, SQLITE_UTF8, test_eval),
                new _aFuncs("test_isolation", 2, SQLITE_UTF8, test_isolation),
//{ "test_counter",        2, SQLITE_UTF8, counterFunc},
            };
            int i;

            for (i = 0; i < aFuncs.Length; i++)
            {//sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
                sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg,
                                        aFuncs[i].eTextRep, 0, aFuncs[i].xFunc, null, null);
            }

            sqlite3_create_function(db, "test_agg_errmsg16", 0, SQLITE_ANY, 0, null,
                                    test_agg_errmsg16_step, test_agg_errmsg16_final);

            return(SQLITE_OK);
        }
示例#2
0
        static int Md5_Register(sqlite3 db, ref string dummy1, sqlite3_api_routines dummy2)
        {
            int rc = sqlite3_create_function(db, "md5sum", -1, SQLITE_UTF8, 0, null,
                                             md5step, md5finalize);

            sqlite3_overload_function(db, "md5sum", -1); /* To exercise this API */
            return(rc);
        }
 /*
 ** This is the entry point to register the extension for the cube() function.
 */
 static int cube_init(
 sqlite3 db,
 ref string pzErrMsg,
 sqlite3_api_routines pApi
 )
 {
   sqlite3_api = pApi; //SQLITE_EXTENSION_INIT2( pApi );
   sqlite3_create_function( db, "cube", 1, SQLITE_ANY, 0, cubeFunc, null, null );
   return 0;
 }
示例#4
0
 /*
 ** This is the entry point to register the extension for the cube() function.
 */
 static int cube_init(
     sqlite3 db,
     ref string pzErrMsg,
     sqlite3_api_routines pApi
     )
 {
     sqlite3_api = pApi; //SQLITE_EXTENSION_INIT2( pApi );
     sqlite3_create_function(db, "cube", 1, SQLITE_ANY, 0, cubeFunc, null, null);
     return(0);
 }
示例#5
0
        /*
        ** This is a broken extension entry point
        */
        static int broken_init(
            sqlite3 db,
            ref string pzErrMsg,
            sqlite3_api_routines pApi
            )
        {
            string zErr;

            sqlite3_api = pApi; //SQLITE_EXTENSION_INIT2( pApi );
            zErr        = sqlite3_mprintf("broken autoext!");
            pzErrMsg    = zErr;
            return(1);
        }
 /*
 ** This is a broken extension entry point
 */
 static int broken_init(
 sqlite3 db,
 ref string pzErrMsg,
 sqlite3_api_routines pApi
 )
 {
   string zErr;
   sqlite3_api = pApi; //SQLITE_EXTENSION_INIT2( pApi );
   zErr = sqlite3_mprintf( "broken autoext!" );
   pzErrMsg = zErr;
   return 1;
 }
示例#7
0
 static int Md5_Register( sqlite3 db, ref string dummy1, sqlite3_api_routines dummy2 )
 {
   int rc = sqlite3_create_function( db, "md5sum", -1, SQLITE_UTF8, 0, null,
   md5step, md5finalize );
   sqlite3_overload_function( db, "md5sum", -1 ); /* To exercise this API */
   return rc;
 }
    static int registerTestFunctions( sqlite3 db, ref string dummy1, sqlite3_api_routines dummy2 )
    {
      _aFuncs[] aFuncs = new _aFuncs[]  {
new _aFuncs( "randstr",               2, SQLITE_UTF8, randStr    ),
new _aFuncs( "test_destructor",       1, SQLITE_UTF8, test_destructor),
#if !SQLITE_OMIT_UTF16
    { "test_destructor16",     1, SQLITE_UTF8, test_destructor16},
    { "hex_to_utf16be",        1, SQLITE_UTF8, testHexToUtf16be},
    { "hex_to_utf16le",        1, SQLITE_UTF8, testHexToUtf16le},
#endif
    new _aFuncs(   "hex_to_utf8",           1, SQLITE_UTF8, testHexToUtf8),
new _aFuncs(  "test_destructor_count", 0, SQLITE_UTF8, test_destructor_count),
new _aFuncs(  "test_auxdata",         -1, SQLITE_UTF8, test_auxdata),
new _aFuncs( "test_error",            1, SQLITE_UTF8, test_error),
new _aFuncs( "test_error",            2, SQLITE_UTF8, test_error),
new _aFuncs(  "test_eval",             1, SQLITE_UTF8, test_eval),
new _aFuncs(  "test_isolation",        2, SQLITE_UTF8, test_isolation),
//{ "test_counter",        2, SQLITE_UTF8, counterFunc},
};
      int i;

      for ( i = 0; i < aFuncs.Length; i++ )
      {//sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
        sqlite3_create_function( db, aFuncs[i].zName, aFuncs[i].nArg,
        aFuncs[i].eTextRep, 0, aFuncs[i].xFunc, null, null );
      }

      sqlite3_create_function( db, "test_agg_errmsg16", 0, SQLITE_ANY, 0, null,
      test_agg_errmsg16_step, test_agg_errmsg16_final );

      return SQLITE_OK;
    }