Example #1
0
        //static sqlite3 *getDbPointer(Tcl_Interp *pInterp, Tcl_Obj *pObj){
        //sqlite3 *db;
        //Tcl_CmdInfo info;
        //char *zCmd = TCL.Tcl_GetString(pObj);
        //if( TCL.Tcl_GetCommandInfo(pInterp, zCmd, &info) ){
        //  db = *((sqlite3 **)info.objClientData);
        //}else{
        //  db = (sqlite3*)sqlite3TestTextToPtr(zCmd);
        //}
        //assert( db );
        //return db;

        //static int test_enter_db_mutex(
        //  void * clientData,
        //  Tcl_Interp *interp,
        //  int objc,
        //  Tcl_Obj *CONST objv[]
        //){
        //  sqlite3 *db;
        //  if( objc!=2 ){
        //    TCL.Tcl_WrongNumArgs(interp, 1, objv, "DB");
        //    return TCL.TCL_ERROR;
        //  }
        //  db = getDbPointer(interp, objv[1]);
        //  if( !db ){
        //    return TCL.TCL_ERROR;
        //  }
        //  sqlite3_mutex_enter(sqlite3_db_mutex(db));
        //  return TCL.TCL_OK;
        //}

        //static int test_leave_db_mutex(
        //  void * clientData,
        //  Tcl_Interp *interp,
        //  int objc,
        //  Tcl_Obj *CONST objv[]
        //){
        //  sqlite3 *db;
        //  if( objc!=2 ){
        //    TCL.Tcl_WrongNumArgs(interp, 1, objv, "DB");
        //    return TCL.TCL_ERROR;
        //  }
        //  db = getDbPointer(interp, objv[1]);
        //  if( !db ){
        //    return TCL.TCL_ERROR;
        //  }
        //  sqlite3_mutex_leave(sqlite3_db_mutex(db));
        //  return TCL.TCL_OK;
        //}

        static public int Sqlitetest_mutex_Init(Tcl_Interp interp)
        {
            //static struct {
            //  char *zName;
            //  Tcl_ObjCmdProc *xProc;
            //}
            _aObjCmd[] aCmd = new _aObjCmd[] {
                new _aObjCmd("sqlite3_shutdown", test_shutdown),
                new _aObjCmd("sqlite3_initialize", test_initialize),
                new _aObjCmd("sqlite3_config", test_config),

//new _aCmd("enter_db_mutex",          (Tcl_ObjCmdProc*)test_enter_db_mutex },
//new _aCmd( "leave_db_mutex",          (Tcl_ObjCmdProc*)test_leave_db_mutex },

//new _aCmd( "alloc_dealloc_mutex",     (Tcl_ObjCmdProc)test_alloc_mutex ),
//new _aCmd( "install_mutex_counters",  (Tcl_ObjCmdProc)test_install_mutex_counters ),
//new _aCmd( "read_mutex_counters",     (Tcl_ObjCmdProc)test_read_mutex_counters ),
//new _aCmd( "clear_mutex_counters",    (Tcl_ObjCmdProc)test_clear_mutex_counters ),
            };
            int i;

            for (i = 0; i < aCmd.Length; i++)
            {//sizeof(aCmd)/sizeof(aCmd[0]); i++){
                TCL.Tcl_CreateObjCommand(interp, aCmd[i].zName, aCmd[i].xProc, null, null);
            }

            //Tcl_LinkVar(interp, "disable_mutex_init",
            //             g.disableInit, VarFlag.SQLITE3_LINK_INT  );
            //Tcl_LinkVar(interp, "disable_mutex_try",
            //            g.disableTry, VarFlag.SQLITE3_LINK_INT  );
            return(SQLITE_OK);
        }
Example #2
0
        //static class _aObjCmd {
        //   public string zName;
        //   public Tcl_ObjCmdProc xProc;
        //   public object clientData;
        //}

        /*
        ** Register commands with the TCL interpreter.
        */
        static public int Sqlitetestwholenumber_Init(Tcl_Interp interp)
        {
            _aObjCmd[] aObjCmd = new _aObjCmd[] {
                new _aObjCmd("register_wholenumber_module", register_wholenumber_module, 0),
            };
            int i;

            for (i = 0; i < aObjCmd.Length; i++)
            {//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
                TCL.Tcl_CreateObjCommand(interp, aObjCmd[i].zName,
                                         aObjCmd[i].xProc, aObjCmd[i].clientData, null);
            }
            return(TCL.TCL_OK);
        }
