Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/sqlite/sqlite-src-3100200/src/test_intarray.c

Issue 1610543003: [sql] Import reference version of SQLite 3.10.2. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 ** 2009 November 10 2 ** 2009 November 10
3 ** 3 **
4 ** The author disclaims copyright to this source code. In place of 4 ** The author disclaims copyright to this source code. In place of
5 ** a legal notice, here is a blessing: 5 ** a legal notice, here is a blessing:
6 ** 6 **
7 ** May you do good and not evil. 7 ** May you do good and not evil.
8 ** May you find forgiveness for yourself and forgive others. 8 ** May you find forgiveness for yourself and forgive others.
9 ** May you share freely, never taking more than you give. 9 ** May you share freely, never taking more than you give.
10 ** 10 **
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 */ 78 */
79 static int intarrayCreate( 79 static int intarrayCreate(
80 sqlite3 *db, /* Database where module is created */ 80 sqlite3 *db, /* Database where module is created */
81 void *pAux, /* clientdata for the module */ 81 void *pAux, /* clientdata for the module */
82 int argc, /* Number of arguments */ 82 int argc, /* Number of arguments */
83 const char *const*argv, /* Value for all arguments */ 83 const char *const*argv, /* Value for all arguments */
84 sqlite3_vtab **ppVtab, /* Write the new virtual table object here */ 84 sqlite3_vtab **ppVtab, /* Write the new virtual table object here */
85 char **pzErr /* Put error message text here */ 85 char **pzErr /* Put error message text here */
86 ){ 86 ){
87 int rc = SQLITE_NOMEM; 87 int rc = SQLITE_NOMEM;
88 intarray_vtab *pVtab = sqlite3_malloc(sizeof(intarray_vtab)); 88 intarray_vtab *pVtab = sqlite3_malloc64(sizeof(intarray_vtab));
89 89
90 if( pVtab ){ 90 if( pVtab ){
91 memset(pVtab, 0, sizeof(intarray_vtab)); 91 memset(pVtab, 0, sizeof(intarray_vtab));
92 pVtab->pContent = (sqlite3_intarray*)pAux; 92 pVtab->pContent = (sqlite3_intarray*)pAux;
93 rc = sqlite3_declare_vtab(db, "CREATE TABLE x(value INTEGER PRIMARY KEY)"); 93 rc = sqlite3_declare_vtab(db, "CREATE TABLE x(value INTEGER PRIMARY KEY)");
94 } 94 }
95 *ppVtab = (sqlite3_vtab *)pVtab; 95 *ppVtab = (sqlite3_vtab *)pVtab;
96 return rc; 96 return rc;
97 } 97 }
98 98
99 /* 99 /*
100 ** Open a new cursor on the intarray table. 100 ** Open a new cursor on the intarray table.
101 */ 101 */
102 static int intarrayOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ 102 static int intarrayOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
103 int rc = SQLITE_NOMEM; 103 int rc = SQLITE_NOMEM;
104 intarray_cursor *pCur; 104 intarray_cursor *pCur;
105 pCur = sqlite3_malloc(sizeof(intarray_cursor)); 105 pCur = sqlite3_malloc64(sizeof(intarray_cursor));
106 if( pCur ){ 106 if( pCur ){
107 memset(pCur, 0, sizeof(intarray_cursor)); 107 memset(pCur, 0, sizeof(intarray_cursor));
108 *ppCursor = (sqlite3_vtab_cursor *)pCur; 108 *ppCursor = (sqlite3_vtab_cursor *)pCur;
109 rc = SQLITE_OK; 109 rc = SQLITE_OK;
110 } 110 }
111 return rc; 111 return rc;
112 } 112 }
113 113
114 /* 114 /*
115 ** Close a intarray table cursor. 115 ** Close a intarray table cursor.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 */ 218 */
219 SQLITE_API int sqlite3_intarray_create( 219 SQLITE_API int sqlite3_intarray_create(
220 sqlite3 *db, 220 sqlite3 *db,
221 const char *zName, 221 const char *zName,
222 sqlite3_intarray **ppReturn 222 sqlite3_intarray **ppReturn
223 ){ 223 ){
224 int rc = SQLITE_OK; 224 int rc = SQLITE_OK;
225 #ifndef SQLITE_OMIT_VIRTUALTABLE 225 #ifndef SQLITE_OMIT_VIRTUALTABLE
226 sqlite3_intarray *p; 226 sqlite3_intarray *p;
227 227
228 *ppReturn = p = sqlite3_malloc( sizeof(*p) ); 228 *ppReturn = p = sqlite3_malloc64( sizeof(*p) );
229 if( p==0 ){ 229 if( p==0 ){
230 return SQLITE_NOMEM; 230 return SQLITE_NOMEM;
231 } 231 }
232 memset(p, 0, sizeof(*p)); 232 memset(p, 0, sizeof(*p));
233 rc = sqlite3_create_module_v2(db, zName, &intarrayModule, p, 233 rc = sqlite3_create_module_v2(db, zName, &intarrayModule, p,
234 (void(*)(void*))intarrayFree); 234 (void(*)(void*))intarrayFree);
235 if( rc==SQLITE_OK ){ 235 if( rc==SQLITE_OK ){
236 char *zSql; 236 char *zSql;
237 zSql = sqlite3_mprintf("CREATE VIRTUAL TABLE temp.%Q USING %Q", 237 zSql = sqlite3_mprintf("CREATE VIRTUAL TABLE temp.%Q USING %Q",
238 zName, zName); 238 zName, zName);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 int i, n; 333 int i, n;
334 sqlite3_int64 *a; 334 sqlite3_int64 *a;
335 335
336 if( objc<2 ){ 336 if( objc<2 ){
337 Tcl_WrongNumArgs(interp, 1, objv, "INTARRAY"); 337 Tcl_WrongNumArgs(interp, 1, objv, "INTARRAY");
338 return TCL_ERROR; 338 return TCL_ERROR;
339 } 339 }
340 pArray = (sqlite3_intarray*)sqlite3TestTextToPtr(Tcl_GetString(objv[1])); 340 pArray = (sqlite3_intarray*)sqlite3TestTextToPtr(Tcl_GetString(objv[1]));
341 n = objc - 2; 341 n = objc - 2;
342 #ifndef SQLITE_OMIT_VIRTUALTABLE 342 #ifndef SQLITE_OMIT_VIRTUALTABLE
343 a = sqlite3_malloc( sizeof(a[0])*n ); 343 a = sqlite3_malloc64( sizeof(a[0])*n );
344 if( a==0 ){ 344 if( a==0 ){
345 Tcl_AppendResult(interp, "SQLITE_NOMEM", (char*)0); 345 Tcl_AppendResult(interp, "SQLITE_NOMEM", (char*)0);
346 return TCL_ERROR; 346 return TCL_ERROR;
347 } 347 }
348 for(i=0; i<n; i++){ 348 for(i=0; i<n; i++){
349 Tcl_WideInt x = 0; 349 Tcl_WideInt x = 0;
350 Tcl_GetWideIntFromObj(0, objv[i+2], &x); 350 Tcl_GetWideIntFromObj(0, objv[i+2], &x);
351 a[i] = x; 351 a[i] = x;
352 } 352 }
353 rc = sqlite3_intarray_bind(pArray, n, a, sqlite3_free); 353 rc = sqlite3_intarray_bind(pArray, n, a, sqlite3_free);
(...skipping 19 matching lines...) Expand all
373 }; 373 };
374 int i; 374 int i;
375 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ 375 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){
376 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, 376 Tcl_CreateObjCommand(interp, aObjCmd[i].zName,
377 aObjCmd[i].xProc, aObjCmd[i].clientData, 0); 377 aObjCmd[i].xProc, aObjCmd[i].clientData, 0);
378 } 378 }
379 return TCL_OK; 379 return TCL_OK;
380 } 380 }
381 381
382 #endif /* SQLITE_TEST */ 382 #endif /* SQLITE_TEST */
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3100200/src/test_intarray.h ('k') | third_party/sqlite/sqlite-src-3100200/src/test_journal.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698