OLD | NEW |
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 pIntArray->a = aElements; | 263 pIntArray->a = aElements; |
264 pIntArray->xFree = xFree; | 264 pIntArray->xFree = xFree; |
265 return SQLITE_OK; | 265 return SQLITE_OK; |
266 } | 266 } |
267 | 267 |
268 | 268 |
269 /***************************************************************************** | 269 /***************************************************************************** |
270 ** Everything below is interface for testing this module. | 270 ** Everything below is interface for testing this module. |
271 */ | 271 */ |
272 #ifdef SQLITE_TEST | 272 #ifdef SQLITE_TEST |
273 #include <tcl.h> | 273 #if defined(INCLUDE_SQLITE_TCL_H) |
| 274 # include "sqlite_tcl.h" |
| 275 #else |
| 276 # include "tcl.h" |
| 277 # ifndef SQLITE_TCLAPI |
| 278 # define SQLITE_TCLAPI |
| 279 # endif |
| 280 #endif |
274 | 281 |
275 /* | 282 /* |
276 ** Routines to encode and decode pointers | 283 ** Routines to encode and decode pointers |
277 */ | 284 */ |
278 extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); | 285 extern int getDbPointer(Tcl_Interp *interp, const char *zA, sqlite3 **ppDb); |
279 extern void *sqlite3TestTextToPtr(const char*); | 286 extern void *sqlite3TestTextToPtr(const char*); |
280 extern int sqlite3TestMakePointerStr(Tcl_Interp*, char *zPtr, void*); | 287 extern int sqlite3TestMakePointerStr(Tcl_Interp*, char *zPtr, void*); |
281 extern const char *sqlite3ErrName(int); | 288 extern const char *sqlite3ErrName(int); |
282 | 289 |
283 /* | 290 /* |
284 ** sqlite3_intarray_create DB NAME | 291 ** sqlite3_intarray_create DB NAME |
285 ** | 292 ** |
286 ** Invoke the sqlite3_intarray_create interface. A string that becomes | 293 ** Invoke the sqlite3_intarray_create interface. A string that becomes |
287 ** the first parameter to sqlite3_intarray_bind. | 294 ** the first parameter to sqlite3_intarray_bind. |
288 */ | 295 */ |
289 static int test_intarray_create( | 296 static int SQLITE_TCLAPI test_intarray_create( |
290 ClientData clientData, /* Not used */ | 297 ClientData clientData, /* Not used */ |
291 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 298 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
292 int objc, /* Number of arguments */ | 299 int objc, /* Number of arguments */ |
293 Tcl_Obj *CONST objv[] /* Command arguments */ | 300 Tcl_Obj *CONST objv[] /* Command arguments */ |
294 ){ | 301 ){ |
295 sqlite3 *db; | 302 sqlite3 *db; |
296 const char *zName; | 303 const char *zName; |
297 sqlite3_intarray *pArray; | 304 sqlite3_intarray *pArray; |
298 int rc = SQLITE_OK; | 305 int rc = SQLITE_OK; |
299 char zPtr[100]; | 306 char zPtr[100]; |
(...skipping 15 matching lines...) Expand all Loading... |
315 sqlite3TestMakePointerStr(interp, zPtr, pArray); | 322 sqlite3TestMakePointerStr(interp, zPtr, pArray); |
316 Tcl_AppendResult(interp, zPtr, (char*)0); | 323 Tcl_AppendResult(interp, zPtr, (char*)0); |
317 return TCL_OK; | 324 return TCL_OK; |
318 } | 325 } |
319 | 326 |
320 /* | 327 /* |
321 ** sqlite3_intarray_bind INTARRAY ?VALUE ...? | 328 ** sqlite3_intarray_bind INTARRAY ?VALUE ...? |
322 ** | 329 ** |
323 ** Invoke the sqlite3_intarray_bind interface on the given array of integers. | 330 ** Invoke the sqlite3_intarray_bind interface on the given array of integers. |
324 */ | 331 */ |
325 static int test_intarray_bind( | 332 static int SQLITE_TCLAPI test_intarray_bind( |
326 ClientData clientData, /* Not used */ | 333 ClientData clientData, /* Not used */ |
327 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ | 334 Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ |
328 int objc, /* Number of arguments */ | 335 int objc, /* Number of arguments */ |
329 Tcl_Obj *CONST objv[] /* Command arguments */ | 336 Tcl_Obj *CONST objv[] /* Command arguments */ |
330 ){ | 337 ){ |
331 sqlite3_intarray *pArray; | 338 sqlite3_intarray *pArray; |
332 int rc = SQLITE_OK; | 339 int rc = SQLITE_OK; |
333 int i, n; | 340 int i, n; |
334 sqlite3_int64 *a; | 341 sqlite3_int64 *a; |
335 | 342 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 }; | 380 }; |
374 int i; | 381 int i; |
375 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ | 382 for(i=0; i<sizeof(aObjCmd)/sizeof(aObjCmd[0]); i++){ |
376 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, | 383 Tcl_CreateObjCommand(interp, aObjCmd[i].zName, |
377 aObjCmd[i].xProc, aObjCmd[i].clientData, 0); | 384 aObjCmd[i].xProc, aObjCmd[i].clientData, 0); |
378 } | 385 } |
379 return TCL_OK; | 386 return TCL_OK; |
380 } | 387 } |
381 | 388 |
382 #endif /* SQLITE_TEST */ | 389 #endif /* SQLITE_TEST */ |
OLD | NEW |