Example #3
0
        /*
        ** Register commands with the TCL interpreter.
        */
        static public int Sqlitetestschema_Init(Tcl_Interp interp)
        {
            //static struct {
            //   char *zName;
            //   Tcl_ObjCmdProc *xProc;
            //   void *clientData;
            //}
            _aObjCmd[] aObjCmd = new _aObjCmd[] {
                new _aObjCmd("register_schema_module", register_schema_module, 0),
            };
            int i;

            for (i = 0; i < aObjCmd.Length; i++)//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++)
            {
                TCL.Tcl_CreateObjCommand(interp, aObjCmd[i].zName,
                                         aObjCmd[i].xProc, aObjCmd[i].clientData, null);
            }
            return(TCL.TCL_OK);
        }
Example #4
0
        /*
        ** Register commands with the TCL interpreter.
        */
        static public int Sqlitetestintarray_Init(Tcl_Interp interp)
        {
            //static struct {
            //   char *zName;
            //   Tcl_ObjCmdProc *xProc;
            //   void *clientData;
            //}
            _aObjCmd[] aObjCmd = new _aObjCmd[] {
                new _aObjCmd("sqlite3_intarray_create", test_intarray_create, 0),
                new _aObjCmd("sqlite3_intarray_bind", test_intarray_bind, 0),
            };
            int i;

            for (i = 0; i < aObjCmd.Length; i++)//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++)
            {
                TCL.Tcl_CreateObjCommand(interp, aObjCmd[i].zName,
                                         aObjCmd[i].xProc, aObjCmd[i].clientData, null);
            }
            return(TCL.TCL_OK);
        }
Example #5
0
/*
** Register commands with the TCL interpreter.
*/
        static public int Sqlitetesttclvar_Init(Tcl_Interp interp)
        {
#if !SQLITE_OMIT_VIRTUALTABLE
            //static struct {
            //   char *zName;
            //   Tcl_ObjCmdProc *xProc;
            //   void clientData;
            //}
            _aObjCmd[] aObjCmd = new _aObjCmd[]  {
                new _aObjCmd("register_tclvar_module", register_tclvar_module, 0),
            };
            int i;
            for (i = 0; i < aObjCmd.Length; i++)//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++)
            {
                TCL.Tcl_CreateObjCommand(interp, aObjCmd[i].zName,
                                         aObjCmd[i].xProc, aObjCmd[i].clientData, null);
            }
#endif
            return(TCL.TCL_OK);
        }
Example #6
0
        /*
        ** Register commands with the TCL interpreter.
        */
        static public int Sqlitetest9_Init(Tcl_Interp interp)
        {
            //static struct {
            //   string zName;
            //   Tcl_ObjCmdProc *xProc;
            //   void *object;
            //}
            _aObjCmd[] aObjCmd = new _aObjCmd[]  {
                new _aObjCmd("c_misuse_test", c_misuse_test, 0),
                new _aObjCmd("c_realloc_test", c_realloc_test, 0),
                new _aObjCmd("c_collation_test", c_collation_test, 0),
            };
            int i;

            for (i = 0; i < aObjCmd.Length; i++)
            {//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
                TCL.Tcl_CreateObjCommand(interp, aObjCmd[i].zName,
                                         aObjCmd[i].xProc, aObjCmd[i].clientData, null);
            }
            return(TCL.TCL_OK);
        }
        /*
        ** USAGE:  utf8_to_utf8  HEX
        **
        ** The argument is a UTF8 string represented _in hexadecimal.
        ** The UTF8 might not be well-formed.  Run this string through
        ** sqlite3Utf8to8() convert it back to hex and return the result.
        */
        //static int utf8_to_utf8(
        //  void * clientData,
        //  Tcl_Interp *interp,
        //  int objc,
        //  Tcl_Obj *CONST objv[]
        //){
        //#if SQLITE_DEBUG
        //  int n;
        //  int nOut;
        //  const unsigned char *zOrig;
        //  unsigned char *z;
        //  if( objc!=2 ){
        //    TCL.Tcl_WrongNumArgs(interp, 1, objv, "HEX");
        //    return TCL.TCL_ERROR;
        //  }
        //  zOrig = (unsigned char *)Tcl_GetStringFromObj(objv[1], n);
        //  z = sqlite3Malloc( n+3 );
        //  n = sqlite3TestHexToBin(zOrig, n, z);
        //  z[n] = 0;
        //  nOut = sqlite3Utf8To8(z);
        //  sqlite3TestBinToHex(z,nOut);
        //  TCL.Tcl_AppendResult(interp, (char*)z, 0);
        //  //sqlite3DbFree(db,z);
        //#endif
        //  return TCL.TCL_OK;
        //}


        /*
        ** Register commands with the TCL interpreter.
        */
        static public int Sqlitetest_hexio_Init(Tcl_Interp interp)
        {
            //static struct {
            //   string zName;
            //   Tcl_ObjCmdProc *xProc;
            //}
            _aObjCmd[] aObjCmd = new _aObjCmd[] {
                new _aObjCmd("hexio_read", hexio_read),
                new _aObjCmd("hexio_write", hexio_write),
                new _aObjCmd("hexio_get_int", hexio_get_int),
                new _aObjCmd("hexio_render_int16", hexio_render_int16),
                new _aObjCmd("hexio_render_int32", hexio_render_int32),
//new _aObjCmd(  "utf8_to_utf8",                 utf8_to_utf8          },
            };
            int i;

            for (i = 0; i < aObjCmd.Length; i++)
            {
                TCL.Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, null, null);
            }
            return(TCL.TCL_OK);
        }
        /*
        ** Register commands with the TCL interpreter.
        */
        public static int Sqlitetest_func_Init(Tcl_Interp interp)
        {
            //static struct {
            //   char *zName;
            //   Tcl_ObjCmdProc *xProc;
            //}
            _aObjCmd[] aObjCmd = new _aObjCmd[]  {
                new _aObjCmd("autoinstall_test_functions", autoinstall_test_funcs),
                new _aObjCmd("abuse_create_function", abuse_create_function),
            };
            int i;

            //extern int Md5_Register(sqlite3*);

            for (i = 0; i < aObjCmd.Length; i++)
            {//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
                TCL.Tcl_CreateObjCommand(interp, aObjCmd[i].zName, aObjCmd[i].xProc, null, null);
            }
            sqlite3_initialize();
            sqlite3_auto_extension((dxInit)registerTestFunctions);
            sqlite3_auto_extension((dxInit)Md5_Register);
            return(TCL.TCL_OK);
        }
