SQLite

Check-in [bc0e661033]
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
Timelines: family | ancestors | descendants | both | sessions
Files: files | file ages | folders
SHA1: bc0e661033b78f27866932244e6204985ae39000
User & Date: drh 2014-03-06 14:53:25.586
Context
2014-03-06
15:01
Fix a harmless compiler warning in the sessions test harness. (check-in: d389e20ab0 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: bc0e661033 user: drh tags: sessions)
13:48
Merge the latest 3.8.4 tweaks from trunk. (check-in: 1ed463d918 user: drh tags: sessions)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to ext/session/test_session.c.
155
156
157
158
159
160
161
162

163
164
165
166
167
168
169
155
156
157
158
159
160
161

162
163
164
165
166
167
168
169







-
+







  return TCL_OK;
}

static void test_session_del(void *clientData){
  TestSession *p = (TestSession*)clientData;
  if( p->pFilterScript ) Tcl_DecrRefCount(p->pFilterScript);
  sqlite3session_delete(p->pSession);
  ckfree(p);
  ckfree((char*)p);
}

/*
** Tclcmd:  sqlite3session CMD DB-HANDLE DB-NAME
*/
static int test_sqlite3session(
  void * clientData,
187
188
189
190
191
192
193
194

195
196
197
198
199
200
201
187
188
189
190
191
192
193

194
195
196
197
198
199
200
201







-
+







  }
  db = *(sqlite3 **)info.objClientData;

  p = (TestSession*)ckalloc(sizeof(TestSession));
  memset(p, 0, sizeof(TestSession));
  rc = sqlite3session_create(db, Tcl_GetString(objv[3]), &p->pSession);
  if( rc!=SQLITE_OK ){
    ckfree(p);
    ckfree((char*)p);
    return test_session_error(interp, rc);
  }

  Tcl_CreateObjCommand(
      interp, Tcl_GetString(objv[1]), test_session_cmd, (ClientData)p,
      test_session_del
  );
218
219
220
221
222
223
224
225



226
227

228

229
230
231
232
233
234
235
218
219
220
221
222
223
224

225
226
227
228

229
230
231
232
233
234
235
236
237
238







-
+
+
+

-
+

+







        Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("i", 1));
        pObj = Tcl_NewWideIntObj(sqlite3_value_int64(pVal));
        break;
      case SQLITE_FLOAT:
        Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("f", 1));
        pObj = Tcl_NewDoubleObj(sqlite3_value_double(pVal));
        break;
      case SQLITE_TEXT:
      case SQLITE_TEXT: {
        const char *z = (char*)sqlite3_value_blob(pVal);
        int n = sqlite3_value_bytes(pVal);
        Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("t", 1));
        pObj = Tcl_NewStringObj((char *)sqlite3_value_text(pVal), -1);
        pObj = Tcl_NewStringObj(z, n);
        break;
      }
      case SQLITE_BLOB:
        Tcl_ListObjAppendElement(0, pList, Tcl_NewStringObj("b", 1));
        pObj = Tcl_NewByteArrayObj(
            sqlite3_value_blob(pVal),
            sqlite3_value_bytes(pVal)
        );
        break;