Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the "lock_status" pragma - only available when SQLITE_DEBUG is defined. Used for testing only. (CVS 1547) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
0ecbba78fcde8f7715cd74c674b5040e |
User & Date: | drh 2004-06-09 14:17:21.000 |
Context
2004-06-09
| ||
17:37 | Fixes to the file locking. 109 tests are now failing. (CVS 1548) (check-in: dc0763455b user: drh tags: trunk) | |
14:17 | Add the "lock_status" pragma - only available when SQLITE_DEBUG is defined. Used for testing only. (CVS 1547) (check-in: 0ecbba78fc user: drh tags: trunk) | |
14:01 | Change the MEMORY_DEBUG macro to SQLITE_DEBUG. (CVS 1546) (check-in: 428b685b71 user: drh tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** ** @(#) $Id: pager.c,v 1.114 2004/06/09 14:17:21 drh Exp $ */ #include "os.h" /* Must be first to enable large file support */ #include "sqliteInt.h" #include "pager.h" #include <assert.h> #include <string.h> |
︙ | ︙ | |||
2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 | rc = sqlite3OsSync(&pPager->fd); } } sync_exit: return rc; } #ifdef SQLITE_TEST /* ** Print a listing of all referenced pages and their ref count. */ void sqlite3pager_refdump(Pager *pPager){ PgHdr *pPg; | > > > > > > > > > > > | 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 | rc = sqlite3OsSync(&pPager->fd); } } sync_exit: return rc; } #ifdef SQLITE_DEBUG /* ** Return the current state of the file lock for the given pager. ** The return value is one of NO_LOCK, SHARED_LOCK, RESERVED_LOCK, ** PENDING_LOCK, or EXCLUSIVE_LOCK. */ int sqlite3pager_lockstate(Pager *pPager){ return pPager->fd.locktype; } #endif #ifdef SQLITE_TEST /* ** Print a listing of all referenced pages and their ref count. */ void sqlite3pager_refdump(Pager *pPager){ PgHdr *pPg; |
︙ | ︙ |
Changes to src/pager.h.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This header file defines the interface that the sqlite page cache ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. ** | | | 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 header file defines the interface that the sqlite page cache ** subsystem. The page cache subsystem reads and writes a file a page ** at a time and provides a journal for rollback. ** ** @(#) $Id: pager.h,v 1.32 2004/06/09 14:17:21 drh Exp $ */ /* ** The size of a page. ** ** You can change this value to another (reasonable) value you want. ** It need not be a power of two, though the interface to the disk |
︙ | ︙ | |||
96 97 98 99 100 101 102 103 104 105 106 107 | void sqlite3pager_dont_rollback(void*); void sqlite3pager_dont_write(Pager*, Pgno); int *sqlite3pager_stats(Pager*); void sqlite3pager_set_safety_level(Pager*,int); const char *sqlite3pager_filename(Pager*); int sqlite3pager_rename(Pager*, const char *zNewName); void sqlite3pager_set_codec(Pager*,void(*)(void*,void*,Pgno,int),void*); #ifdef SQLITE_TEST void sqlite3pager_refdump(Pager*); int pager3_refinfo_enable; #endif | > > > > | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | void sqlite3pager_dont_rollback(void*); void sqlite3pager_dont_write(Pager*, Pgno); int *sqlite3pager_stats(Pager*); void sqlite3pager_set_safety_level(Pager*,int); const char *sqlite3pager_filename(Pager*); int sqlite3pager_rename(Pager*, const char *zNewName); void sqlite3pager_set_codec(Pager*,void(*)(void*,void*,Pgno,int),void*); #ifdef SQLITE_DEBUG int sqlite3pager_lockstate(Pager*); #endif #ifdef SQLITE_TEST void sqlite3pager_refdump(Pager*); int pager3_refinfo_enable; #endif |
Changes to src/pragma.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** | | > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | /* ** 2003 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** ** $Id: pragma.c,v 1.40 2004/06/09 14:17:21 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> #ifdef SQLITE_DEBUG # include "pager.h" # include "btree.h" #endif /* ** Interpret the given string as a boolean value. */ static int getBoolean(const char *z){ static char *azTrue[] = { "yes", "on", "true" }; int i; |
︙ | ︙ | |||
803 804 805 806 807 808 809 810 811 812 813 814 | if( !pEnc->zName ){ sqlite3Error(pParse->db, SQLITE_ERROR, "Unsupported encoding: %s", zRight); } } } }else {} sqliteFree(zLeft); sqliteFree(zRight); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 | if( !pEnc->zName ){ sqlite3Error(pParse->db, SQLITE_ERROR, "Unsupported encoding: %s", zRight); } } } }else #ifdef SQLITE_DEBUG /* ** Report the current state of file logs for all databases */ if( sqlite3StrICmp(zLeft, "lock_status")==0 ){ static char *azLockName[] = { "unlocked", "shared", "reserved", "pending", "exclusive" }; int i; Vdbe *v = sqlite3GetVdbe(pParse); sqlite3VdbeSetNumCols(v, 2); sqlite3VdbeSetColName(v, 0, "database", P3_STATIC); sqlite3VdbeSetColName(v, 1, "status", P3_STATIC); for(i=0; i<db->nDb; i++){ Btree *pBt; Pager *pPager; if( db->aDb[i].zName==0 ) continue; sqlite3VdbeOp3(v, OP_String, 0, 0, db->aDb[i].zName, P3_STATIC); pBt = db->aDb[i].pBt; if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){ sqlite3VdbeOp3(v, OP_String, 0, 0, "closed", P3_STATIC); }else{ int j = sqlite3pager_lockstate(pPager); sqlite3VdbeOp3(v, OP_String, 0, 0, (j>=0 && j<=4) ? azLockName[j] : "unknown", P3_STATIC); } sqlite3VdbeAddOp(v, OP_Callback, 2, 0); } }else #endif {} sqliteFree(zLeft); sqliteFree(zRight); } |