Example #9
0
    /*
** Register commands with the TCL interpreter.
*/
    static public int Sqlitetest8_Init( Tcl_Interp interp )
    {
#if !SQLITE_OMIT_VIRTUALTABLE
      //static struct {
      //   string zName;
      //   Tcl_ObjCmdProc *xProc;
      //   void *clientData;
      //} 
      _aObjCmd[] aObjCmd = new _aObjCmd[]{
     new _aObjCmd( "register_echo_module",   register_echo_module, 0 ),
     new _aObjCmd(  "sqlite3_declare_vtab",   declare_vtab, 0 ),
  };
      int i;
      for ( i = 0; i < aObjCmd.Length; i++ )//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++)
      {
        TCL.Tcl_CreateObjCommand( interp, aObjCmd[i].zName,
            aObjCmd[i].xProc, aObjCmd[i].clientData, null );
      }
#endif
      return TCL.TCL_OK;
    }
Example #10
0
    /*
    ** Register commands with the TCL interpreter.
    */
    static public int Sqlitetest9_Init( Tcl_Interp interp )
    {
      //static struct {
      //   string zName;
      //   Tcl_ObjCmdProc *xProc;
      //   void *object;
      //}
      _aObjCmd[] aObjCmd = new _aObjCmd[]  {
new _aObjCmd( "c_misuse_test",    c_misuse_test, 0 ),
new _aObjCmd( "c_realloc_test",   c_realloc_test, 0 ),
new _aObjCmd( "c_collation_test", c_collation_test, 0 ),
};
      int i;
      for ( i = 0; i < aObjCmd.Length; i++ )
      {//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
        TCL.Tcl_CreateObjCommand( interp, aObjCmd[i].zName,
        aObjCmd[i].xProc, aObjCmd[i].clientData, null );
      }
      return TCL.TCL_OK;
    }
Example #11
0
   /*
   ** Register commands with the TCL interpreter.
   */
   static public int Sqlitetestintarray_Init( Tcl_Interp interp )
   {
     //static struct {
     //   char *zName;
     //   Tcl_ObjCmdProc *xProc;
     //   void *clientData;
     //} 
     _aObjCmd[] aObjCmd = new _aObjCmd[] {
    new _aObjCmd( "sqlite3_intarray_create", test_intarray_create, 0 ),
    new _aObjCmd(  "sqlite3_intarray_bind", test_intarray_bind, 0 ),
 };
     int i;
     for ( i = 0; i < aObjCmd.Length; i++ )//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++)
     {
       TCL.Tcl_CreateObjCommand( interp, aObjCmd[i].zName,
           aObjCmd[i].xProc, aObjCmd[i].clientData, null );
     }
     return TCL.TCL_OK;
   }
