mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-10 01:02:56 +03:00
Omit the '\0' at the end of UTF-8 strings on disk (it is implied). Also
don't store the number of rows at the beginning of each table record. (CVS 1390) FossilOrigin-Name: 202a470f2c1804a96e69f16709d1a92e405971f0
This commit is contained in:
26
manifest
26
manifest
@@ -1,5 +1,5 @@
|
|||||||
C More\schanges\sto\ssupport\sthe\snew\stypes\smodel.\sCompound\sSELECTs\sare\scurrently\nbroken.\s(CVS\s1389)
|
C Omit\sthe\s'\\0'\sat\sthe\send\sof\sUTF-8\sstrings\son\sdisk\s(it\sis\simplied).\sAlso\ndon't\sstore\sthe\snumber\sof\srows\sat\sthe\sbeginning\sof\seach\stable\srecord.\s(CVS\s1390)
|
||||||
D 2004-05-17T10:48:58
|
D 2004-05-18T01:23:38
|
||||||
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
F Makefile.in ab7b0d5118e2da97bac66be8684a1034e3500f5a
|
||||||
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
|
||||||
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
|
||||||
@@ -26,16 +26,16 @@ F src/auth.c 5c2f0bea4729c98c2be3b69d6b466fc51448fe79
|
|||||||
F src/btree.c bf8d9592b66fb9ba89a5be13fd99a7d8b8a67d7f
|
F src/btree.c bf8d9592b66fb9ba89a5be13fd99a7d8b8a67d7f
|
||||||
F src/btree.h 6f51ad0ffebfba71295fcacdbe86007512200050
|
F src/btree.h 6f51ad0ffebfba71295fcacdbe86007512200050
|
||||||
F src/btree_rb.c 9d7973e266ee6f9c61ce592f68742ce9cd5b10e5
|
F src/btree_rb.c 9d7973e266ee6f9c61ce592f68742ce9cd5b10e5
|
||||||
F src/build.c fd37eda7100d2507c647df43f9f3ce56a2f59ab4
|
F src/build.c ddb0384afd2c82599b7d2bdefc4878850854931c
|
||||||
F src/copy.c 4d2038602fd0549d80c59bda27d96f13ea9b5e29
|
F src/copy.c 4d2038602fd0549d80c59bda27d96f13ea9b5e29
|
||||||
F src/date.c 0eb0a89960bb45c7f7e768748605a7a97b0c8064
|
F src/date.c 0eb0a89960bb45c7f7e768748605a7a97b0c8064
|
||||||
F src/delete.c ea8212a44b5c0dad8fb1794fe7297654f7ed05f9
|
F src/delete.c 8cb317fbba81b428301bccf04be1bea22203508b
|
||||||
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
|
F src/encode.c a876af473d1d636faa3dca51c7571f2e007eea37
|
||||||
F src/expr.c d39afb30c76c2f67fb5ffdfe530ed709c5009786
|
F src/expr.c d39afb30c76c2f67fb5ffdfe530ed709c5009786
|
||||||
F src/func.c cfbb7096efb58e2857e3b312a8958a12774b625a
|
F src/func.c cfbb7096efb58e2857e3b312a8958a12774b625a
|
||||||
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
|
F src/hash.c 440c2f8cb373ee1b4e13a0988489c7cd95d55b6f
|
||||||
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
|
F src/hash.h 762d95f1e567664d1eafc1687de755626be962fb
|
||||||
F src/insert.c 656a648a7ab06a647a3bc5453d6a69f4fbd568e3
|
F src/insert.c 72d9dd0b2543420a905ada68f098bc6754b8a1ea
|
||||||
F src/main.c 4b82d7e78f4c9799343b02740a5ba9768d5e464d
|
F src/main.c 4b82d7e78f4c9799343b02740a5ba9768d5e464d
|
||||||
F src/md5.c 8e39fdae6d8776b87558e91dcc94740c9b635a9c
|
F src/md5.c 8e39fdae6d8776b87558e91dcc94740c9b635a9c
|
||||||
F src/os.c ddcda92f7fd71b4513c57c1ec797917f206d504e
|
F src/os.c ddcda92f7fd71b4513c57c1ec797917f206d504e
|
||||||
@@ -43,10 +43,10 @@ F src/os.h fbb2f6595fc34fa351830d88fe1c6b85118f0383
|
|||||||
F src/pager.c 6ff6b906427d4824099140776cb8768f922f3dc5
|
F src/pager.c 6ff6b906427d4824099140776cb8768f922f3dc5
|
||||||
F src/pager.h 78a00ac280899bcba1a89dc51585dcae6b7b3253
|
F src/pager.h 78a00ac280899bcba1a89dc51585dcae6b7b3253
|
||||||
F src/parse.y d0258aa3cc8b0c5742b07b699d10fa98f3caea7d
|
F src/parse.y d0258aa3cc8b0c5742b07b699d10fa98f3caea7d
|
||||||
F src/pragma.c 351836bce186f4eee45a32868b7a379c22ac344a
|
F src/pragma.c 2c65f46a520cd3bab49623d68bec0a5afaae5b52
|
||||||
F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
|
F src/printf.c ef750e8e2398ca7e8b58be991075f08c6a7f0e53
|
||||||
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
F src/random.c eff68e3f257e05e81eae6c4d50a51eb88beb4ff3
|
||||||
F src/select.c b62bb2507df4bfac45f808ac9de9a2af99b9ff28
|
F src/select.c 62431fb1a1021301e35f12f64c325d5f20371393
|
||||||
F src/shell.c 0c4662e13bfbfd3d13b066c5859cc97ad2f95d21
|
F src/shell.c 0c4662e13bfbfd3d13b066c5859cc97ad2f95d21
|
||||||
F src/sqlite.h.in 799c5e726296ec7bc20e6407cdf4df0e0bc00c0c
|
F src/sqlite.h.in 799c5e726296ec7bc20e6407cdf4df0e0bc00c0c
|
||||||
F src/sqliteInt.h ac5fe07df6cf0a4c935e5a88bc14bc620e4f1591
|
F src/sqliteInt.h ac5fe07df6cf0a4c935e5a88bc14bc620e4f1591
|
||||||
@@ -59,15 +59,15 @@ F src/test4.c b3fab9aea7a8940a8a7386ce1c7e2157b09bd296
|
|||||||
F src/test5.c eb39aac8fed61bd930b92613cd705c145244074a
|
F src/test5.c eb39aac8fed61bd930b92613cd705c145244074a
|
||||||
F src/tokenize.c e7536dd31205d5afb76c1bdc832dea009c7a3847
|
F src/tokenize.c e7536dd31205d5afb76c1bdc832dea009c7a3847
|
||||||
F src/trigger.c 8df308e09113410bb895e88a2db65b55490268db
|
F src/trigger.c 8df308e09113410bb895e88a2db65b55490268db
|
||||||
F src/update.c 04492438aee57a6be5a8a8e54e3add12c1d598ca
|
F src/update.c d14a0b0f3b35ea2469dda375e59a1064f02c7c0e
|
||||||
F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f
|
F src/utf.c fc799748d43fe1982d157b871e3e420a19c85d4f
|
||||||
F src/util.c f9511ffba78e6cf71a28774c2820d7750b5bacdf
|
F src/util.c f9511ffba78e6cf71a28774c2820d7750b5bacdf
|
||||||
F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476
|
F src/vacuum.c c134702e023db8778e6be59ac0ea7b02315b5476
|
||||||
F src/vdbe.c e8fd1b095f83336519b862b9e79765e3e4493d80
|
F src/vdbe.c 8a6b971c130227fc90a6e899afe218277aa29fdd
|
||||||
F src/vdbe.h 94457ca73bae972dc61bca33a4dccc2e6e14e2f8
|
F src/vdbe.h 94457ca73bae972dc61bca33a4dccc2e6e14e2f8
|
||||||
F src/vdbeInt.h 311c2a046ea419781d0ef331198b7b0a65eebc92
|
F src/vdbeInt.h 311c2a046ea419781d0ef331198b7b0a65eebc92
|
||||||
F src/vdbeaux.c 394bde6b1715e28b869d55e5cd90682d87f527e4
|
F src/vdbeaux.c 394bde6b1715e28b869d55e5cd90682d87f527e4
|
||||||
F src/where.c 76a820b814d7ae0bd6b4110aafafce29fd534dfc
|
F src/where.c 5f480219a943b0fed1f6922d2fdbfba8616a9148
|
||||||
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
F test/all.test 569a92a8ee88f5300c057cc4a8f50fbbc69a3242
|
||||||
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
|
F test/attach.test cb9b884344e6cfa5e165965d5b1adea679a24c83
|
||||||
F test/attach2.test 7c388dee63a4c1997695c3d41957f32ce784ac56
|
F test/attach2.test 7c388dee63a4c1997695c3d41957f32ce784ac56
|
||||||
@@ -192,7 +192,7 @@ F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
|
|||||||
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
|
||||||
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
|
||||||
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
F www/whentouse.tcl a8335bce47cc2fddb07f19052cb0cb4d9129a8e4
|
||||||
P 9321e7426337e04064b5791c48dd5fc3c1eecaa2
|
P 0f6c9b05e688e281fa168aacdd867db408df2863
|
||||||
R 9e09205970304eba71ff10d90be26268
|
R 9aea282a59c85bfd7c0b6fa8bda19f62
|
||||||
U danielk1977
|
U danielk1977
|
||||||
Z 80bb342777e861c5628fead0ab144825
|
Z 2f567abfa9bbe1670a49c48e7ddc69a6
|
||||||
|
@@ -1 +1 @@
|
|||||||
0f6c9b05e688e281fa168aacdd867db408df2863
|
202a470f2c1804a96e69f16709d1a92e405971f0
|
@@ -23,7 +23,7 @@
|
|||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
** PRAGMA
|
** PRAGMA
|
||||||
**
|
**
|
||||||
** $Id: build.c,v 1.185 2004/05/16 11:57:28 danielk1977 Exp $
|
** $Id: build.c,v 1.186 2004/05/18 01:23:38 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -407,6 +407,7 @@ char *sqlite3TableNameFromToken(Token *pName){
|
|||||||
void sqlite3OpenMasterTable(Vdbe *v, int isTemp){
|
void sqlite3OpenMasterTable(Vdbe *v, int isTemp){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, isTemp, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, isTemp, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_OpenWrite, 0, MASTER_ROOT);
|
sqlite3VdbeAddOp(v, OP_OpenWrite, 0, MASTER_ROOT);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, 0, 5); /* sqlite_master has 5 columns */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1724,6 +1725,7 @@ void sqlite3CreateIndex(
|
|||||||
if( pTable ){
|
if( pTable ){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeOp3(v, OP_OpenRead, 2, pTab->tnum, pTab->zName, 0);
|
sqlite3VdbeOp3(v, OP_OpenRead, 2, pTab->tnum, pTab->zName, 0);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, 2, pTab->nCol);
|
||||||
lbl2 = sqlite3VdbeMakeLabel(v);
|
lbl2 = sqlite3VdbeMakeLabel(v);
|
||||||
sqlite3VdbeAddOp(v, OP_Rewind, 2, lbl2);
|
sqlite3VdbeAddOp(v, OP_Rewind, 2, lbl2);
|
||||||
lbl1 = sqlite3VdbeAddOp(v, OP_Recno, 2, 0);
|
lbl1 = sqlite3VdbeAddOp(v, OP_Recno, 2, 0);
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle DELETE FROM statements.
|
** to handle DELETE FROM statements.
|
||||||
**
|
**
|
||||||
** $Id: delete.c,v 1.65 2004/05/16 11:15:37 danielk1977 Exp $
|
** $Id: delete.c,v 1.66 2004/05/18 01:23:38 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -173,6 +173,7 @@ void sqlite3DeleteFrom(
|
|||||||
if( !isView ){
|
if( !isView ){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
|
sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, pTab->nCol);
|
||||||
}
|
}
|
||||||
sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);
|
sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);
|
||||||
addr = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
|
addr = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
|
||||||
@@ -230,6 +231,7 @@ void sqlite3DeleteFrom(
|
|||||||
if( !isView ){
|
if( !isView ){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
|
sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, pTab->nCol);
|
||||||
}
|
}
|
||||||
sqlite3VdbeAddOp(v, OP_MoveTo, iCur, 0);
|
sqlite3VdbeAddOp(v, OP_MoveTo, iCur, 0);
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle INSERT statements in SQLite.
|
** to handle INSERT statements in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: insert.c,v 1.100 2004/05/17 10:48:58 danielk1977 Exp $
|
** $Id: insert.c,v 1.101 2004/05/18 01:23:38 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -307,6 +307,7 @@ void sqlite3Insert(
|
|||||||
*/
|
*/
|
||||||
sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v));
|
sqlite3VdbeChangeP2(v, iInitCode, sqlite3VdbeCurrentAddr(v));
|
||||||
sqlite3VdbeAddOp(v, OP_OpenTemp, srcTab, 0);
|
sqlite3VdbeAddOp(v, OP_OpenTemp, srcTab, 0);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, srcTab, pTab->nCol);
|
||||||
sqlite3VdbeAddOp(v, OP_Goto, 0, iSelectLoop);
|
sqlite3VdbeAddOp(v, OP_Goto, 0, iSelectLoop);
|
||||||
sqlite3VdbeResolveLabel(v, iCleanup);
|
sqlite3VdbeResolveLabel(v, iCleanup);
|
||||||
}else{
|
}else{
|
||||||
@@ -1001,6 +1002,7 @@ int sqlite3OpenTableAndIndices(Parse *pParse, Table *pTab, int base){
|
|||||||
assert( v!=0 );
|
assert( v!=0 );
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeOp3(v, OP_OpenWrite, base, pTab->tnum, pTab->zName, P3_STATIC);
|
sqlite3VdbeOp3(v, OP_OpenWrite, base, pTab->tnum, pTab->zName, P3_STATIC);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, base, pTab->nCol);
|
||||||
for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
|
for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
|
||||||
sqlite3VdbeOp3(v, OP_OpenWrite, i+base, pIdx->tnum, pIdx->zName, P3_STATIC);
|
sqlite3VdbeOp3(v, OP_OpenWrite, i+base, pIdx->tnum, pIdx->zName, P3_STATIC);
|
||||||
|
17
src/pragma.c
17
src/pragma.c
@@ -11,7 +11,7 @@
|
|||||||
*************************************************************************
|
*************************************************************************
|
||||||
** This file contains code used to implement the PRAGMA command.
|
** This file contains code used to implement the PRAGMA command.
|
||||||
**
|
**
|
||||||
** $Id: pragma.c,v 1.23 2004/05/16 11:15:38 danielk1977 Exp $
|
** $Id: pragma.c,v 1.24 2004/05/18 01:23:38 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -580,17 +580,19 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
{ OP_SetInsert, 0, 0, "1"},
|
{ OP_SetInsert, 0, 0, "1"},
|
||||||
{ OP_Integer, 0, 0, 0}, /* 1 */
|
{ OP_Integer, 0, 0, 0}, /* 1 */
|
||||||
{ OP_OpenRead, 0, MASTER_ROOT, 0},
|
{ OP_OpenRead, 0, MASTER_ROOT, 0},
|
||||||
{ OP_Rewind, 0, 7, 0}, /* 3 */
|
{ OP_SetNumColumns,0,5, 0}, /* sqlite_master has 5 cols */
|
||||||
{ OP_Column, 0, 3, 0}, /* 4 */
|
|
||||||
|
{ OP_Rewind, 0, 8, 0}, /* 4 */
|
||||||
|
{ OP_Column, 0, 3, 0}, /* 5 */
|
||||||
{ OP_SetInsert, 0, 0, 0},
|
{ OP_SetInsert, 0, 0, 0},
|
||||||
{ OP_Next, 0, 4, 0}, /* 6 */
|
{ OP_Next, 0, 5, 0}, /* 7 */
|
||||||
{ OP_IntegrityCk, 0, 0, 0}, /* 7 */
|
{ OP_IntegrityCk, 0, 0, 0}, /* 8 */
|
||||||
{ OP_Dup, 0, 1, 0},
|
{ OP_Dup, 0, 1, 0},
|
||||||
{ OP_String, 0, 0, "ok"},
|
{ OP_String, 0, 0, "ok"},
|
||||||
{ OP_StrEq, 0, 12, 0}, /* 10 */
|
{ OP_StrEq, 0, 13, 0}, /* 11 */
|
||||||
{ OP_MemIncr, 0, 0, 0},
|
{ OP_MemIncr, 0, 0, 0},
|
||||||
{ OP_String, 0, 0, "*** in database "},
|
{ OP_String, 0, 0, "*** in database "},
|
||||||
{ OP_String, 0, 0, 0}, /* 13 */
|
{ OP_String, 0, 0, 0}, /* 14 */
|
||||||
{ OP_String, 0, 0, " ***\n"},
|
{ OP_String, 0, 0, " ***\n"},
|
||||||
{ OP_Pull, 3, 0, 0},
|
{ OP_Pull, 3, 0, 0},
|
||||||
{ OP_Concat, 4, 1, 0},
|
{ OP_Concat, 4, 1, 0},
|
||||||
@@ -637,6 +639,7 @@ void sqlite3Pragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
if( pTab->pIndex==0 ) continue;
|
if( pTab->pIndex==0 ) continue;
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, i, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, i, 0);
|
||||||
sqlite3VdbeOp3(v, OP_OpenRead, 1, pTab->tnum, pTab->zName, 0);
|
sqlite3VdbeOp3(v, OP_OpenRead, 1, pTab->tnum, pTab->zName, 0);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, 1, pTab->nCol);
|
||||||
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
|
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
|
||||||
if( pIdx->tnum==0 ) continue;
|
if( pIdx->tnum==0 ) continue;
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pIdx->iDb, 0);
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle SELECT statements in SQLite.
|
** to handle SELECT statements in SQLite.
|
||||||
**
|
**
|
||||||
** $Id: select.c,v 1.165 2004/05/17 10:48:58 danielk1977 Exp $
|
** $Id: select.c,v 1.166 2004/05/18 01:23:38 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -1313,7 +1313,9 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
|
|||||||
/* Create the destination temporary table if necessary
|
/* Create the destination temporary table if necessary
|
||||||
*/
|
*/
|
||||||
if( eDest==SRT_TempTable ){
|
if( eDest==SRT_TempTable ){
|
||||||
|
assert( p->pEList );
|
||||||
sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
|
sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, p->pEList->nExpr);
|
||||||
eDest = SRT_Table;
|
eDest = SRT_Table;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1904,6 +1906,7 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
|
|||||||
*/
|
*/
|
||||||
if( eDest==SRT_TempTable ){
|
if( eDest==SRT_TempTable ){
|
||||||
sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
|
sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generating code to find the min or the max. Basically all we have
|
/* Generating code to find the min or the max. Basically all we have
|
||||||
@@ -1917,6 +1920,7 @@ static int simpleMinMaxQuery(Parse *pParse, Select *p, int eDest, int iParm){
|
|||||||
if( pSrc->a[0].pSelect==0 ){
|
if( pSrc->a[0].pSelect==0 ){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeOp3(v, OP_OpenRead, base, pTab->tnum, pTab->zName, 0);
|
sqlite3VdbeOp3(v, OP_OpenRead, base, pTab->tnum, pTab->zName, 0);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, base, pTab->nCol);
|
||||||
}
|
}
|
||||||
cont = sqlite3VdbeMakeLabel(v);
|
cont = sqlite3VdbeMakeLabel(v);
|
||||||
if( pIdx==0 ){
|
if( pIdx==0 ){
|
||||||
@@ -2244,6 +2248,7 @@ int sqlite3Select(
|
|||||||
*/
|
*/
|
||||||
if( eDest==SRT_TempTable ){
|
if( eDest==SRT_TempTable ){
|
||||||
sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
|
sqlite3VdbeAddOp(v, OP_OpenTemp, iParm, 0);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, iParm, pEList->nExpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do an analysis of aggregate expressions.
|
/* Do an analysis of aggregate expressions.
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This file contains C code routines that are called by the parser
|
** This file contains C code routines that are called by the parser
|
||||||
** to handle UPDATE statements.
|
** to handle UPDATE statements.
|
||||||
**
|
**
|
||||||
** $Id: update.c,v 1.74 2004/05/16 11:15:39 danielk1977 Exp $
|
** $Id: update.c,v 1.75 2004/05/18 01:23:38 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -258,6 +258,7 @@ void sqlite3Update(
|
|||||||
if( !isView ){
|
if( !isView ){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
|
sqlite3VdbeAddOp(v, OP_OpenRead, iCur, pTab->tnum);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, pTab->nCol);
|
||||||
}
|
}
|
||||||
sqlite3VdbeAddOp(v, OP_MoveTo, iCur, 0);
|
sqlite3VdbeAddOp(v, OP_MoveTo, iCur, 0);
|
||||||
|
|
||||||
@@ -313,6 +314,7 @@ void sqlite3Update(
|
|||||||
*/
|
*/
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeAddOp(v, OP_OpenWrite, iCur, pTab->tnum);
|
sqlite3VdbeAddOp(v, OP_OpenWrite, iCur, pTab->tnum);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, iCur, pTab->nCol);
|
||||||
if( onError==OE_Replace ){
|
if( onError==OE_Replace ){
|
||||||
openAll = 1;
|
openAll = 1;
|
||||||
}else{
|
}else{
|
||||||
|
56
src/vdbe.c
56
src/vdbe.c
@@ -43,7 +43,7 @@
|
|||||||
** in this file for details. If in doubt, do not deviate from existing
|
** in this file for details. If in doubt, do not deviate from existing
|
||||||
** commenting and indentation practices when changing or adding code.
|
** commenting and indentation practices when changing or adding code.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.c,v 1.296 2004/05/17 10:48:58 danielk1977 Exp $
|
** $Id: vdbe.c,v 1.297 2004/05/18 01:23:38 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@@ -1992,6 +1992,19 @@ case OP_Class: {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Opcode: SetNumColumns P1 P2 *
|
||||||
|
**
|
||||||
|
** Before the OP_Column opcode can be executed on a cursor, this
|
||||||
|
** opcode must be called to set the number of fields in the table.
|
||||||
|
**
|
||||||
|
** This opcode sets the number of columns for cursor P1 to P2.
|
||||||
|
*/
|
||||||
|
case OP_SetNumColumns: {
|
||||||
|
assert( (pOp->p1)<p->nCursor );
|
||||||
|
p->apCsr[pOp->p1]->nField = pOp->p2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Opcode: Column P1 P2 *
|
/* Opcode: Column P1 P2 *
|
||||||
**
|
**
|
||||||
** Interpret the data that cursor P1 points to as a structure built using
|
** Interpret the data that cursor P1 points to as a structure built using
|
||||||
@@ -2012,7 +2025,7 @@ case OP_Column: {
|
|||||||
int payloadSize; /* Number of bytes in the record */
|
int payloadSize; /* Number of bytes in the record */
|
||||||
int i = pOp->p1;
|
int i = pOp->p1;
|
||||||
int p2 = pOp->p2; /* column number to retrieve */
|
int p2 = pOp->p2; /* column number to retrieve */
|
||||||
Cursor *pC;
|
Cursor *pC = 0;
|
||||||
char *zRec; /* Pointer to record-data from stack or pseudo-table. */
|
char *zRec; /* Pointer to record-data from stack or pseudo-table. */
|
||||||
BtCursor *pCrsr;
|
BtCursor *pCrsr;
|
||||||
|
|
||||||
@@ -2022,7 +2035,7 @@ case OP_Column: {
|
|||||||
u64 nField; /* number of fields in the record */
|
u64 nField; /* number of fields in the record */
|
||||||
|
|
||||||
int len; /* The length of the serialized data for the column */
|
int len; /* The length of the serialized data for the column */
|
||||||
int offset;
|
int offset = 0;
|
||||||
int nn;
|
int nn;
|
||||||
|
|
||||||
assert( i<p->nCursor );
|
assert( i<p->nCursor );
|
||||||
@@ -2038,6 +2051,7 @@ case OP_Column: {
|
|||||||
zRec = pTos[i].z;
|
zRec = pTos[i].z;
|
||||||
payloadSize = pTos[i].n;
|
payloadSize = pTos[i].n;
|
||||||
pC->cacheValid = 0;
|
pC->cacheValid = 0;
|
||||||
|
assert(!"broken for now");
|
||||||
}else if( (pC = p->apCsr[i])->pCursor!=0 ){
|
}else if( (pC = p->apCsr[i])->pCursor!=0 ){
|
||||||
sqlite3VdbeCursorMoveto(pC);
|
sqlite3VdbeCursorMoveto(pC);
|
||||||
zRec = 0;
|
zRec = 0;
|
||||||
@@ -2068,11 +2082,20 @@ case OP_Column: {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the row data is coming from a cursor, then OP_SetNumColumns must of
|
||||||
|
** been executed on that cursor. Also, p2 (the column to read) must be
|
||||||
|
** less than nField.
|
||||||
|
*/
|
||||||
|
assert( !pC || pC->nField>0 );
|
||||||
|
assert( p2<pC->nField );
|
||||||
|
nField = pC->nField;
|
||||||
|
|
||||||
/* Read and parse the table header. Store the results of the parse
|
/* Read and parse the table header. Store the results of the parse
|
||||||
** into the record header cache fields of the cursor.
|
** into the record header cache fields of the cursor.
|
||||||
*/
|
*/
|
||||||
if( !pC->cacheValid ){
|
if( !pC->cacheValid ){
|
||||||
pC->payloadSize = payloadSize;
|
pC->payloadSize = payloadSize;
|
||||||
|
#if 0
|
||||||
if( zRec ){
|
if( zRec ){
|
||||||
zData = zRec;
|
zData = zRec;
|
||||||
}else{
|
}else{
|
||||||
@@ -2088,15 +2111,19 @@ case OP_Column: {
|
|||||||
}
|
}
|
||||||
assert( zData );
|
assert( zData );
|
||||||
}
|
}
|
||||||
offset = sqlite3GetVarint(zData, &nField);
|
{
|
||||||
if( nField>pC->nField ){
|
u64 x;
|
||||||
sqliteFree(pC->aType);
|
offset = sqlite3GetVarint(zData, &x);
|
||||||
|
assert( x==nField );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( !pC->aType ){
|
||||||
pC->aType = sqliteMallocRaw( nField*sizeof(pC->aType[0]) );
|
pC->aType = sqliteMallocRaw( nField*sizeof(pC->aType[0]) );
|
||||||
if( pC->aType==0 ){
|
if( pC->aType==0 ){
|
||||||
goto no_mem;
|
goto no_mem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pC->nField = nField;
|
|
||||||
|
|
||||||
if( !zRec ){
|
if( !zRec ){
|
||||||
/* If the record is stored in a table, see if enough of it is on
|
/* If the record is stored in a table, see if enough of it is on
|
||||||
@@ -2257,7 +2284,7 @@ case OP_MakeRecord: {
|
|||||||
unsigned char *zCsr;
|
unsigned char *zCsr;
|
||||||
char *zAffinity;
|
char *zAffinity;
|
||||||
Mem *pRec;
|
Mem *pRec;
|
||||||
int nBytes; /* Space required for this record */
|
int nBytes = 0; /* Space required for this record */
|
||||||
|
|
||||||
Mem *pData0 = &pTos[1-nField];
|
Mem *pData0 = &pTos[1-nField];
|
||||||
assert( pData0>=p->aStack );
|
assert( pData0>=p->aStack );
|
||||||
@@ -2266,7 +2293,7 @@ case OP_MakeRecord: {
|
|||||||
/* Loop through the elements that will make up the record to figure
|
/* Loop through the elements that will make up the record to figure
|
||||||
** out how much space is required for the new record.
|
** out how much space is required for the new record.
|
||||||
*/
|
*/
|
||||||
nBytes = sqlite3VarintLen(nField);
|
// nBytes = sqlite3VarintLen(nField);
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
u64 serial_type;
|
u64 serial_type;
|
||||||
if( zAffinity ){
|
if( zAffinity ){
|
||||||
@@ -2285,13 +2312,12 @@ case OP_MakeRecord: {
|
|||||||
/* Allocate space for the new record. */
|
/* Allocate space for the new record. */
|
||||||
zNewRecord = sqliteMallocRaw(nBytes);
|
zNewRecord = sqliteMallocRaw(nBytes);
|
||||||
if( !zNewRecord ){
|
if( !zNewRecord ){
|
||||||
rc = SQLITE_NOMEM;
|
goto no_mem;
|
||||||
goto abort_due_to_error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the record */
|
/* Write the record */
|
||||||
zCsr = zNewRecord;
|
zCsr = zNewRecord;
|
||||||
zCsr += sqlite3PutVarint(zCsr, nField); /* number of fields */
|
// zCsr += sqlite3PutVarint(zCsr, nField); /* number of fields */
|
||||||
for(pRec=pData0; pRec<=pTos; pRec++){
|
for(pRec=pData0; pRec<=pTos; pRec++){
|
||||||
u64 serial_type = sqlite3VdbeSerialType(pRec);
|
u64 serial_type = sqlite3VdbeSerialType(pRec);
|
||||||
zCsr += sqlite3PutVarint(zCsr, serial_type); /* serial type */
|
zCsr += sqlite3PutVarint(zCsr, serial_type); /* serial type */
|
||||||
@@ -2421,8 +2447,7 @@ case OP_MakeIdxKey: {
|
|||||||
/* Allocate space for the new key */
|
/* Allocate space for the new key */
|
||||||
zKey = (char *)sqliteMallocRaw(nByte);
|
zKey = (char *)sqliteMallocRaw(nByte);
|
||||||
if( !zKey ){
|
if( !zKey ){
|
||||||
rc = SQLITE_NOMEM;
|
goto no_mem;
|
||||||
goto abort_due_to_error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the key in the buffer pointed to by zKey. */
|
/* Build the key in the buffer pointed to by zKey. */
|
||||||
@@ -3564,8 +3589,7 @@ case OP_IdxColumn: {
|
|||||||
if( !zData ){
|
if( !zData ){
|
||||||
zData = (char *)sqliteMalloc(n);
|
zData = (char *)sqliteMalloc(n);
|
||||||
if( !zData ){
|
if( !zData ){
|
||||||
rc = SQLITE_NOMEM;
|
goto no_mem;
|
||||||
goto abort_due_to_error;
|
|
||||||
}
|
}
|
||||||
rc = sqlite3BtreeKey(pCsr, len, n, zData);
|
rc = sqlite3BtreeKey(pCsr, len, n, zData);
|
||||||
if( rc!=SQLITE_OK ){
|
if( rc!=SQLITE_OK ){
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
** This module contains C code that generates VDBE code used to process
|
** This module contains C code that generates VDBE code used to process
|
||||||
** the WHERE clause of SQL statements.
|
** the WHERE clause of SQL statements.
|
||||||
**
|
**
|
||||||
** $Id: where.c,v 1.95 2004/05/17 10:48:58 danielk1977 Exp $
|
** $Id: where.c,v 1.96 2004/05/18 01:23:39 danielk1977 Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -680,6 +680,7 @@ WhereInfo *sqlite3WhereBegin(
|
|||||||
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pTab->iDb, 0);
|
||||||
sqlite3VdbeOp3(v, OP_OpenRead, pTabList->a[i].iCursor, pTab->tnum,
|
sqlite3VdbeOp3(v, OP_OpenRead, pTabList->a[i].iCursor, pTab->tnum,
|
||||||
pTab->zName, P3_STATIC);
|
pTab->zName, P3_STATIC);
|
||||||
|
sqlite3VdbeAddOp(v, OP_SetNumColumns, pTabList->a[i].iCursor, pTab->nCol);
|
||||||
sqlite3CodeVerifySchema(pParse, pTab->iDb);
|
sqlite3CodeVerifySchema(pParse, pTab->iDb);
|
||||||
if( (pIx = pWInfo->a[i].pIdx)!=0 ){
|
if( (pIx = pWInfo->a[i].pIdx)!=0 ){
|
||||||
sqlite3VdbeAddOp(v, OP_Integer, pIx->iDb, 0);
|
sqlite3VdbeAddOp(v, OP_Integer, pIx->iDb, 0);
|
||||||
|
Reference in New Issue
Block a user