Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enable redefinable I/O if the SQLITE_ENABLE_REDEF_IO macro exists. (CVS 2883) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e170e15766389e978991b42a0d2ec303 |
User & Date: | drh 2006-01-07 16:06:07.000 |
Context
2006-01-07
| ||
18:10 | Make sure there is no ephemeral data on the stack before returning from an sqlite3_step() call. Otherwise, if the statement is in READ UNCOMMITTED mode then the data might be deleted or changed out from under us. (CVS 2884) (check-in: 19f71a6d19 user: drh tags: trunk) | |
16:06 | Enable redefinable I/O if the SQLITE_ENABLE_REDEF_IO macro exists. (CVS 2883) (check-in: e170e15766 user: drh tags: trunk) | |
14:02 | Fix some memory leaks caused by obscure syntax errors in SQL. (CVS 2882) (check-in: 6593199a4d user: danielk1977 tags: trunk) | |
Changes
Changes to src/os.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains OS interface code that is common to all ** architectures. */ #include "sqliteInt.h" #include "os.h" /* ** The following routines are convenience wrappers around methods ** of the OsFile object. This is mostly just syntactic sugar. All ** of this would be completely automatic if SQLite were coded using | > | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains OS interface code that is common to all ** architectures. */ #define _SQLITE_OS_C_ 1 #include "sqliteInt.h" #include "os.h" /* ** The following routines are convenience wrappers around methods ** of the OsFile object. This is mostly just syntactic sugar. All ** of this would be completely automatic if SQLite were coded using |
︙ | ︙ | |||
65 66 67 68 69 70 71 | } int sqlite3OsLockState(OsFile *id){ return id->pMethod->xLockState(id); } int sqlite3OsCheckReservedLock(OsFile *id){ return id->pMethod->xCheckReservedLock(id); } | > > > > > > > > > > > > > > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | } int sqlite3OsLockState(OsFile *id){ return id->pMethod->xLockState(id); } int sqlite3OsCheckReservedLock(OsFile *id){ return id->pMethod->xCheckReservedLock(id); } #ifdef SQLITE_ENABLE_REDEF_IO /* ** A function to return a pointer to the virtual function table. ** This routine really does not accomplish very much since the ** virtual function table is a global variable and anybody who ** can call this function can just as easily access the variable ** for themselves. Nevertheless, we include this routine for ** backwards compatibility with an earlier redefinable I/O ** interface design. */ struct sqlite3OsVtbl *sqlite3_os_switch(void){ return &sqlite3Os; } #endif |
Changes to src/os.h.
︙ | ︙ | |||
294 295 296 297 298 299 300 301 | int sqlite3OsInMutex(void); void *sqlite3OsThreadSpecificData(int); void *sqlite3OsMalloc(int); void *sqlite3OsRealloc(void *, int); void sqlite3OsFree(void *); int sqlite3OsAllocationSize(void *); #endif /* _SQLITE_OS_H_ */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | int sqlite3OsInMutex(void); void *sqlite3OsThreadSpecificData(int); void *sqlite3OsMalloc(int); void *sqlite3OsRealloc(void *, int); void sqlite3OsFree(void *); int sqlite3OsAllocationSize(void *); /* ** If the SQLITE_ENABLE_REDEF_IO macro is defined, then the OS-layer ** interface routines are not called directly but are invoked using ** pointers to functions. This allows the implementation of various ** OS-layer interface routines to be modified at run-time. There are ** obscure but legitimate reasons for wanting to do this. But for ** most users, a direct call to the underlying interface is preferable ** so the the redefinable I/O interface is turned off by default. */ #ifdef SQLITE_ENABLE_REDEF_IO /* ** When redefinable I/O is enabled, a single global instance of the ** following structure holds pointers to the routines that SQLite ** uses to talk with the underlying operating system. Modify this ** structure (before using any SQLite API!) to accomodate perculiar ** operating system interfaces or behaviors. */ struct sqlite3OsVtbl { int (*xOpenReadWrite)(const char*, OsFile**, int*); int (*xOpenExclusive)(const char*, OsFile**, int); int (*xOpenReadOnly)(const char*, OsFile**); int (*xDelete)(const char*); int (*xFileExists)(const char*); char *(*xFullPathname)(const char*); int (*xIsDirWritable)(char*); int (*xSyncDirectory)(const char*); int (*xTempFileName)(char*); int (*xRandomSeed)(char*); int (*xSleep)(int ms); int (*xCurrentTime)(double*); void (*xEnterMutex)(void); void (*xLeaveMutex)(void); int (*xInMutex)(void); void *(*xThreadSpecificData)(int); void *(*xMalloc)(int); void *(*xRealloc)(void *, int); void (*xFree)(void *); int (*xAllocationSize)(void *); }; /* Macro used to comment out routines that do not exists when there is ** no disk I/O */ #ifdef SQLITE_OMIT_DISKIO # define IF_DISKIO(X) 0 #else # define IF_DISKIO(X) X #endif #ifdef _SQLITE_OS_C_ /* ** The os.c file implements the global virtual function table. */ struct sqlite3OsVtbl sqlite3Os = { IF_DISKIO( sqlite3OsOpenReadWrite ), IF_DISKIO( sqlite3OsOpenExclusive ), IF_DISKIO( sqlite3OsOpenReadOnly ), IF_DISKIO( sqlite3OsDelete ), IF_DISKIO( sqlite3OsFileExists ), IF_DISKIO( sqlite3OsFullPathname ), IF_DISKIO( sqlite3OsIsDirWritable ), IF_DISKIO( sqlite3OsSyncDirectory ), IF_DISKIO( sqlite3OsTempFileName ), sqlite3OsRandomSeed, sqlite3OsSleep, sqlite3OsCurrentTime, sqlite3OsEnterMutex, sqlite3OsLeaveMutex, sqlite3OsInMutex, sqlite3OsThreadSpecificData, sqlite3OsMalloc, sqlite3OsRealloc, sqlite3OsFree, sqlite3OsAllocationSize }; #else /* ** Files other than os.c just reference the global virtual function table. */ extern struct sqlite3OsVtbl sqlite3Os; #endif /* _SQLITE_OS_C_ */ /* This additional API routine is available with redefinable I/O */ struct sqlite3OsVtbl *sqlite3_os_switch(void); /* ** Redefine the OS interface to go through the virtual function table ** rather than calling routines directly. */ #undef sqlite3OsOpenReadWrite #undef sqlite3OsOpenExclusive #undef sqlite3OsOpenReadOnly #undef sqlite3OsDelete #undef sqlite3OsFileExists #undef sqlite3OsFullPathname #undef sqlite3OsIsDirWritable #undef sqlite3OsSyncDirectory #undef sqlite3OsTempFileName #undef sqlite3OsRandomSeed #undef sqlite3OsSleep #undef sqlite3OsCurrentTime #undef sqlite3OsEnterMutex #undef sqlite3OsLeaveMutex #undef sqlite3OsInMutex #undef sqlite3OsThreadSpecificData #undef sqlite3OsMalloc #undef sqlite3OsRealloc #undef sqlite3OsFree #undef sqlite3OsAllocationSize #define sqlite3OsOpenReadWrite sqlite3Os.xOpenReadWrite #define sqlite3OsOpenExclusive sqlite3Os.xOpenExclusive #define sqlite3OsOpenReadOnly sqlite3Os.xOpenReadOnly #define sqlite3OsDelete sqlite3Os.xDelete #define sqlite3OsFileExists sqlite3Os.xFileExists #define sqlite3OsFullPathname sqlite3Os.xFullPathname #define sqlite3OsIsDirWritable sqlite3Os.xIsDirWritable #define sqlite3OsSyncDirectory sqlite3Os.xSyncDirectory #define sqlite3OsTempFileName sqlite3Os.xTempFileName #define sqlite3OsRandomSeed sqlite3Os.xRandomSeed #define sqlite3OsSleep sqlite3Os.xSleep #define sqlite3OsCurrentTime sqlite3Os.xCurrentTime #define sqlite3OsEnterMutex sqlite3Os.xEnterMutex #define sqlite3OsLeaveMutex sqlite3Os.xLeaveMutex #define sqlite3OsInMutex sqlite3Os.xInMutex #define sqlite3OsThreadSpecificData sqlite3Os.xThreadSpecificData #define sqlite3OsMalloc sqlite3Os.xMalloc #define sqlite3OsRealloc sqlite3Os.xRealloc #define sqlite3OsFree sqlite3Os.xFree #define sqlite3OsAllocationSize sqlite3Os.xAllocationSize #endif /* SQLITE_ENABLE_REDEF_IO */ #endif /* _SQLITE_OS_H_ */ |
Changes to src/test1.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** Code for testing the printf() interface to SQLite. This code ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** ** $Id: test1.c,v 1.183 2006/01/07 16:06:07 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include "os.h" #include <stdlib.h> #include <string.h> |
︙ | ︙ | |||
3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 | #endif #ifdef SQLITE_OMIT_PROGRESS_CALLBACK Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); #endif #ifdef SQLITE_OMIT_REINDEX Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); #endif | > > > > > > | 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 | #endif #ifdef SQLITE_OMIT_PROGRESS_CALLBACK Tcl_SetVar2(interp, "sqlite_options", "progress", "0", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "progress", "1", TCL_GLOBAL_ONLY); #endif #ifdef SQLITE_ENABLE_REDEF_IO Tcl_SetVar2(interp, "sqlite_options", "redefio", "1", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "redefio", "0", TCL_GLOBAL_ONLY); #endif #ifdef SQLITE_OMIT_REINDEX Tcl_SetVar2(interp, "sqlite_options", "reindex", "0", TCL_GLOBAL_ONLY); #else Tcl_SetVar2(interp, "sqlite_options", "reindex", "1", TCL_GLOBAL_ONLY); #endif |
︙ | ︙ |