Example #12
0
    //static sqlite3 *getDbPointer(Tcl_Interp *pInterp, Tcl_Obj *pObj){
    //sqlite3 *db;
    //Tcl_CmdInfo info;
    //char *zCmd = TCL.Tcl_GetString(pObj);
    //if( TCL.Tcl_GetCommandInfo(pInterp, zCmd, &info) ){
    //  db = *((sqlite3 **)info.objClientData);
    //}else{
    //  db = (sqlite3*)sqlite3TestTextToPtr(zCmd);
    //}
    //assert( db );
    //return db;

    //static int test_enter_db_mutex(
    //  void * clientData,
    //  Tcl_Interp *interp,
    //  int objc,
    //  Tcl_Obj *CONST objv[]
    //){
    //  sqlite3 *db;
    //  if( objc!=2 ){
    //    TCL.Tcl_WrongNumArgs(interp, 1, objv, "DB");
    //    return TCL.TCL_ERROR;
    //  }
    //  db = getDbPointer(interp, objv[1]);
    //  if( !db ){
    //    return TCL.TCL_ERROR;
    //  }
    //  sqlite3_mutex_enter(sqlite3_db_mutex(db));
    //  return TCL.TCL_OK;
    //}

    //static int test_leave_db_mutex(
    //  void * clientData,
    //  Tcl_Interp *interp,
    //  int objc,
    //  Tcl_Obj *CONST objv[]
    //){
    //  sqlite3 *db;
    //  if( objc!=2 ){
    //    TCL.Tcl_WrongNumArgs(interp, 1, objv, "DB");
    //    return TCL.TCL_ERROR;
    //  }
    //  db = getDbPointer(interp, objv[1]);
    //  if( !db ){
    //    return TCL.TCL_ERROR;
    //  }
    //  sqlite3_mutex_leave(sqlite3_db_mutex(db));
    //  return TCL.TCL_OK;
    //}

    static public int Sqlitetest_mutex_Init( Tcl_Interp interp )
    {
      //static struct {
      //  char *zName;
      //  Tcl_ObjCmdProc *xProc;
      //}
      _aObjCmd[] aCmd = new _aObjCmd[]{
new _aObjCmd( "sqlite3_shutdown",         test_shutdown ),
new _aObjCmd( "sqlite3_initialize",       test_initialize ),
new _aObjCmd( "sqlite3_config",           test_config ),

//new _aCmd("enter_db_mutex",          (Tcl_ObjCmdProc*)test_enter_db_mutex },
//new _aCmd( "leave_db_mutex",          (Tcl_ObjCmdProc*)test_leave_db_mutex },

//new _aCmd( "alloc_dealloc_mutex",     (Tcl_ObjCmdProc)test_alloc_mutex ),
//new _aCmd( "install_mutex_counters",  (Tcl_ObjCmdProc)test_install_mutex_counters ),
//new _aCmd( "read_mutex_counters",     (Tcl_ObjCmdProc)test_read_mutex_counters ),
//new _aCmd( "clear_mutex_counters",    (Tcl_ObjCmdProc)test_clear_mutex_counters ),
};
      int i;
      for ( i = 0 ; i < aCmd.Length ; i++ )
      {//sizeof(aCmd)/sizeof(aCmd[0]); i++){
        TCL.Tcl_CreateObjCommand( interp, aCmd[i].zName, aCmd[i].xProc, null, null );
      }

      //Tcl_LinkVar(interp, "disable_mutex_init",
      //             g.disableInit, VarFlag.SQLITE3_LINK_INT  );
      //Tcl_LinkVar(interp, "disable_mutex_try",
      //            g.disableTry, VarFlag.SQLITE3_LINK_INT  );
      return SQLITE_OK;
    }
    /*
    ** Register commands with the TCL interpreter.
    */
    public static int Sqlitetest_func_Init( Tcl_Interp interp )
    {
      //static struct {
      //   string zName;
      //   Tcl_ObjCmdProc *xProc;
      //}
      _aObjCmd[] aObjCmd = new _aObjCmd[]  {
new _aObjCmd( "autoinstall_test_functions",    autoinstall_test_funcs ),
new _aObjCmd( "abuse_create_function",         abuse_create_function  ),
};
      int i;
      //extern int Md5_Register(sqlite3);

      for ( i = 0; i < aObjCmd.Length; i++ )
      {//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
        TCL.Tcl_CreateObjCommand( interp, aObjCmd[i].zName, aObjCmd[i].xProc, null, null );
      }
      sqlite3_initialize();
      sqlite3_auto_extension( (dxInit)registerTestFunctions );
      sqlite3_auto_extension( (dxInit)Md5_Register );
      return TCL.TCL_OK;
    }
