Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From c5366deaf5beca9c To 5c99bea5a480edc7
2005-02-26
| ||
17:31 | Fix an assertion fault that can occur while autovacuuming a corrupt database file. Add the SQLITE_OMIT_COMPLETE compile-time parameter. (CVS 2361) (check-in: bb0e7e3857 user: drh tags: trunk) | |
2005-02-24
| ||
04:51 | Revised man page from Bill Bumgarner. (CVS 2360) (check-in: 5c99bea5a4 user: drh tags: trunk) | |
2005-02-23
| ||
12:35 | Remove strcasecmp from shell.c. Tickets #1108, #1122. (CVS 2359) (check-in: 4ae1a9fc2c user: drh tags: trunk) | |
2005-02-18
| ||
01:15 | Fix typos in documentation for pragma short_column_names. Ticket #1130. (CVS 2350) (check-in: fac56fa1e0 user: danielk1977 tags: trunk) | |
2005-02-17
| ||
00:03 | Compile-time option to limit the size of AUTOINCREMENT rowids to 32-bits. (CVS 2349) (check-in: c5366deaf5 user: drh tags: trunk) | |
2005-02-16
| ||
23:43 | Clarify that columns are indexed from 0 when using sqlite3_column_XXX() APIs. No code changes. (CVS 2348) (check-in: d5eb25d8d0 user: danielk1977 tags: trunk) | |
Changes to VERSION.
|
| | | 1 | 3.1.3 |
Changes to mkdll.sh.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | for i in *.c; do CMD="$CC -c $i" echo $CMD $CMD done echo 'EXPORTS' >tclsqlite3.def echo 'Tclsqlite3_Init' >>tclsqlite3.def echo 'Sqlite3_Init' >>tclsqlite3.def i386-mingw32msvc-dllwrap \ --def tclsqlite3.def -v --export-all \ --driver-name i386-mingw32msvc-gcc \ --dlltool-name i386-mingw32msvc-dlltool \ --as i386-mingw32msvc-as \ --target i386-mingw32 \ -dllname tclsqlite3.dll -lmsvcrt *.o $TCLSTUBLIB | > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | for i in *.c; do CMD="$CC -c $i" echo $CMD $CMD done echo 'EXPORTS' >tclsqlite3.def echo 'Tclsqlite3_Init' >>tclsqlite3.def echo 'Tclsqlite_Init' >>tclsqlite3.def echo 'Sqlite3_Init' >>tclsqlite3.def echo 'Sqlite_Init' >>tclsqlite3.def i386-mingw32msvc-dllwrap \ --def tclsqlite3.def -v --export-all \ --driver-name i386-mingw32msvc-gcc \ --dlltool-name i386-mingw32msvc-dlltool \ --as i386-mingw32msvc-as \ --target i386-mingw32 \ -dllname tclsqlite3.dll -lmsvcrt *.o $TCLSTUBLIB |
︙ | ︙ |
Changes to sqlite3.1.
1 2 3 4 | .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) | | > | > | | > > > | > | | < > > | < > | > > | < < < < < | < < | | | < > | > | > > | > > | > > | > > > | > > > | | | > > > > > > > > > > > > > > > > > > > > < < | < | < > > > | | > > | | < < > | > > | | > > > > | < < < < | | < < < < < < < | > | | < | < < < < < < < < < < < < < | < < < < < < < | | > | > > > | > > | | | > | > > > | | < > | | < > > > > > > > > > > < < | > > > | | | | > | | < < | < | < < | | | 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | .\" Hey, EMACS: -*- nroff -*- .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) .TH SQLITE3 1 "Mon Apr 15 23:49:17 2002" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: .\" .nh disable hyphenation .\" .hy enable hyphenation .\" .ad l left justify .\" .ad b justify to both left and right margins .\" .nf disable filling .\" .fi enable filling .\" .br insert line break .\" .sp <n> insert n+1 empty lines .\" for manpage-specific macros, see man(7) .SH NAME .B sqlite3 \- A command line interface for SQLite version 3 .SH SYNOPSIS .B sqlite3 .RI [ options ] .RI [ databasefile ] .RI [ SQL ] .SH SUMMARY .PP .B sqlite3 is a terminal-based front-end to the SQLite library that can evaluate queries interactively and display the results in multiple formats. .B sqlite3 can also be used within shell scripts and other applications to provide batch processing features. .SH DESCRIPTION To start a .B sqlite3 interactive session, invoke the .B sqlite3 command and optionally provide the name of a database file. If the database file does not exist, it will be created. If the database file does exist, it will be opened. For example, to create a new database file named "mydata.db", create a table named "memos" and insert a couple of records into that table: .sp $ .B sqlite3 mydata.db .br SQLite version 3.1.3 .br Enter ".help" for instructions .br sqlite> .B create table memos(text, priority INTEGER); .br sqlite> .B insert into memos values('deliver project description', 10); .br sqlite> .B insert into memos values('lunch with Christine', 100); .br sqlite> .B select * from memos; .br deliver project description|10 .br lunch with Christine|100 .br sqlite> .sp If no database name is supplied, the ATTACH sql command can be used to attach to existing or create new database files. ATTACH can also be used to attach to multiple databases within the same interactive session. This is useful for migrating data between databases, possibly changing the schema along the way. Optionally, a SQL statement or set of SQL statements can be supplied as a single argument. Multiple statements should be separated by semi-colons. For example: .sp $ .B sqlite3 -line mydata.db 'select * from memos where priority > 20;' .br text = lunch with Christine .br priority = 100 .br .sp .SS SQLITE META-COMMANDS .PP The interactive interpreter offers a set of meta-commands that can be used to control the output format, examine the currently attached database files, or perform administrative operations upon the attached databases (such as rebuilding indices). Meta-commands are always prefixed with a dot (.). A list of available meta-commands can be viewed at any time by issuing the '.help' command. For example: .sp sqlite> .B .help .nf .cc | .databases List names and files of attached databases .dump ?TABLE? ... Dump the database in an SQL text format .echo ON|OFF Turn command echo on or off .exit Exit this program .explain ON|OFF Turn output mode suitable for EXPLAIN on or off. .header(s) ON|OFF Turn display of headers on or off .help Show this message .import FILE TABLE Import data from FILE into TABLE .indices TABLE Show names of all indices on TABLE .mode MODE ?TABLE? Set output mode where MODE is one of: csv Comma-separated values column Left-aligned columns. (See .width) html HTML <table> code insert SQL insert statements for TABLE line One value per line list Values delimited by .separator string tabs Tab-separated values tcl TCL list elements .nullvalue STRING Print STRING in place of NULL values .output FILENAME Send output to FILENAME .output stdout Send output to the screen .prompt MAIN CONTINUE Replace the standard prompts .quit Exit this program .read FILENAME Execute SQL in FILENAME .schema ?TABLE? Show the CREATE statements .separator STRING Change separator used by output mode and .import .show Show the current values for various settings .tables ?PATTERN? List names of tables matching a LIKE pattern .timeout MS Try opening locked tables for MS milliseconds .width NUM NUM ... Set column widths for "column" mode sqlite> |cc . .sp .fi .SH OPTIONS .B sqlite3 has the following options: .TP .BI \-init\ file Read and execute commands from .I file , which can contain a mix of SQL statements and meta-commands. .TP .B \-echo Print commands before execution. .TP .B \-[no]header Turn headers on or off. .TP .B \-column Query results will be displayed in a table like form, using whitespace characters to separate the columns and align the output. .TP .B \-html Query results will be output as simple HTML tables. .TP .B \-line Query results will be displayed with one value per line, rows separated by a blank line. Designed to be easily parsed by scripts or other programs .TP .B \-list Query results will be displayed with the separator (|, by default) character between each field value. The default. .TP .BI \-separator\ separator Set output field separator. Default is '|'. .TP .BI \-nullvalue\ string Set string used to represent NULL values. Default is '' (empty string). .TP .B \-version Show SQLite version. .TP .B \-help Show help on options and exit. .SH INIT FILE .B sqlite3 reads an initialization file to set the configuration of the interactive environment. Throughout initialization, any previously specified setting can be overridden. The sequence of initialization is as follows: o The default configuration is established as follows: .sp .nf .cc | mode = LIST separator = "|" main prompt = "sqlite> " continue prompt = " ...> " |cc . .sp .fi o If the file .B ~/.sqliterc exists, it is processed first. can be found in the user's home directory, it is read and processed. It should generally only contain meta-commands. o If the -init option is present, the specified file is processed. o All other command line options are processed. .SH SEE ALSO http://www.sqlite.org/ .br The sqlite-doc package .SH AUTHOR This manual page was originally written by Andreas Rottmann <rotty@debian.org>, for the Debian GNU/Linux system (but may be used by others). It was subsequently revised by Bill Bumgarner <bbum@mac.com>. |
Changes to src/build.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** ** $Id: build.c,v 1.312 2005/02/19 08:18:06 danielk1977 Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** This routine is called when a new SQL statement is beginning to ** be parsed. Initialize the pParse structure as needed. |
︙ | ︙ | |||
742 743 744 745 746 747 748 749 750 | ** and allocate the record number for the table entry now. Before any ** PRIMARY KEY or UNIQUE keywords are parsed. Those keywords will cause ** indices to be created and the table record must come before the ** indices. Hence, the record number for the table must be allocated ** now. */ if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ sqlite3BeginWriteOperation(pParse, 0, iDb); | > < | | > > > > | 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 | ** and allocate the record number for the table entry now. Before any ** PRIMARY KEY or UNIQUE keywords are parsed. Those keywords will cause ** indices to be created and the table record must come before the ** indices. Hence, the record number for the table must be allocated ** now. */ if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ int lbl; sqlite3BeginWriteOperation(pParse, 0, iDb); /* If the file format and encoding in the database have not been set, ** set them now. */ sqlite3VdbeAddOp(v, OP_ReadCookie, iDb, 1); /* file_format */ lbl = sqlite3VdbeMakeLabel(v); sqlite3VdbeAddOp(v, OP_If, 0, lbl); sqlite3VdbeAddOp(v, OP_Integer, db->file_format, 0); sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 1); sqlite3VdbeAddOp(v, OP_Integer, db->enc, 0); sqlite3VdbeAddOp(v, OP_SetCookie, iDb, 4); sqlite3VdbeResolveLabel(v, lbl); /* This just creates a place-holder record in the sqlite_master table. ** The record created does not contain anything yet. It will be replaced ** by the real entry in code generated at sqlite3EndTable(). ** ** The rowid for the new entry is left on the top of the stack. ** The rowid value is needed by the code that sqlite3EndTable will |
︙ | ︙ |
Changes to src/main.c.
︙ | ︙ | |||
10 11 12 13 14 15 16 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.281 2005/02/19 08:18:06 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> /* ** The following constant value is used by the SQLITE_BIGENDIAN and |
︙ | ︙ | |||
253 254 255 256 257 258 259 260 261 262 | if( iDb==0 ){ db->file_format = meta[1]; if( db->file_format==0 ){ /* This happens if the database was initially empty */ db->file_format = 1; } } /* | > > > > > > > | > > > > | | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | if( iDb==0 ){ db->file_format = meta[1]; if( db->file_format==0 ){ /* This happens if the database was initially empty */ db->file_format = 1; } if( db->file_format==2 ){ /* File format 2 is treated exactly as file format 1. New ** databases are created with file format 1. */ db->file_format = 1; } } /* ** file_format==1 Version 3.0.0. ** file_format==2 Version 3.1.3. ** ** Version 3.0 can only use files with file_format==1. Version 3.1.3 ** can read and write files with file_format==1 or file_format==2. */ if( meta[1]>2 ){ sqlite3BtreeCloseCursor(curMain); sqlite3SetString(pzErrMsg, "unsupported file format", (char*)0); return SQLITE_ERROR; } sqlite3BtreeSetCacheSize(db->aDb[iDb].pBt, db->aDb[iDb].cache_size); |
︙ | ︙ |
Changes to src/shell.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code to implement the "sqlite" command line ** utility for accessing SQLite databases. ** ** $Id: shell.c,v 1.122 2005/02/23 12:35:41 drh Exp $ */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include <assert.h> #include "sqlite3.h" #include <ctype.h> |
︙ | ︙ | |||
652 653 654 655 656 657 658 | struct callback_data *p = (struct callback_data *)pArg; if( nArg!=3 ) return 1; zTable = azArg[0]; zType = azArg[1]; zSql = azArg[2]; | | | 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | struct callback_data *p = (struct callback_data *)pArg; if( nArg!=3 ) return 1; zTable = azArg[0]; zType = azArg[1]; zSql = azArg[2]; if( strcmp(zTable,"sqlite_sequence")!=0 ){ fprintf(p->out, "%s;\n", zSql); }else{ fprintf(p->out, "DELETE FROM sqlite_sequence;\n"); } if( strcmp(zType, "table")==0 ){ sqlite3_stmt *pTableInfo = 0; |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.456 2005/02/19 08:18:06 danielk1977 Exp $ */ #include "sqliteInt.h" #include "os.h" #include <ctype.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
1678 1679 1680 1681 1682 1683 1684 | } /* Opcode: Column P1 P2 * ** ** Interpret the data that cursor P1 points to as a structure built using ** the MakeRecord instruction. (See the MakeRecord opcode for additional ** information about the format of the data.) Push onto the stack the value | | > | 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 | } /* Opcode: Column P1 P2 * ** ** Interpret the data that cursor P1 points to as a structure built using ** the MakeRecord instruction. (See the MakeRecord opcode for additional ** information about the format of the data.) Push onto the stack the value ** of the P2-th column contained in the data. If there are less that (P2+1) ** values in the record, push a NULL onto the stack. ** ** If the KeyAsData opcode has previously executed on this cursor, then the ** field might be extracted from the key rather than the data. ** ** If P1 is negative, then the record is stored on the stack rather than in ** a table. For P1==-1, the top of the stack is used. For P1==-2, the ** next on the stack is used. And so forth. The value pushed is always |
︙ | ︙ | |||
1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 | /* Scan the header and use it to fill in the aType[] and aOffset[] ** arrays. aType[i] will contain the type integer for the i-th ** column and aOffset[i] will contain the offset from the beginning ** of the record to the start of the data for the i-th column */ offset = szHdr; i = 0; while( idx<szHdr && i<nField && offset<=payloadSize ){ aOffset[i] = offset; idx += sqlite3GetVarint32(&zData[idx], &aType[i]); offset += sqlite3VdbeSerialTypeLen(aType[i]); i++; } Release(&sMem); sMem.flags = MEM_Null; /* The header should end at the start of data and the data should ** end at last byte of the record. If this is not the case then ** we are dealing with a malformed record. */ if( idx!=szHdr || offset!=payloadSize ){ rc = SQLITE_CORRUPT; goto op_column_out; } /* Remember all aType and aColumn information if we have a cursor ** to remember it in. */ if( pC ){ pC->payloadSize = payloadSize; pC->aType = aType; pC->aOffset = aOffset; pC->cacheValid = 1; } } | > > > > > > > > > > > | > > > > | | | | | | | | | | | | | > > > | 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 | /* Scan the header and use it to fill in the aType[] and aOffset[] ** arrays. aType[i] will contain the type integer for the i-th ** column and aOffset[i] will contain the offset from the beginning ** of the record to the start of the data for the i-th column */ offset = szHdr; assert( offset>0 ); i = 0; while( idx<szHdr && i<nField && offset<=payloadSize ){ aOffset[i] = offset; idx += sqlite3GetVarint32(&zData[idx], &aType[i]); offset += sqlite3VdbeSerialTypeLen(aType[i]); i++; } Release(&sMem); sMem.flags = MEM_Null; /* If i is less that nField, then there are less fields in this ** record than SetNumColumns indicated there are columns in the ** table. Set the offset for any extra columns not present in ** the record to 0. This tells code below to push a NULL onto the ** stack instead of deserializing a value from the record. */ while( i<nField ){ aOffset[i++] = 0; } /* The header should end at the start of data and the data should ** end at last byte of the record. If this is not the case then ** we are dealing with a malformed record. */ if( idx!=szHdr || offset!=payloadSize ){ rc = SQLITE_CORRUPT; goto op_column_out; } /* Remember all aType and aColumn information if we have a cursor ** to remember it in. */ if( pC ){ pC->payloadSize = payloadSize; pC->aType = aType; pC->aOffset = aOffset; pC->cacheValid = 1; } } /* Get the column information. If aOffset[p2] is non-zero, then ** deserialize the value from the record. If aOffset[p2] is zero, ** then there are not enough fields in the record to satisfy the ** request. The value is NULL in this case. */ if( aOffset[p2] ){ assert( rc==SQLITE_OK ); if( zRec ){ zData = &zRec[aOffset[p2]]; }else{ len = sqlite3VdbeSerialTypeLen(aType[p2]); rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len,pC->keyAsData,&sMem); if( rc!=SQLITE_OK ){ goto op_column_out; } zData = sMem.z; } sqlite3VdbeSerialGet(zData, aType[p2], pTos); pTos->enc = db->enc; }else{ pTos->flags = MEM_Null; } /* If we dynamically allocated space to hold the data (in the ** sqlite3VdbeMemFromBtree() call above) then transfer control of that ** dynamically allocated space over to the pTos structure rather. ** This prevents a memory copy. */ if( (sMem.flags & MEM_Dyn)!=0 ){ |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is reponsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is reponsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** ** $Id: where.c,v 1.135 2005/02/22 09:47:18 danielk1977 Exp $ */ #include "sqliteInt.h" /* ** The query generator uses an array of instances of this structure to ** help it analyze the subexpressions of the WHERE clause. Each WHERE ** clause subexpression is separated from the others by an AND operator. |
︙ | ︙ | |||
1119 1120 1121 1122 1123 1124 1125 | start = sqlite3VdbeCurrentAddr(v); pLevel->op = bRev ? OP_Prev : OP_Next; pLevel->p1 = iCur; pLevel->p2 = start; if( testOp!=OP_Noop ){ sqlite3VdbeAddOp(v, OP_Recno, iCur, 0); sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0); | | | 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 | start = sqlite3VdbeCurrentAddr(v); pLevel->op = bRev ? OP_Prev : OP_Next; pLevel->p1 = iCur; pLevel->p2 = start; if( testOp!=OP_Noop ){ sqlite3VdbeAddOp(v, OP_Recno, iCur, 0); sqlite3VdbeAddOp(v, OP_MemLoad, pLevel->iMem, 0); sqlite3VdbeAddOp(v, testOp, (int)(('n'<<8)&0x0000FF00), brk); } }else if( pIdx==0 ){ /* Case 4: There is no usable index. We must do a complete ** scan of the entire database table. */ int start; int opRewind; |
︙ | ︙ |
Added test/alter2.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | # 2005 February 18 # # 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 implements regression tests for SQLite library. The # focus of this script is testing that SQLite can handle a subtle # file format change that may be used in the future to implement # "ALTER TABLE ... ADD COLUMN". # # $Id: alter2.test,v 1.1 2005/02/19 08:18:06 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # The file format change affects the way row-records stored in tables (but # not indices) are interpreted. Before version 3.1.3, a row-record for a # table with N columns was guaranteed to contain exactly N fields. As # of version 3.1.3, the record may contain up to N fields. In this case # the M fields that are present are the values for the left-most M # columns. The (N-M) rightmost columns contain NULL. # # If any records in the database contain less fields than their table # has columns, then the file-format meta value should be set to (at least) 2. # # This procedure sets the value of the file-format in file 'test.db' # to $newval. Also, the schema cookie is incremented. # proc set_file_format {newval} { set bt [btree_open test.db 10 0] btree_begin_transaction $bt set meta [btree_get_meta $bt] lset meta 2 $newval ;# File format lset meta 1 [expr [lindex $meta 1]+1] ;# Schema cookie eval "btree_update_meta $bt $meta" btree_commit $bt btree_close $bt } # This procedure returns the value of the file-format in file 'test.db'. # proc get_file_format {{fname test.db}} { set bt [btree_open $fname 10 0] set meta [btree_get_meta $bt] btree_close $bt lindex $meta 2 } # This procedure sets the SQL statement stored for table $tbl in the # sqlite_master table of file 'test.db' to $sql. # proc alter_table {tbl sql} { sqlite3 dbat test.db dbat eval { PRAGMA writable_schema = 1; UPDATE sqlite_master SET sql = $sql WHERE name = $tbl AND type = 'table'; PRAGMA writable_schema = 0; } dbat close set_file_format 2 } #----------------------------------------------------------------------- # Some basic tests to make sure short rows are handled. # do_test alter2-1.1 { execsql { CREATE TABLE abc(a, b); INSERT INTO abc VALUES(1, 2); INSERT INTO abc VALUES(3, 4); INSERT INTO abc VALUES(5, 6); } } {} do_test alter2-1.2 { # ALTER TABLE abc ADD COLUMN c; alter_table abc {CREATE TABLE abc(a, b, c);} } {} do_test alter2-1.3 { execsql { SELECT * FROM abc; } } {1 2 {} 3 4 {} 5 6 {}} do_test alter2-1.4 { execsql { UPDATE abc SET c = 10 WHERE a = 1; SELECT * FROM abc; } } {1 2 10 3 4 {} 5 6 {}} do_test alter2-1.5 { execsql { CREATE INDEX abc_i ON abc(c); } } {} do_test alter2-1.6 { execsql { SELECT c FROM abc ORDER BY c; } } {{} {} 10} do_test alter2-1.7 { execsql { SELECT * FROM abc WHERE c = 10; } } {1 2 10} do_test alter2-1.8 { execsql { SELECT sum(a), c FROM abc GROUP BY c; } } {8.0 {} 1.0 10} do_test alter2-1.9 { # ALTER TABLE abc ADD COLUMN d; alter_table abc {CREATE TABLE abc(a, b, c, d);} execsql { SELECT * FROM abc; } execsql { UPDATE abc SET d = 11 WHERE c IS NULL AND a<4; SELECT * FROM abc; } } {1 2 10 {} 3 4 {} 11 5 6 {} {}} do_test alter2-1.10 { execsql { SELECT typeof(d) FROM abc; } } {null integer null} do_test alter2-1.99 { execsql { DROP TABLE abc; } } {} #----------------------------------------------------------------------- # Test that views work when the underlying table structure is changed. # ifcapable view { do_test alter2-2.1 { execsql { CREATE TABLE abc2(a, b, c); INSERT INTO abc2 VALUES(1, 2, 10); INSERT INTO abc2 VALUES(3, 4, NULL); INSERT INTO abc2 VALUES(5, 6, NULL); CREATE VIEW abc2_v AS SELECT * FROM abc2; SELECT * FROM abc2_v; } } {1 2 10 3 4 {} 5 6 {}} do_test alter2-2.2 { # ALTER TABLE abc ADD COLUMN d; alter_table abc2 {CREATE TABLE abc2(a, b, c, d);} execsql { SELECT * FROM abc2_v; } } {1 2 10 {} 3 4 {} {} 5 6 {} {}} do_test alter2-2.3 { execsql { DROP TABLE abc2; DROP VIEW abc2_v; } } {} } #----------------------------------------------------------------------- # Test that triggers work when a short row is copied to the old.* # trigger pseudo-table. # ifcapable trigger { do_test alter2-3.1 { execsql { CREATE TABLE abc3(a, b); CREATE TABLE blog(o, n); CREATE TRIGGER abc3_t AFTER UPDATE OF b ON abc3 BEGIN INSERT INTO blog VALUES(old.b, new.b); END; } } {} do_test alter2-3.2 { execsql { INSERT INTO abc3 VALUES(1, 4); UPDATE abc3 SET b = 2 WHERE b = 4; SELECT * FROM blog; } } {4 2} do_test alter2-3.3 { execsql { INSERT INTO abc3 VALUES(3, 4); INSERT INTO abc3 VALUES(5, 6); } alter_table abc3 {CREATE TABLE abc3(a, b, c);} execsql { SELECT * FROM abc3; } } {1 2 {} 3 4 {} 5 6 {}} do_test alter2-3.4 { execsql { UPDATE abc3 SET b = b*2 WHERE a<4; SELECT * FROM abc3; } } {1 4 {} 3 8 {} 5 6 {}} do_test alter2-3.5 { execsql { SELECT * FROM blog; } } {4 2 2 4 4 8} do_test alter2-3.6 { execsql { CREATE TABLE clog(o, n); CREATE TRIGGER abc3_t2 AFTER UPDATE OF c ON abc3 BEGIN INSERT INTO clog VALUES(old.c, new.c); END; UPDATE abc3 SET c = a*2; SELECT * FROM clog; } } {{} 2 {} 6 {} 10} } #--------------------------------------------------------------------- # Check that an error occurs if the database is upgraded to a file # format that SQLite does not support (in this case 3). Note: The # file format is checked each time the schema is read, so changing the # file format requires incrementing the schema cookie. # do_test alter2-4.1 { set_file_format 3 } {} do_test alter2-4.2 { catchsql { SELECT * FROM sqlite_master; } } {1 {unsupported file format}} do_test alter2-4.3 { sqlite3_errcode $::DB } {SQLITE_ERROR} do_test alter2-4.4 { db close set ::DB [sqlite3 db test.db] catchsql { SELECT * FROM sqlite_master; } } {1 {unsupported file format}} do_test alter2-4.5 { sqlite3_errcode $::DB } {SQLITE_ERROR} #--------------------------------------------------------------------- # Check that executing VACUUM on a file with file-format version 2 # resets the file format to 1. # do_test alter2-5.1 { set_file_format 2 get_file_format } {2} do_test alter2-5.2 { execsql { VACUUM; } } {} do_test alter2-5.3 { get_file_format } {1} #--------------------------------------------------------------------- # Test that when a database with file-format 2 is opened, new # databases are still created with file-format 1. # do_test alter2-6.1 { db close set_file_format 2 set ::DB [sqlite3 db test.db] get_file_format } {2} do_test alter2-6.2 { file delete -force test2.db-journal file delete -force test2.db execsql { ATTACH 'test2.db' AS aux; CREATE TABLE aux.t1(a, b); } get_file_format test2.db } {1} do_test alter2-6.3 { execsql { CREATE TABLE t1(a, b); } get_file_format } {2} finish_test |
Changes to test/capi3.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2003 January 29 # # 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 implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2003 January 29 # # 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 implements regression tests for SQLite library. The # focus of this script testing the callback-free C/C++ API. # # $Id: capi3.test,v 1.30 2005/02/19 08:18:06 danielk1977 Exp $ # set testdir [file dirname $argv0] source $testdir/tester.tcl # Return the UTF-16 representation of the supplied UTF-8 string $str. # If $nt is true, append two 0x00 bytes as a nul terminator. |
︙ | ︙ | |||
483 484 485 486 487 488 489 | if {![sqlite3 -has-codec]} { # Test what happens when the library encounters a newer file format. # Do this by updating the file format via the btree layer. do_test capi3-7.1 { set ::bt [btree_open test.db 10 0] btree_begin_transaction $::bt set meta [btree_get_meta $::bt] | | | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | if {![sqlite3 -has-codec]} { # Test what happens when the library encounters a newer file format. # Do this by updating the file format via the btree layer. do_test capi3-7.1 { set ::bt [btree_open test.db 10 0] btree_begin_transaction $::bt set meta [btree_get_meta $::bt] lset meta 2 3 eval [concat btree_update_meta $::bt [lrange $meta 0 end]] btree_commit $::bt btree_close $::bt } {} do_test capi3-7.2 { sqlite3 db test.db catchsql { |
︙ | ︙ |
Changes to test/corrupt.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # | | | | | | | | | | | | | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests to make sure SQLite does not crash or # segfault if it sees a corrupt database file. # # $Id: corrupt.test,v 1.8 2005/02/19 08:18:06 danielk1977 Exp $ catch {file delete -force test.db} catch {file delete -force test.db-journal} set testdir [file dirname $argv0] source $testdir/tester.tcl # Construct a large database for testing. # do_test corrupt-1.1 { execsql { BEGIN; CREATE TABLE t1(x); INSERT INTO t1 VALUES(randstr(100,100)); INSERT INTO t1 VALUES(randstr(90,90)); INSERT INTO t1 VALUES(randstr(80,80)); INSERT INTO t1 SELECT x || randstr(5,5) FROM t1; INSERT INTO t1 SELECT x || randstr(6,6) FROM t1; INSERT INTO t1 SELECT x || randstr(7,7) FROM t1; INSERT INTO t1 SELECT x || randstr(8,8) FROM t1; INSERT INTO t1 VALUES(randstr(3000,3000)); INSERT INTO t1 SELECT x || randstr(9,9) FROM t1; INSERT INTO t1 SELECT x || randstr(10,10) FROM t1; INSERT INTO t1 SELECT x || randstr(11,11) FROM t1; INSERT INTO t1 SELECT x || randstr(12,12) FROM t1; CREATE INDEX t1i1 ON t1(x); CREATE TABLE t2 AS SELECT * FROM t1; DELETE FROM t2 WHERE rowid%5!=0; COMMIT; } } {} integrity_check corrupt-1.2 |
︙ | ︙ |
Changes to test/intpkey.test.
︙ | ︙ | |||
9 10 11 12 13 14 15 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the special processing associated # with INTEGER PRIMARY KEY columns. # | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # #*********************************************************************** # This file implements regression tests for SQLite library. # # This file implements tests for the special processing associated # with INTEGER PRIMARY KEY columns. # # $Id: intpkey.test,v 1.21 2005/02/22 09:47:19 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table with a primary key and a datatype other than # integer # |
︙ | ︙ | |||
515 516 517 518 519 520 521 | } do_test intpkey-13.5 { catchsql { INSERT INTO t1 VALUES('+1234567890',3,4); } } {0 {}} | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 | } do_test intpkey-13.5 { catchsql { INSERT INTO t1 VALUES('+1234567890',3,4); } } {0 {}} # Compare an INTEGER PRIMARY KEY against a TEXT expression. The INTEGER # affinity should be applied to the text value before the comparison # takes place. # do_test intpkey-14.1 { execsql { CREATE TABLE t3(a INTEGER PRIMARY KEY, b INTEGER, c TEXT); INSERT INTO t3 VALUES(1, 1, 'one'); INSERT INTO t3 VALUES(2, 2, '2'); INSERT INTO t3 VALUES(3, 3, 3); } } {} do_test intpkey-14.2 { execsql { SELECT * FROM t3 WHERE a>2; } } {3 3 3} do_test intpkey-14.3 { execsql { SELECT * FROM t3 WHERE a>'2'; } } {3 3 3} do_test intpkey-14.4 { execsql { SELECT * FROM t3 WHERE a<'2'; } } {1 1 one} do_test intpkey-14.5 { execsql { SELECT * FROM t3 WHERE a<c; } } {1 1 one} do_test intpkey-14.6 { execsql { SELECT * FROM t3 WHERE a=c; } } {2 2 2 3 3 3} finish_test |
Changes to www/changes.tcl.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | } proc chng {date desc} { puts "<DT><B>$date</B></DT>" puts "<DD><P><UL>$desc</UL></P></DD>" } chng {2005 February 15 (3.1.2)} { <li>Fix a bug that can lead to database corruption if there are two open connections to the same database and one connection does a VACUUM and the second makes some change to the database.</li> <li>Allow "?" parameters in the LIMIT clause.</li> <li>Fix VACUUM so that it works with AUTOINCREMENT.</li> | > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | } proc chng {date desc} { puts "<DT><B>$date</B></DT>" puts "<DD><P><UL>$desc</UL></P></DD>" } chng {2005 February 19 (3.1.3)} { <li>Fix a problem with VACUUM on databases from which tables containing AUTOINCREMENT have been dropped.</li> <li>Add forward compatibility to the future version 3.2 database file format.</li> <li>Documentation updates</li> } chng {2005 February 15 (3.1.2)} { <li>Fix a bug that can lead to database corruption if there are two open connections to the same database and one connection does a VACUUM and the second makes some change to the database.</li> <li>Allow "?" parameters in the LIMIT clause.</li> <li>Fix VACUUM so that it works with AUTOINCREMENT.</li> |
︙ | ︙ |
Changes to www/index.tcl.
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | proc newsitem {date title text} { puts "<h3>$date - $title</h3>" regsub -all "\n( *\n)+" $text "</p>\n\n<p>" txt puts "<p>$txt</p>" puts "<hr width=\"50%\">" } newsitem {2005-Feb-15} {Versions 2.8.16 and 3.1.2 Released} { A critical bug in the VACUUM command that can lead to database corruption has been fixed in both the 2.x branch and the main 3.x line. This bug has existed in all prior versions of SQLite. Even though it is unlikely you will ever encounter this bug, it is suggested that all users upgrade. See | > > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | proc newsitem {date title text} { puts "<h3>$date - $title</h3>" regsub -all "\n( *\n)+" $text "</p>\n\n<p>" txt puts "<p>$txt</p>" puts "<hr width=\"50%\">" } newsitem {2005-Feb-19} {Version 3.1.3 Released} { Version 3.1.3 cleans up some minor issues discovered in version 3.1.2. } newsitem {2005-Feb-15} {Versions 2.8.16 and 3.1.2 Released} { A critical bug in the VACUUM command that can lead to database corruption has been fixed in both the 2.x branch and the main 3.x line. This bug has existed in all prior versions of SQLite. Even though it is unlikely you will ever encounter this bug, it is suggested that all users upgrade. See |
︙ | ︙ | |||
99 100 101 102 103 104 105 | } puts { <p align="right"><a href="oldnews.html">Old news...</a></p> </td></tr></table> } | | | 103 104 105 106 107 108 109 110 | } puts { <p align="right"><a href="oldnews.html">Old news...</a></p> </td></tr></table> } footer {$Id: index.tcl,v 1.108 2005/02/19 13:46:25 drh Exp $} |
Changes to www/lang.tcl.
1 2 3 | # # Run this Tcl script to generate the lang-*.html files. # | | | 1 2 3 4 5 6 7 8 9 10 11 | # # Run this Tcl script to generate the lang-*.html files. # set rcsid {$Id: lang.tcl,v 1.84 2005/02/19 12:44:16 drh Exp $} source common.tcl if {[llength $argv]>0} { set outputdir [lindex $argv 0] } else { set outputdir "" } |
︙ | ︙ | |||
899 900 901 902 903 904 905 | <function-name> ( <expr-list> | STAR ) | <expr> ISNULL | <expr> NOTNULL | <expr> [NOT] BETWEEN <expr> AND <expr> | <expr> [NOT] IN ( <value-list> ) | <expr> [NOT] IN ( <select-statement> ) | <expr> [NOT] IN [<database-name> .] <table-name> | | | | 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | <function-name> ( <expr-list> | STAR ) | <expr> ISNULL | <expr> NOTNULL | <expr> [NOT] BETWEEN <expr> AND <expr> | <expr> [NOT] IN ( <value-list> ) | <expr> [NOT] IN ( <select-statement> ) | <expr> [NOT] IN [<database-name> .] <table-name> | [EXISTS] ( <select-statement> ) | CASE [<expr>] LP WHEN <expr> THEN <expr> RPPLUS [ELSE <expr>] END } {like-op} { LIKE | NOT LIKE } {glob-op} { GLOB | NOT GLOB } |
︙ | ︙ | |||
1017 1018 1019 1020 1021 1022 1023 | statement does not define a real column with the same name. Row keys act like read-only columns. A row key can be used anywhere a regular column can be used, except that you cannot change the value of a row key in an UPDATE or INSERT statement. "SELECT * ..." does not return the row key.</p> <p>SELECT statements can appear in expressions as either the | | > > | > > > > | | | > | 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 | statement does not define a real column with the same name. Row keys act like read-only columns. A row key can be used anywhere a regular column can be used, except that you cannot change the value of a row key in an UPDATE or INSERT statement. "SELECT * ..." does not return the row key.</p> <p>SELECT statements can appear in expressions as either the right-hand operand of the IN operator, as a scalar quantity, or as the operand of an EXISTS operator. As a scalar quantity or the operand of an IN operator, the SELECT should have only a single column in its result. Compound SELECTs (connected with keywords like UNION or EXCEPT) are allowed. With the EXISTS operator, the columns in the result set of the SELECT are ignored and the expression returns TRUE if one or more rows exist and FALSE if the result set is empty. If no terms in the SELECT expression refer to value in the containing query, then the expression is evaluated once prior to any other processing and the result is reused as necessary. If the SELECT expression does contain variables from the outer query, then the SELECT is reevaluated every time it is needed.</p> <p>When a SELECT is the right operand of the IN operator, the IN operator returns TRUE if the result of the left operand is any of the values generated by the select. The IN operator may be preceded by the NOT keyword to invert the sense of the test.</p> <p>When a SELECT appears within an expression but is not the right |
︙ | ︙ |
Changes to www/pragma.tcl.
1 2 3 | # # Run this Tcl script to generate the pragma.html file. # | | | | 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 | # # Run this Tcl script to generate the pragma.html file. # set rcsid {$Id: pragma.tcl,v 1.11 2005/02/19 13:05:48 drh Exp $} source common.tcl header {Pragma statements supported by SQLite} proc Section {name {label {}}} { puts "\n<hr />" if {$label!=""} { puts "<a name=\"$label\"></a>" } puts "<h1>$name</h1>\n" } puts { <p>The <a href="#syntax">PRAGMA command</a> is a special command used to modify the operation of the SQLite library or to query the library for internal (non-table) data. The PRAGMA command is issued using the same interface as other SQLite commands (e.g. SELECT, INSERT) but is different in the following important respects: </p> <ul> <li>Specific pragma statements may be removed and others added in future releases of SQLite. Use with caution! <li>No error messages are generated if an unknown pragma is issued. Unknown pragmas are simply ignored. This means if there is a typo in |
︙ | ︙ | |||
171 172 173 174 175 176 177 | <a name="pragma_full_column_names"></a> <li><p><b>PRAGMA full_column_names; <br>PRAGMA full_column_names = </b><i>0 | 1</i><b>;</b></p> <p>Query or change the full-column-names flag. This flag affects the way SQLite names columns of data returned by SELECT statements when the expression for the column is a table-column name or the wildcard "*". Normally, such result columns are named | | > | | | | | | | | | | | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | <a name="pragma_full_column_names"></a> <li><p><b>PRAGMA full_column_names; <br>PRAGMA full_column_names = </b><i>0 | 1</i><b>;</b></p> <p>Query or change the full-column-names flag. This flag affects the way SQLite names columns of data returned by SELECT statements when the expression for the column is a table-column name or the wildcard "*". Normally, such result columns are named <table-name/alias><column-name> if the SELECT statement joins two or more tables together, or simply <column-name> if the SELECT statement queries a single table. When the full-column-names flag is set, such columns are always named <table-name/alias> <column-name> regardless of whether or not a join is performed. </p> <p>If both the short-column-names and full-column-names are set, then the behaviour associated with the full-column-names flag is exhibited. </p> </li> <a name="pragma_page_size"></a> <li><p><b>PRAGMA page_size; <br>PRAGMA page_size = </b><i>bytes</i><b>;</b></p> <p>Query or set the page-size of the database. The page-size may only be set if the database has not yet been created. The page size must be a power of two greater than or equal to 512 and less than or equal to 8192. The upper limit may be modified by setting the value of macro SQLITE_MAX_PAGE_SIZE during compilation. </p> </li> <a name="pragma_short_column_names"></a> <li><p><b>PRAGMA short_column_names; <br>PRAGMA short_column_names = </b><i>0 | 1</i><b>;</b></p> <p>Query or change the short-column-names flag. This flag affects the way SQLite names columns of data returned by SELECT statements when the expression for the column is a table-column name or the wildcard "*". Normally, such result columns are named <table-name/alias>lt;column-name> if the SELECT statement joins two or more tables together, or simply <column-name> if the SELECT statement queries a single table. When the short-column-names flag is set, such columns are always named <column-name> regardless of whether or not a join is performed. </p> <p>If both the short-column-names and full-column-names are set, then the behaviour associated with the full-column-names flag is exhibited. </p> </li> |
︙ | ︙ | |||
245 246 247 248 249 250 251 | to the disk surface. On the other hand, some operations are as much as 50 or more times faster with synchronous OFF. </p></li> <a name="pragma_temp_store"></a> <li><p><b>PRAGMA temp_store; | | < | < < < < < < < < < < < | < | | > | | | | > | | | > | > | | > > | > > | > > | > > | > > | > > | > > | > > | > > | > | | | > | | < < < < < < | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 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 | to the disk surface. On the other hand, some operations are as much as 50 or more times faster with synchronous OFF. </p></li> <a name="pragma_temp_store"></a> <li><p><b>PRAGMA temp_store; <br>PRAGMA temp_store = DEFAULT;</b> (0)<b> <br>PRAGMA temp_store = FILE;</b> (1)<b> <br>PRAGMA temp_store = MEMORY;</b> (2)</p> <p>Query or change the setting of the "<b>temp_store</b>" parameter. When temp_store is DEFAULT (0), the compile-time C preprocessor macro TEMP_STORE is used to determine where temporary tables and indices are stored. When temp_store is MEMORY (2) temporary tables and indices are kept in memory. When temp_store is FILE (1) temporary tables and indices are stored in a file. The <a href="#pragma_temp_store_directory"> temp_store_directory</a> pragma can be used to specify the directory containing this file. <b>FILE</b> is specified. When the temp_store setting is changed, all existing temporary tables, indices, triggers, and views are immediately deleted.</p> <p>It is possible for the library compile-time C preprocessor symbol TEMP_STORE to override this pragma setting. The following table summarizes the interaction of the TEMP_STORE preprocessor macro and the temp_store pragma:</p> <blockquote> <table cellpadding="2" border="1"> <tr><th valign="bottom">TEMP_STORE</th> <th valign="bottom">PRAGMA<br>temp_store</th> <th>Storage used for<br>TEMP tables and indices</th></tr> <tr><td align="center">0</td> <td align="center"><em>any</em></td> <td align="center">file</td></tr> <tr><td align="center">1</td> <td align="center">0</td> <td align="center">file</td></tr> <tr><td align="center">1</td> <td align="center">1</td> <td align="center">file</td></tr> <tr><td align="center">1</td> <td align="center">2</td> <td align="center">memory</td></tr> <tr><td align="center">2</td> <td align="center">0</td> <td align="center">memory</td></tr> <tr><td align="center">2</td> <td align="center">1</td> <td align="center">file</td></tr> <tr><td align="center">2</td> <td align="center">2</td> <td align="center">memory</td></tr> <tr><td align="center">3</td> <td align="center"><em>any</em></td> <td align="center">memory</td></tr> </table> </blockquote> </li> <br> <a name="pragma_temp_store_directory"></a> <li><p><b>PRAGMA temp_store_directory; <br>PRAGMA temp_store_directory = 'directory-name';</b></p> <p>Query or change the setting of the "temp_store_directory" - the directory where files used for storing temporary tables and indices are kept. This setting lasts for the duration of the current connection only and resets to its default value for each new connection opened. <p>When the temp_store_directory setting is changed, all existing temporary tables, indices, triggers, and viewers are immediately deleted. In practice, temp_store_directory should be set immediately after the database is opened. </p> <p>The value <i>directory-name</i> should be enclosed in single quotes. To revert the directory to the default, set the <i>directory-name</i> to an empty string, e.g., <i>PRAGMA temp_store_directory = ''</i>. An error is raised if <i>directory-name</i> is not found or is not writable. </p> <p>The default directory for temporary files depends on the OS. For Unix/Linux/OSX, the default is the is the first writable directory found in the list of: <b>/var/tmp, /usr/tmp, /tmp,</b> and <b> <i>current-directory</i></b>. For Windows NT, the default |
︙ | ︙ | |||
433 434 435 436 437 438 439 440 441 442 | <a name="pragma_vdbe_trace"></a> <li><p><b>PRAGMA vdbe_trace = ON; </b>(1)<b> <br>PRAGMA vdbe_trace = OFF;</b> (0)</p> <p>Turn tracing of the virtual database engine inside of the SQLite library on and off. This is used for debugging. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p></li> </ul> } | > > > > > > > > > > > > < | 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 | <a name="pragma_vdbe_trace"></a> <li><p><b>PRAGMA vdbe_trace = ON; </b>(1)<b> <br>PRAGMA vdbe_trace = OFF;</b> (0)</p> <p>Turn tracing of the virtual database engine inside of the SQLite library on and off. This is used for debugging. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p></li> <a name="pragma_vdbe_listing"></a> <li><p><b>PRAGMA vdbe_listing = ON; </b>(1)<b> <br>PRAGMA vdbe_listing = OFF;</b> (0)</p> <p>Turn listings of virtual machine programs on and off. With listing is on, the entire content of a program is printed just prior to beginning execution. This is like automatically executing an EXPLAIN prior to each statement. The statement executes normally after the listing is printed. This is used for debugging. See the <a href="vdbe.html#trace">VDBE documentation</a> for more information.</p></li> </ul> } |