/ Check-in [bc0e6610]
Login

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

Overview
Comment:Enhance the test harness for the sessions interface so that it does not use SQLite operations that can encounter an OOM error in places where it is unable to report an OOM error back up to the test script.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | sessions
Files: files | file ages | folders
SHA1: bc0e661033b78f27866932244e6204985ae39000
User & Date: drh 2014-03-06 14:53:25
Context
2014-03-06
15:01
Fix a harmless compiler warning in the sessions test harness. check-in: d389e20a user: drh tags: sessions
14:53
Enhance the test harness for the sessions interface so that it does not use SQLite operations that can encounter an OOM error in places where it is unable to report an OOM error back up to the test script. check-in: bc0e6610 user: drh tags: sessions
13:48
Merge the latest 3.8.4 tweaks from trunk. check-in: 1ed463d9 user: drh tags: sessions
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ext/session/test_session.c.

   155    155     return TCL_OK;
   156    156   }
   157    157   
   158    158   static void test_session_del(void *clientData){
   159    159     TestSession *p = (TestSession*)clientData;
   160    160     if( p->pFilterScript ) Tcl_DecrRefCount(p->pFilterScript);
   161    161     sqlite3session_delete(p->pSession);
   162         -  ckfree(p);
          162  +  ckfree((char*)p);
   163    163   }
   164    164   
   165    165   /*
   166    166   ** Tclcmd:  sqlite3session CMD DB-HANDLE DB-NAME
   167    167   */
   168    168   static int test_sqlite3session(
   169    169     void * clientData,
................................................................................
   187    187     }
   188    188     db = *(sqlite3 **)info.objClientData;
   189    189   
   190    190     p = (TestSession*)ckalloc(sizeof(TestSession));
   191    191     memset(p, 0, sizeof(TestSession));
   192    192     rc = sqlite3session_create(db, Tcl_GetString(objv[3]), &p->pSession);
   193    193     if( rc!=SQLITE_OK ){
   194         -    ckfree(p);
          194  +    ckfree((char*)p);
   195    195       return test_session_error(interp, rc);
   196    196     }
   197    197   
   198    198     Tcl_CreateObjCommand(
   199    199         interp, Tcl_GetString(objv[1]), test_session_cmd, (ClientData)p,
   200    200         test_session_del
   201    201     );
................................................................................
   218    218           Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("i", 1));
   219    219           pObj = Tcl_NewWideIntObj(sqlite3_value_int64(pVal));
   220    220           break;
   221    221         case SQLITE_FLOAT:
   222    222           Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("f", 1));
   223    223           pObj = Tcl_NewDoubleObj(sqlite3_value_double(pVal));
   224    224           break;
   225         -      case SQLITE_TEXT:
          225  +      case SQLITE_TEXT: {
          226  +        const char *z = (char*)sqlite3_value_blob(pVal);
          227  +        int n = sqlite3_value_bytes(pVal);
   226    228           Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("t", 1));
   227         -        pObj = Tcl_NewStringObj((char *)sqlite3_value_text(pVal), -1);
          229  +        pObj = Tcl_NewStringObj(z, n);
   228    230           break;
          231  +      }
   229    232         case SQLITE_BLOB:
   230    233           Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("b", 1));
   231    234           pObj = Tcl_NewByteArrayObj(
   232    235               sqlite3_value_blob(pVal),
   233    236               sqlite3_value_bytes(pVal)
   234    237           );
   235    238           break;