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

Side by Side Diff: third_party/sqlite/sqlite-src-3080704/src/test_demovfs.c

Issue 883353008: [sql] Import reference version of SQLite 3.8.7.4. (Closed) Base URL: http://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hold back encoding change which is messing up patch. Created 5 years, 10 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 ** 2010 April 7 2 ** 2010 April 7
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 **
11 ************************************************************************* 11 *************************************************************************
12 ** 12 **
13 ** An example of a simple VFS implementation that omits complex features 13 ** This file implements an example of a simple VFS implementation that
14 ** often not required or not possible on embedded platforms. Also includes 14 ** omits complex features often not required or not possible on embedded
15 ** code to buffer writes to the journal file, which can be a significant 15 ** platforms. Code is included to buffer writes to the journal file,
16 ** performance improvement on some embedded platforms. 16 ** which can be a significant performance improvement on some embedded
17 ** platforms.
17 ** 18 **
18 */
19
20 /*
21 ** OVERVIEW 19 ** OVERVIEW
22 ** 20 **
23 ** The code in this file implements a minimal SQLite VFS that can be 21 ** The code in this file implements a minimal SQLite VFS that can be
24 ** used on Linux and other posix-like operating systems. The following 22 ** used on Linux and other posix-like operating systems. The following
25 ** system calls are used: 23 ** system calls are used:
26 ** 24 **
27 ** File-system: access(), unlink(), getcwd() 25 ** File-system: access(), unlink(), getcwd()
28 ** File IO: open(), read(), write(), fsync(), close(), fstat() 26 ** File IO: open(), read(), write(), fsync(), close(), fstat()
29 ** Other: sleep(), usleep(), time() 27 ** Other: sleep(), usleep(), time()
30 ** 28 **
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 119
122 #include <assert.h> 120 #include <assert.h>
123 #include <string.h> 121 #include <string.h>
124 #include <sys/types.h> 122 #include <sys/types.h>
125 #include <sys/stat.h> 123 #include <sys/stat.h>
126 #include <sys/file.h> 124 #include <sys/file.h>
127 #include <sys/param.h> 125 #include <sys/param.h>
128 #include <unistd.h> 126 #include <unistd.h>
129 #include <time.h> 127 #include <time.h>
130 #include <errno.h> 128 #include <errno.h>
129 #include <fcntl.h>
131 130
132 /* 131 /*
133 ** Size of the write buffer used by journal files in bytes. 132 ** Size of the write buffer used by journal files in bytes.
134 */ 133 */
135 #ifndef SQLITE_DEMOVFS_BUFFERSZ 134 #ifndef SQLITE_DEMOVFS_BUFFERSZ
136 # define SQLITE_DEMOVFS_BUFFERSZ 8192 135 # define SQLITE_DEMOVFS_BUFFERSZ 8192
137 #endif 136 #endif
138 137
139 /* 138 /*
140 ** The maximum pathname length supported by this VFS. 139 ** The maximum pathname length supported by this VFS.
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 static int demoFullPathname( 529 static int demoFullPathname(
531 sqlite3_vfs *pVfs, /* VFS */ 530 sqlite3_vfs *pVfs, /* VFS */
532 const char *zPath, /* Input path (possibly a relative path) */ 531 const char *zPath, /* Input path (possibly a relative path) */
533 int nPathOut, /* Size of output buffer in bytes */ 532 int nPathOut, /* Size of output buffer in bytes */
534 char *zPathOut /* Pointer to output buffer */ 533 char *zPathOut /* Pointer to output buffer */
535 ){ 534 ){
536 char zDir[MAXPATHNAME+1]; 535 char zDir[MAXPATHNAME+1];
537 if( zPath[0]=='/' ){ 536 if( zPath[0]=='/' ){
538 zDir[0] = '\0'; 537 zDir[0] = '\0';
539 }else{ 538 }else{
540 getcwd(zDir, sizeof(zDir)); 539 if( getcwd(zDir, sizeof(zDir))==0 ) return SQLITE_IOERR;
541 } 540 }
542 zDir[MAXPATHNAME] = '\0'; 541 zDir[MAXPATHNAME] = '\0';
543 542
544 sqlite3_snprintf(nPathOut, zPathOut, "%s/%s", zDir, zPath); 543 sqlite3_snprintf(nPathOut, zPathOut, "%s/%s", zDir, zPath);
545 zPathOut[nPathOut-1] = '\0'; 544 zPathOut[nPathOut-1] = '\0';
546 545
547 return SQLITE_OK; 546 return SQLITE_OK;
548 } 547 }
549 548
550 /* 549 /*
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 Tcl_CreateObjCommand(interp, "register_demovfs", register_demovfs, 0, 0); 670 Tcl_CreateObjCommand(interp, "register_demovfs", register_demovfs, 0, 0);
672 Tcl_CreateObjCommand(interp, "unregister_demovfs", unregister_demovfs, 0, 0); 671 Tcl_CreateObjCommand(interp, "unregister_demovfs", unregister_demovfs, 0, 0);
673 return TCL_OK; 672 return TCL_OK;
674 } 673 }
675 674
676 #else 675 #else
677 int Sqlitetest_demovfs_Init(Tcl_Interp *interp){ return TCL_OK; } 676 int Sqlitetest_demovfs_Init(Tcl_Interp *interp){ return TCL_OK; }
678 #endif 677 #endif
679 678
680 #endif /* SQLITE_TEST */ 679 #endif /* SQLITE_TEST */
OLDNEW
« no previous file with comments | « third_party/sqlite/sqlite-src-3080704/src/test_config.c ('k') | third_party/sqlite/sqlite-src-3080704/src/test_devsym.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698