Example #14
0
    //static int getFts3Varint(string p, sqlite_int64 *v){
    //  const unsigned char *q = (const unsigned char ) p;
    //  sqlite_uint64 x = 0, y = 1;
    //  while( (*q & 0x80) == 0x80 ){
    //    x += y * (*q++ & 0x7f);
    //    y <<= 7;
    //  }
    //  x += y * (*q++);
    //  *v = (sqlite_int64) x;
    //  return (int) (q - (unsigned char )p);
    //}


    ///*
    //** USAGE:  read_fts3varint BLOB VARNAME
    //**
    //** Read a varint from the start of BLOB. Set variable VARNAME to contain
    //** the interpreted value. Return the number of bytes of BLOB consumed.
    //*/
    //static int read_fts3varint(
    //  void * clientData,
    //  Tcl_Interp interp,
    //  int objc,
    //  Tcl_Obj[] objv
    //){
    //  int nBlob;
    //  unsigned string zBlob;
    //  sqlite3_int64 iVal;
    //  int nVal;

    //  if( objc!=3 ){
    //    Tcl_WrongNumArgs(interp, 1, objv, "BLOB VARNAME");
    //    return TCL.TCL_ERROR;
    //  }
    //  zBlob = TCL.Tcl_GetByteArrayFromObj(objv[1], &nBlob);

    //  nVal = getFts3Varint((char)zBlob, (sqlite3_int64 )(&iVal));
    //  Tcl_ObjSetVar2(interp, objv[2], 0, TCL.TCL_NewWideIntObj(iVal), 0);
    //  Tcl_SetObjResult(interp, TCL.TCL_NewIntObj(nVal));
    //  return TCL.TCL_OK;
    //}


    /*
    ** Register commands with the TCL interpreter.
    */
    static public int Sqlitetest_hexio_Init( Tcl_Interp interp )
    {
      //static struct {
      //   string zName;
      //   Tcl_ObjCmdProc *xProc;
      //}
      _aObjCmd[] aObjCmd = new _aObjCmd[] {
new _aObjCmd(  "hexio_read",                   hexio_read            ),
new _aObjCmd(  "hexio_write",                  hexio_write           ),
new _aObjCmd(  "hexio_get_int",                hexio_get_int         ),
new _aObjCmd(  "hexio_render_int16",           hexio_render_int16    ),
new _aObjCmd(  "hexio_render_int32",           hexio_render_int32    ),
new _aObjCmd(  "utf8_to_utf8",                 utf8_to_utf8          ),
//     { "read_fts3varint",                  read_fts3varint           },
};
      int i;
      for ( i = 0; i < aObjCmd.Length; i++ )
      {
        TCL.Tcl_CreateObjCommand( interp, aObjCmd[i].zName, aObjCmd[i].xProc, null, null );
      }
      return TCL.TCL_OK;
    }
   /*
   ** Register commands with the TCL interpreter.
   */
   static public int Sqlitetestschema_Init( Tcl_Interp interp )
   {
     //static struct {
     //   char *zName;
     //   Tcl_ObjCmdProc *xProc;
     //   void *clientData;
     //} 
     _aObjCmd[] aObjCmd = new _aObjCmd[]{
    new _aObjCmd( "register_schema_module", register_schema_module, 0 ),
 };
     int i;
     for ( i = 0; i < aObjCmd.Length; i++ )//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++)
     {
       TCL.Tcl_CreateObjCommand( interp, aObjCmd[i].zName,
           aObjCmd[i].xProc, aObjCmd[i].clientData, null );
     }
     return TCL.TCL_OK;
   }
    //static class _aObjCmd {
    //   public string zName;
    //   public Tcl_ObjCmdProc xProc;
    //   public object clientData;
    //} 
    /*
    ** Register commands with the TCL interpreter.
    */
    static public int Sqlitetestwholenumber_Init( Tcl_Interp interp )
    {
      _aObjCmd[] aObjCmd = new _aObjCmd[] {
new _aObjCmd( "register_wholenumber_module",   register_wholenumber_module, 0 ),
};
      int i;
      for ( i = 0; i < aObjCmd.Length; i++ )
      {//sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
        TCL.Tcl_CreateObjCommand( interp, aObjCmd[i].zName,
        aObjCmd[i].xProc, aObjCmd[i].clientData, null );
      }
      return TCL.TCL_OK;
    }