mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-07 02:42:48 +03:00
Remove all tabs from the beginning of source code lines. Replace tabs with
the appropriate number of spaces. (CVS 565) FossilOrigin-Name: 690f9a163173c4c7af7e8e92e942cee4184c7974
This commit is contained in:
32
manifest
32
manifest
@@ -1,5 +1,5 @@
|
|||||||
C In\sthe\s"lang.html"\sdocumentation\sfile,\sput\sthe\sCREATE\sTRIGGER\sand\sDROP\sTRIGGER\nsections\sin\salphabetical\sorder.\s(CVS\s564)
|
C Remove\sall\stabs\sfrom\sthe\sbeginning\sof\ssource\scode\slines.\s\sReplace\stabs\swith\nthe\sappropriate\snumber\sof\sspaces.\s(CVS\s565)
|
||||||
D 2002-05-15T11:43:16
|
D 2002-05-15T11:44:14
|
||||||
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
|
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
|
||||||
F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
|
F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
|
||||||
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
|
||||||
@@ -18,24 +18,24 @@ F publish.sh d115bd49631e3bb0d799e7dc1da51f9866d67647
|
|||||||
F spec.template 238f7db425a78dc1bb7682e56e3834c7270a3f5e
|
F spec.template 238f7db425a78dc1bb7682e56e3834c7270a3f5e
|
||||||
F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
|
F sqlite.1 83f4a9d37bdf2b7ef079a82d54eaf2e3509ee6ea
|
||||||
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
|
F src/TODO af7f3cab0228e34149cf98e073aa83d45878e7e6
|
||||||
F src/btree.c 7dd7ddc66459982dd0cb9800958c1f8d65a32d9f
|
F src/btree.c c01b404b9373ae1c0daf7d1f9211c72ead67638e
|
||||||
F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
|
F src/btree.h 8abeabfe6e0b1a990b64fa457592a6482f6674f3
|
||||||
F src/build.c cbf1b552d381c3f94baad9be2defbc60a158ac64
|
F src/build.c 74f19f9001ee3708b451faf8fc8a6b36024a9be7
|
||||||
F src/delete.c 392159781f9dff5f07ce2cb7d3a3a184eb38c0ab
|
F src/delete.c 48e4c533b39d6edfcfca23fb500129b80b7cad30
|
||||||
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
|
F src/encode.c 346b12b46148506c32038524b95c4631ab46d760
|
||||||
F src/expr.c 6888e37e4eecdc20567aedd442328df752465723
|
F src/expr.c 6888e37e4eecdc20567aedd442328df752465723
|
||||||
F src/func.c a31dcba85bc2ecb9b752980289cf7e6cd0cafbce
|
F src/func.c a31dcba85bc2ecb9b752980289cf7e6cd0cafbce
|
||||||
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
|
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
|
||||||
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
|
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
|
||||||
F src/insert.c 9f89b395e25f2a9eaea841fa736a4036d33d2b24
|
F src/insert.c 26ca700fb4055c34970ebac1d9a9a067bebef3b0
|
||||||
F src/main.c 6bc0b3dd014f6af13007472581593e87b2797139
|
F src/main.c 9e9ba7d8491928c46c6a70d9b7c30bbf7e60d499
|
||||||
F src/md5.c b2b1a34fce66ceca97f4e0dabc20be8be7933c92
|
F src/md5.c 0ae1f3e2cac92d06fc6246d1b4b8f61a2fe66d3b
|
||||||
F src/os.c 5ab8b6b4590d0c1ab8e96c67996c170e4462e0fc
|
F src/os.c 5ab8b6b4590d0c1ab8e96c67996c170e4462e0fc
|
||||||
F src/os.h 4a361fccfbc4e7609b3e1557f604f94c1e96ad10
|
F src/os.h 4a361fccfbc4e7609b3e1557f604f94c1e96ad10
|
||||||
F src/pager.c ba5740104cc27b342cd43eebfdc44d60f64a3ded
|
F src/pager.c ba5740104cc27b342cd43eebfdc44d60f64a3ded
|
||||||
F src/pager.h 6fddfddd3b73aa8abc081b973886320e3c614f0e
|
F src/pager.h 6fddfddd3b73aa8abc081b973886320e3c614f0e
|
||||||
F src/parse.y 164789531d0c6a2c28fb4baded14afc1be4bd4aa
|
F src/parse.y 164789531d0c6a2c28fb4baded14afc1be4bd4aa
|
||||||
F src/printf.c 300a90554345751f26e1fc0c0333b90a66110a1d
|
F src/printf.c d8032ee18b860c812eeff596c9bebfdacb7930fd
|
||||||
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
|
||||||
F src/select.c 1b623a7d826ec7c245bc542b665d61724da2a62d
|
F src/select.c 1b623a7d826ec7c245bc542b665d61724da2a62d
|
||||||
F src/shell.c 5acbe59e137d60d8efd975c683dbea74ab626530
|
F src/shell.c 5acbe59e137d60d8efd975c683dbea74ab626530
|
||||||
@@ -49,12 +49,12 @@ F src/test2.c 669cc22781c6461a273416ec1a7414d25c081730
|
|||||||
F src/test3.c 4e52fff8b01f08bd202f7633feda5639b7ba2b5e
|
F src/test3.c 4e52fff8b01f08bd202f7633feda5639b7ba2b5e
|
||||||
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
|
F src/threadtest.c 81f0598e0f031c1bd506af337fdc1b7e8dff263f
|
||||||
F src/tokenize.c f12f78c58b2a79ea4eee880efad63a328e103c62
|
F src/tokenize.c f12f78c58b2a79ea4eee880efad63a328e103c62
|
||||||
F src/trigger.c b8df3e8f0952979bbbcbd0cb05b7d564924a3282
|
F src/trigger.c 768b895cf09382db4e2d1ce5aace7e6a4cbf7e4d
|
||||||
F src/update.c 2e8becd1cd3a597f74f8879e2c246cca5d20a119
|
F src/update.c f9b53d46cc651b9630fc53342b9e792031f6fc5c
|
||||||
F src/util.c 707c30f8c13cddace7c08556ac450c0b786660b3
|
F src/util.c 707c30f8c13cddace7c08556ac450c0b786660b3
|
||||||
F src/vdbe.c 428d7dba1fb84a3da6170c3cb387d177c315a72a
|
F src/vdbe.c 42281b4e0e0c4a089018a14d6840ada5a1896e51
|
||||||
F src/vdbe.h 126a651ba26f05de075dcc6da5466244a31af6b8
|
F src/vdbe.h 126a651ba26f05de075dcc6da5466244a31af6b8
|
||||||
F src/where.c 3138c1b44193ab5f432919ab25e49f3d97bd6108
|
F src/where.c d1c05aca90d2a9d7000c40db5a4b1ac9d6d1169d
|
||||||
F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1
|
F test/all.test e4d3821eeba751829b419cd47814bd20af4286d1
|
||||||
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
|
F test/bigrow.test 8ab252dba108f12ad64e337b0f2ff31a807ac578
|
||||||
F test/btree.test bf326f546a666617367a7033fa2c07451bd4f8e1
|
F test/btree.test bf326f546a666617367a7033fa2c07451bd4f8e1
|
||||||
@@ -134,7 +134,7 @@ F www/speed.tcl da8afcc1d3ccc5696cfb388a68982bc3d9f7f00f
|
|||||||
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
|
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
|
||||||
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
|
||||||
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
|
||||||
P 29b8330ca6bfe32c499a045189683100f2b15246
|
P d1d8642b57bd0765ade730248012d58b0859c12c
|
||||||
R a27803f7b286e7959f11eb8469f192e0
|
R 7c8b29631adcec690efa7e7338377d43
|
||||||
U drh
|
U drh
|
||||||
Z a84814eb63e1343d44fc3775f1b09115
|
Z 13f7f043962d157cad884aca33ba63e6
|
||||||
|
@@ -1 +1 @@
|
|||||||
d1d8642b57bd0765ade730248012d58b0859c12c
|
690f9a163173c4c7af7e8e92e942cee4184c7974
|
@@ -9,7 +9,7 @@
|
|||||||
** May you share freely, never taking more than you give.
|
** May you share freely, never taking more than you give.
|
||||||
**
|
**
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
** $Id: btree.c,v 1.60 2002/03/06 22:01:35 drh Exp $
|
** $Id: btree.c,v 1.61 2002/05/15 11:44:14 drh Exp $
|
||||||
**
|
**
|
||||||
** This file implements a external (disk-based) database using BTrees.
|
** This file implements a external (disk-based) database using BTrees.
|
||||||
** For a detailed discussion of BTrees, refer to
|
** For a detailed discussion of BTrees, refer to
|
||||||
@@ -2564,7 +2564,7 @@ int sqliteBtreeUpdateMeta(Btree *pBt, int *aMeta){
|
|||||||
}
|
}
|
||||||
pP1 = pBt->page1;
|
pP1 = pBt->page1;
|
||||||
rc = sqlitepager_write(pP1);
|
rc = sqlitepager_write(pP1);
|
||||||
if( rc ) return rc;
|
if( rc ) return rc;
|
||||||
memcpy(pP1->aMeta, &aMeta[1], sizeof(pP1->aMeta));
|
memcpy(pP1->aMeta, &aMeta[1], sizeof(pP1->aMeta));
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
44
src/build.c
44
src/build.c
@@ -25,7 +25,7 @@
|
|||||||
** ROLLBACK
|
** ROLLBACK
|
||||||
** PRAGMA
|
** PRAGMA
|
||||||
**
|
**
|
||||||
** $Id: build.c,v 1.88 2002/05/15 08:30:13 danielk1977 Exp $
|
** $Id: build.c,v 1.89 2002/05/15 11:44:14 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -324,26 +324,26 @@ void sqliteRollbackInternalChanges(sqlite *db){
|
|||||||
/* Remove any triggers that haven't been commited yet */
|
/* Remove any triggers that haven't been commited yet */
|
||||||
for(pElem = sqliteHashFirst(&db->trigHash); pElem;
|
for(pElem = sqliteHashFirst(&db->trigHash); pElem;
|
||||||
pElem = (pElem?sqliteHashNext(pElem):0)) {
|
pElem = (pElem?sqliteHashNext(pElem):0)) {
|
||||||
Trigger * pTrigger = sqliteHashData(pElem);
|
Trigger *pTrigger = sqliteHashData(pElem);
|
||||||
if (!pTrigger->isCommit) {
|
if( !pTrigger->isCommit ){
|
||||||
Table * tbl = sqliteFindTable(db, pTrigger->table);
|
Table *pTbl = sqliteFindTable(db, pTrigger->table);
|
||||||
if (tbl) {
|
if( pTbl ){
|
||||||
if (tbl->pTrigger == pTrigger)
|
if( pTbl->pTrigger == pTrigger ){
|
||||||
tbl->pTrigger = pTrigger->pNext;
|
pTbl->pTrigger = pTrigger->pNext;
|
||||||
else {
|
}else{
|
||||||
Trigger * cc = tbl->pTrigger;
|
Trigger *cc = pTbl->pTrigger;
|
||||||
while (cc) {
|
while( cc ){
|
||||||
if (cc->pNext == pTrigger) {
|
if (cc->pNext == pTrigger) {
|
||||||
cc->pNext = cc->pNext->pNext;
|
cc->pNext = cc->pNext->pNext;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cc = cc->pNext;
|
cc = cc->pNext;
|
||||||
}
|
}
|
||||||
assert(cc);
|
assert(cc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sqliteHashInsert(&db->trigHash, pTrigger->name,
|
sqliteHashInsert(&db->trigHash, pTrigger->name,
|
||||||
1 + strlen(pTrigger->name), 0);
|
1 + strlen(pTrigger->name), 0);
|
||||||
sqliteDeleteTrigger(pTrigger);
|
sqliteDeleteTrigger(pTrigger);
|
||||||
pElem = sqliteHashFirst(&db->trigHash);
|
pElem = sqliteHashFirst(&db->trigHash);
|
||||||
}
|
}
|
||||||
@@ -355,7 +355,7 @@ void sqliteRollbackInternalChanges(sqlite *db){
|
|||||||
Trigger * pTrigger = sqliteHashData(pElem);
|
Trigger * pTrigger = sqliteHashData(pElem);
|
||||||
Table * tab = sqliteFindTable(db, pTrigger->table);
|
Table * tab = sqliteFindTable(db, pTrigger->table);
|
||||||
sqliteHashInsert(&db->trigHash, pTrigger->name,
|
sqliteHashInsert(&db->trigHash, pTrigger->name,
|
||||||
strlen(pTrigger->name) + 1, pTrigger);
|
strlen(pTrigger->name) + 1, pTrigger);
|
||||||
|
|
||||||
pTrigger->pNext = tab->pTrigger;
|
pTrigger->pNext = tab->pTrigger;
|
||||||
tab->pTrigger = pTrigger;
|
tab->pTrigger = pTrigger;
|
||||||
@@ -2116,8 +2116,8 @@ void sqlitePragma(Parse *pParse, Token *pLeft, Token *pRight, int minusFlag){
|
|||||||
sqliteVdbeChangeP3(v, -1, pIdx->zName, P3_STATIC);
|
sqliteVdbeChangeP3(v, -1, pIdx->zName, P3_STATIC);
|
||||||
sqliteVdbeAddOp(v, OP_Integer, pIdx->onError!=OE_None, 0);
|
sqliteVdbeAddOp(v, OP_Integer, pIdx->onError!=OE_None, 0);
|
||||||
sqliteVdbeAddOp(v, OP_Callback, 3, 0);
|
sqliteVdbeAddOp(v, OP_Callback, 3, 0);
|
||||||
++i;
|
++i;
|
||||||
pIdx = pIdx->pNext;
|
pIdx = pIdx->pNext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
|
34
src/delete.c
34
src/delete.c
@@ -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.31 2002/05/15 08:30:13 danielk1977 Exp $
|
** $Id: delete.c,v 1.32 2002/05/15 11:44:14 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -103,17 +103,17 @@ void sqliteDeleteFrom(
|
|||||||
if(zTab != 0) {
|
if(zTab != 0) {
|
||||||
pTab = sqliteFindTable(pParse->db, zTab);
|
pTab = sqliteFindTable(pParse->db, zTab);
|
||||||
if (pTab) {
|
if (pTab) {
|
||||||
row_triggers_exist =
|
row_triggers_exist =
|
||||||
sqliteTriggersExist(pParse, pTab->pTrigger,
|
sqliteTriggersExist(pParse, pTab->pTrigger,
|
||||||
TK_DELETE, TK_BEFORE, TK_ROW, 0) ||
|
TK_DELETE, TK_BEFORE, TK_ROW, 0) ||
|
||||||
sqliteTriggersExist(pParse, pTab->pTrigger,
|
sqliteTriggersExist(pParse, pTab->pTrigger,
|
||||||
TK_DELETE, TK_AFTER, TK_ROW, 0);
|
TK_DELETE, TK_AFTER, TK_ROW, 0);
|
||||||
}
|
}
|
||||||
sqliteFree(zTab);
|
sqliteFree(zTab);
|
||||||
if (row_triggers_exist && pTab->pSelect ) {
|
if (row_triggers_exist && pTab->pSelect ) {
|
||||||
/* Just fire VIEW triggers */
|
/* Just fire VIEW triggers */
|
||||||
sqliteViewTriggers(pParse, pTab, pWhere, OE_Replace, 0);
|
sqliteViewTriggers(pParse, pTab, pWhere, OE_Replace, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -223,10 +223,10 @@ void sqliteDeleteFrom(
|
|||||||
|
|
||||||
sqliteVdbeAddOp(v, OP_Integer, 13, 0);
|
sqliteVdbeAddOp(v, OP_Integer, 13, 0);
|
||||||
for (ii = 0; ii < pTab->nCol; ii++) {
|
for (ii = 0; ii < pTab->nCol; ii++) {
|
||||||
if (ii == pTab->iPKey)
|
if (ii == pTab->iPKey)
|
||||||
sqliteVdbeAddOp(v, OP_Recno, base, 0);
|
sqliteVdbeAddOp(v, OP_Recno, base, 0);
|
||||||
else
|
else
|
||||||
sqliteVdbeAddOp(v, OP_Column, base, ii);
|
sqliteVdbeAddOp(v, OP_Column, base, ii);
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
||||||
sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
|
sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
|
||||||
@@ -234,7 +234,7 @@ void sqliteDeleteFrom(
|
|||||||
sqliteVdbeAddOp(v, OP_Rewind, oldIdx, 0);
|
sqliteVdbeAddOp(v, OP_Rewind, oldIdx, 0);
|
||||||
|
|
||||||
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_BEFORE, pTab, -1,
|
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_BEFORE, pTab, -1,
|
||||||
oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default);
|
oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
pParse->nTab = base + 1;
|
pParse->nTab = base + 1;
|
||||||
@@ -251,11 +251,11 @@ void sqliteDeleteFrom(
|
|||||||
|
|
||||||
if (row_triggers_exist) {
|
if (row_triggers_exist) {
|
||||||
for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
|
for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
|
||||||
sqliteVdbeAddOp(v, OP_Close, base + i, pIdx->tnum);
|
sqliteVdbeAddOp(v, OP_Close, base + i, pIdx->tnum);
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
||||||
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_AFTER, pTab, -1,
|
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_AFTER, pTab, -1,
|
||||||
oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default);
|
oldIdx, (pParse->trigStack)?pParse->trigStack->orconf:OE_Default);
|
||||||
}
|
}
|
||||||
|
|
||||||
sqliteVdbeAddOp(v, OP_Goto, 0, addr);
|
sqliteVdbeAddOp(v, OP_Goto, 0, addr);
|
||||||
@@ -264,7 +264,7 @@ void sqliteDeleteFrom(
|
|||||||
|
|
||||||
if (!row_triggers_exist) {
|
if (!row_triggers_exist) {
|
||||||
for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
|
for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
|
||||||
sqliteVdbeAddOp(v, OP_Close, base + i, pIdx->tnum);
|
sqliteVdbeAddOp(v, OP_Close, base + i, pIdx->tnum);
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
||||||
pParse->nTab = base;
|
pParse->nTab = base;
|
||||||
|
80
src/insert.c
80
src/insert.c
@@ -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.53 2002/05/15 08:30:13 danielk1977 Exp $
|
** $Id: insert.c,v 1.54 2002/05/15 11:44:14 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ void sqliteInsert(
|
|||||||
*/
|
*/
|
||||||
row_triggers_exist =
|
row_triggers_exist =
|
||||||
sqliteTriggersExist(pParse, pTab->pTrigger, TK_INSERT,
|
sqliteTriggersExist(pParse, pTab->pTrigger, TK_INSERT,
|
||||||
TK_BEFORE, TK_ROW, 0) ||
|
TK_BEFORE, TK_ROW, 0) ||
|
||||||
sqliteTriggersExist(pParse, pTab->pTrigger, TK_INSERT, TK_AFTER, TK_ROW, 0);
|
sqliteTriggersExist(pParse, pTab->pTrigger, TK_INSERT, TK_AFTER, TK_ROW, 0);
|
||||||
if( pTab->readOnly || (pTab->pSelect && !row_triggers_exist) ){
|
if( pTab->readOnly || (pTab->pSelect && !row_triggers_exist) ){
|
||||||
sqliteSetString(&pParse->zErrMsg,
|
sqliteSetString(&pParse->zErrMsg,
|
||||||
@@ -243,19 +243,19 @@ void sqliteInsert(
|
|||||||
sqliteVdbeAddOp(v, OP_Integer, 13, 0);
|
sqliteVdbeAddOp(v, OP_Integer, 13, 0);
|
||||||
for(i=0; i<pTab->nCol; i++){
|
for(i=0; i<pTab->nCol; i++){
|
||||||
if( pColumn==0 ){
|
if( pColumn==0 ){
|
||||||
j = i;
|
j = i;
|
||||||
}else{
|
}else{
|
||||||
for(j=0; j<pColumn->nId; j++){
|
for(j=0; j<pColumn->nId; j++){
|
||||||
if( pColumn->a[j].idx==i ) break;
|
if( pColumn->a[j].idx==i ) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( pColumn && j>=pColumn->nId ){
|
if( pColumn && j>=pColumn->nId ){
|
||||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||||
sqliteVdbeChangeP3(v, -1, pTab->aCol[i].zDflt, P3_STATIC);
|
sqliteVdbeChangeP3(v, -1, pTab->aCol[i].zDflt, P3_STATIC);
|
||||||
}else if( srcTab>=0 ){
|
}else if( srcTab>=0 ){
|
||||||
sqliteVdbeAddOp(v, OP_Column, srcTab, j);
|
sqliteVdbeAddOp(v, OP_Column, srcTab, j);
|
||||||
}else{
|
}else{
|
||||||
sqliteExprCode(pParse, pList->a[j].pExpr);
|
sqliteExprCode(pParse, pList->a[j].pExpr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
||||||
@@ -265,7 +265,7 @@ void sqliteInsert(
|
|||||||
/* Fire BEFORE triggers */
|
/* Fire BEFORE triggers */
|
||||||
if (
|
if (
|
||||||
sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_BEFORE, pTab, newIdx, -1,
|
sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_BEFORE, pTab, newIdx, -1,
|
||||||
onError)
|
onError)
|
||||||
) goto insert_cleanup;
|
) goto insert_cleanup;
|
||||||
|
|
||||||
/* Open the tables and indices for the INSERT */
|
/* Open the tables and indices for the INSERT */
|
||||||
@@ -275,8 +275,8 @@ void sqliteInsert(
|
|||||||
sqliteVdbeAddOp(v, openOp, base, pTab->tnum);
|
sqliteVdbeAddOp(v, openOp, base, pTab->tnum);
|
||||||
sqliteVdbeChangeP3(v, -1, pTab->zName, P3_STATIC);
|
sqliteVdbeChangeP3(v, -1, pTab->zName, P3_STATIC);
|
||||||
for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
|
for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
|
||||||
sqliteVdbeAddOp(v, openOp, idx+base, pIdx->tnum);
|
sqliteVdbeAddOp(v, openOp, idx+base, pIdx->tnum);
|
||||||
sqliteVdbeChangeP3(v, -1, pIdx->zName, P3_STATIC);
|
sqliteVdbeChangeP3(v, -1, pIdx->zName, P3_STATIC);
|
||||||
}
|
}
|
||||||
pParse->nTab += idx;
|
pParse->nTab += idx;
|
||||||
}
|
}
|
||||||
@@ -290,18 +290,18 @@ void sqliteInsert(
|
|||||||
if (!pTab->pSelect) {
|
if (!pTab->pSelect) {
|
||||||
if( keyColumn>=0 ){
|
if( keyColumn>=0 ){
|
||||||
if( srcTab>=0 ){
|
if( srcTab>=0 ){
|
||||||
sqliteVdbeAddOp(v, OP_Column, srcTab, keyColumn);
|
sqliteVdbeAddOp(v, OP_Column, srcTab, keyColumn);
|
||||||
}else{
|
}else{
|
||||||
int addr;
|
int addr;
|
||||||
sqliteExprCode(pParse, pList->a[keyColumn].pExpr);
|
sqliteExprCode(pParse, pList->a[keyColumn].pExpr);
|
||||||
|
|
||||||
/* If the PRIMARY KEY expression is NULL, then use OP_NewRecno
|
/* If the PRIMARY KEY expression is NULL, then use OP_NewRecno
|
||||||
** to generate a unique primary key value.
|
** to generate a unique primary key value.
|
||||||
*/
|
*/
|
||||||
addr = sqliteVdbeAddOp(v, OP_Dup, 0, 1);
|
addr = sqliteVdbeAddOp(v, OP_Dup, 0, 1);
|
||||||
sqliteVdbeAddOp(v, OP_NotNull, 0, addr+4);
|
sqliteVdbeAddOp(v, OP_NotNull, 0, addr+4);
|
||||||
sqliteVdbeAddOp(v, OP_Pop, 1, 0);
|
sqliteVdbeAddOp(v, OP_Pop, 1, 0);
|
||||||
sqliteVdbeAddOp(v, OP_NewRecno, base, 0);
|
sqliteVdbeAddOp(v, OP_NewRecno, base, 0);
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
|
sqliteVdbeAddOp(v, OP_MustBeInt, 0, 0);
|
||||||
}else{
|
}else{
|
||||||
@@ -313,27 +313,27 @@ void sqliteInsert(
|
|||||||
*/
|
*/
|
||||||
for(i=0; i<pTab->nCol; i++){
|
for(i=0; i<pTab->nCol; i++){
|
||||||
if( i==pTab->iPKey ){
|
if( i==pTab->iPKey ){
|
||||||
/* The value of the INTEGER PRIMARY KEY column is always a NULL.
|
/* The value of the INTEGER PRIMARY KEY column is always a NULL.
|
||||||
** Whenever this column is read, the record number will be substituted
|
** Whenever this column is read, the record number will be substituted
|
||||||
** in its place. So will fill this column with a NULL to avoid
|
** in its place. So will fill this column with a NULL to avoid
|
||||||
** taking up data space with information that will never be used. */
|
** taking up data space with information that will never be used. */
|
||||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if( pColumn==0 ){
|
if( pColumn==0 ){
|
||||||
j = i;
|
j = i;
|
||||||
}else{
|
}else{
|
||||||
for(j=0; j<pColumn->nId; j++){
|
for(j=0; j<pColumn->nId; j++){
|
||||||
if( pColumn->a[j].idx==i ) break;
|
if( pColumn->a[j].idx==i ) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( pColumn && j>=pColumn->nId ){
|
if( pColumn && j>=pColumn->nId ){
|
||||||
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
sqliteVdbeAddOp(v, OP_String, 0, 0);
|
||||||
sqliteVdbeChangeP3(v, -1, pTab->aCol[i].zDflt, P3_STATIC);
|
sqliteVdbeChangeP3(v, -1, pTab->aCol[i].zDflt, P3_STATIC);
|
||||||
}else if( srcTab>=0 ){
|
}else if( srcTab>=0 ){
|
||||||
sqliteVdbeAddOp(v, OP_Column, srcTab, j);
|
sqliteVdbeAddOp(v, OP_Column, srcTab, j);
|
||||||
}else{
|
}else{
|
||||||
sqliteExprCode(pParse, pList->a[j].pExpr);
|
sqliteExprCode(pParse, pList->a[j].pExpr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,14 +356,14 @@ void sqliteInsert(
|
|||||||
if (!pTab->pSelect) {
|
if (!pTab->pSelect) {
|
||||||
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
||||||
for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
|
for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
|
||||||
sqliteVdbeAddOp(v, OP_Close, idx+base, 0);
|
sqliteVdbeAddOp(v, OP_Close, idx+base, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Code AFTER triggers */
|
/* Code AFTER triggers */
|
||||||
if (
|
if (
|
||||||
sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_AFTER, pTab, newIdx, -1,
|
sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_AFTER, pTab, newIdx, -1,
|
||||||
onError)
|
onError)
|
||||||
) goto insert_cleanup;
|
) goto insert_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
src/main.c
25
src/main.c
@@ -14,7 +14,7 @@
|
|||||||
** other files are for internal use by SQLite and should not be
|
** other files are for internal use by SQLite and should not be
|
||||||
** accessed by users of the library.
|
** accessed by users of the library.
|
||||||
**
|
**
|
||||||
** $Id: main.c,v 1.72 2002/05/15 08:30:13 danielk1977 Exp $
|
** $Id: main.c,v 1.73 2002/05/15 11:44:14 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
@@ -399,7 +399,7 @@ static void clearHashTable(sqlite *db, int preserveTemps){
|
|||||||
assert(pTab);
|
assert(pTab);
|
||||||
if (pTab->isTemp) {
|
if (pTab->isTemp) {
|
||||||
sqliteHashInsert(&db->trigHash, pTrigger->name, strlen(pTrigger->name),
|
sqliteHashInsert(&db->trigHash, pTrigger->name, strlen(pTrigger->name),
|
||||||
pTrigger);
|
pTrigger);
|
||||||
} else {
|
} else {
|
||||||
sqliteDeleteTrigger(pTrigger);
|
sqliteDeleteTrigger(pTrigger);
|
||||||
}
|
}
|
||||||
@@ -521,18 +521,19 @@ int sqlite_complete(const char *zSql){
|
|||||||
while( *zSql && *zSql!='\n' ){ zSql++; }
|
while( *zSql && *zSql!='\n' ){ zSql++; }
|
||||||
if( *zSql==0 ) return isComplete;
|
if( *zSql==0 ) return isComplete;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
if (seenCreate && !sqliteStrNICmp(zSql, "trigger", 7))
|
if (seenCreate && !sqliteStrNICmp(zSql, "trigger", 7)){
|
||||||
while (sqliteStrNICmp(zSql, "end", 3))
|
while (sqliteStrNICmp(zSql, "end", 3)){
|
||||||
if (!*++zSql) return 0;
|
if (!*++zSql) return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!sqliteStrNICmp(zSql, "create", 6)) {
|
if (!sqliteStrNICmp(zSql, "create", 6)) {
|
||||||
zSql = zSql + 5;
|
zSql = zSql + 5;
|
||||||
seenCreate = 1;
|
seenCreate = 1;
|
||||||
} else
|
}else{
|
||||||
seenCreate = 0;
|
seenCreate = 0;
|
||||||
|
}
|
||||||
isComplete = 0;
|
isComplete = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
296
src/md5.c
296
src/md5.c
@@ -55,13 +55,13 @@ typedef char MD5Context[88];
|
|||||||
* Note: this code is harmless on little-endian machines.
|
* Note: this code is harmless on little-endian machines.
|
||||||
*/
|
*/
|
||||||
static void byteReverse (unsigned char *buf, unsigned longs){
|
static void byteReverse (unsigned char *buf, unsigned longs){
|
||||||
uint32 t;
|
uint32 t;
|
||||||
do {
|
do {
|
||||||
t = (uint32)((unsigned)buf[3]<<8 | buf[2]) << 16 |
|
t = (uint32)((unsigned)buf[3]<<8 | buf[2]) << 16 |
|
||||||
((unsigned)buf[1]<<8 | buf[0]);
|
((unsigned)buf[1]<<8 | buf[0]);
|
||||||
*(uint32 *)buf = t;
|
*(uint32 *)buf = t;
|
||||||
buf += 4;
|
buf += 4;
|
||||||
} while (--longs);
|
} while (--longs);
|
||||||
}
|
}
|
||||||
/* The four core functions - F1 is optimized somewhat */
|
/* The four core functions - F1 is optimized somewhat */
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ static void byteReverse (unsigned char *buf, unsigned longs){
|
|||||||
|
|
||||||
/* This is the central step in the MD5 algorithm. */
|
/* This is the central step in the MD5 algorithm. */
|
||||||
#define MD5STEP(f, w, x, y, z, data, s) \
|
#define MD5STEP(f, w, x, y, z, data, s) \
|
||||||
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
* The core of the MD5 algorithm, this alters an existing MD5 hash to
|
||||||
@@ -81,85 +81,85 @@ static void byteReverse (unsigned char *buf, unsigned longs){
|
|||||||
* the data and converts bytes into longwords for this routine.
|
* the data and converts bytes into longwords for this routine.
|
||||||
*/
|
*/
|
||||||
static void MD5Transform(uint32 buf[4], const uint32 in[16]){
|
static void MD5Transform(uint32 buf[4], const uint32 in[16]){
|
||||||
register uint32 a, b, c, d;
|
register uint32 a, b, c, d;
|
||||||
|
|
||||||
a = buf[0];
|
a = buf[0];
|
||||||
b = buf[1];
|
b = buf[1];
|
||||||
c = buf[2];
|
c = buf[2];
|
||||||
d = buf[3];
|
d = buf[3];
|
||||||
|
|
||||||
MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
|
MD5STEP(F1, a, b, c, d, in[ 0]+0xd76aa478, 7);
|
||||||
MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
|
MD5STEP(F1, d, a, b, c, in[ 1]+0xe8c7b756, 12);
|
||||||
MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
|
MD5STEP(F1, c, d, a, b, in[ 2]+0x242070db, 17);
|
||||||
MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
|
MD5STEP(F1, b, c, d, a, in[ 3]+0xc1bdceee, 22);
|
||||||
MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
|
MD5STEP(F1, a, b, c, d, in[ 4]+0xf57c0faf, 7);
|
||||||
MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
|
MD5STEP(F1, d, a, b, c, in[ 5]+0x4787c62a, 12);
|
||||||
MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
|
MD5STEP(F1, c, d, a, b, in[ 6]+0xa8304613, 17);
|
||||||
MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
|
MD5STEP(F1, b, c, d, a, in[ 7]+0xfd469501, 22);
|
||||||
MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
|
MD5STEP(F1, a, b, c, d, in[ 8]+0x698098d8, 7);
|
||||||
MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
|
MD5STEP(F1, d, a, b, c, in[ 9]+0x8b44f7af, 12);
|
||||||
MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
|
MD5STEP(F1, c, d, a, b, in[10]+0xffff5bb1, 17);
|
||||||
MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
|
MD5STEP(F1, b, c, d, a, in[11]+0x895cd7be, 22);
|
||||||
MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
|
MD5STEP(F1, a, b, c, d, in[12]+0x6b901122, 7);
|
||||||
MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
|
MD5STEP(F1, d, a, b, c, in[13]+0xfd987193, 12);
|
||||||
MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
|
MD5STEP(F1, c, d, a, b, in[14]+0xa679438e, 17);
|
||||||
MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
|
MD5STEP(F1, b, c, d, a, in[15]+0x49b40821, 22);
|
||||||
|
|
||||||
MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
|
MD5STEP(F2, a, b, c, d, in[ 1]+0xf61e2562, 5);
|
||||||
MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
|
MD5STEP(F2, d, a, b, c, in[ 6]+0xc040b340, 9);
|
||||||
MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
|
MD5STEP(F2, c, d, a, b, in[11]+0x265e5a51, 14);
|
||||||
MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
|
MD5STEP(F2, b, c, d, a, in[ 0]+0xe9b6c7aa, 20);
|
||||||
MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
|
MD5STEP(F2, a, b, c, d, in[ 5]+0xd62f105d, 5);
|
||||||
MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
|
MD5STEP(F2, d, a, b, c, in[10]+0x02441453, 9);
|
||||||
MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
|
MD5STEP(F2, c, d, a, b, in[15]+0xd8a1e681, 14);
|
||||||
MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
|
MD5STEP(F2, b, c, d, a, in[ 4]+0xe7d3fbc8, 20);
|
||||||
MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
|
MD5STEP(F2, a, b, c, d, in[ 9]+0x21e1cde6, 5);
|
||||||
MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
|
MD5STEP(F2, d, a, b, c, in[14]+0xc33707d6, 9);
|
||||||
MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
|
MD5STEP(F2, c, d, a, b, in[ 3]+0xf4d50d87, 14);
|
||||||
MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
|
MD5STEP(F2, b, c, d, a, in[ 8]+0x455a14ed, 20);
|
||||||
MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
|
MD5STEP(F2, a, b, c, d, in[13]+0xa9e3e905, 5);
|
||||||
MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
|
MD5STEP(F2, d, a, b, c, in[ 2]+0xfcefa3f8, 9);
|
||||||
MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
|
MD5STEP(F2, c, d, a, b, in[ 7]+0x676f02d9, 14);
|
||||||
MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
|
MD5STEP(F2, b, c, d, a, in[12]+0x8d2a4c8a, 20);
|
||||||
|
|
||||||
MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
|
MD5STEP(F3, a, b, c, d, in[ 5]+0xfffa3942, 4);
|
||||||
MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
|
MD5STEP(F3, d, a, b, c, in[ 8]+0x8771f681, 11);
|
||||||
MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
|
MD5STEP(F3, c, d, a, b, in[11]+0x6d9d6122, 16);
|
||||||
MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
|
MD5STEP(F3, b, c, d, a, in[14]+0xfde5380c, 23);
|
||||||
MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
|
MD5STEP(F3, a, b, c, d, in[ 1]+0xa4beea44, 4);
|
||||||
MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
|
MD5STEP(F3, d, a, b, c, in[ 4]+0x4bdecfa9, 11);
|
||||||
MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
|
MD5STEP(F3, c, d, a, b, in[ 7]+0xf6bb4b60, 16);
|
||||||
MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
|
MD5STEP(F3, b, c, d, a, in[10]+0xbebfbc70, 23);
|
||||||
MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
|
MD5STEP(F3, a, b, c, d, in[13]+0x289b7ec6, 4);
|
||||||
MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
|
MD5STEP(F3, d, a, b, c, in[ 0]+0xeaa127fa, 11);
|
||||||
MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
|
MD5STEP(F3, c, d, a, b, in[ 3]+0xd4ef3085, 16);
|
||||||
MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
|
MD5STEP(F3, b, c, d, a, in[ 6]+0x04881d05, 23);
|
||||||
MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
|
MD5STEP(F3, a, b, c, d, in[ 9]+0xd9d4d039, 4);
|
||||||
MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
|
MD5STEP(F3, d, a, b, c, in[12]+0xe6db99e5, 11);
|
||||||
MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
|
MD5STEP(F3, c, d, a, b, in[15]+0x1fa27cf8, 16);
|
||||||
MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
|
MD5STEP(F3, b, c, d, a, in[ 2]+0xc4ac5665, 23);
|
||||||
|
|
||||||
MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
|
MD5STEP(F4, a, b, c, d, in[ 0]+0xf4292244, 6);
|
||||||
MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
|
MD5STEP(F4, d, a, b, c, in[ 7]+0x432aff97, 10);
|
||||||
MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
|
MD5STEP(F4, c, d, a, b, in[14]+0xab9423a7, 15);
|
||||||
MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
|
MD5STEP(F4, b, c, d, a, in[ 5]+0xfc93a039, 21);
|
||||||
MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
|
MD5STEP(F4, a, b, c, d, in[12]+0x655b59c3, 6);
|
||||||
MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
|
MD5STEP(F4, d, a, b, c, in[ 3]+0x8f0ccc92, 10);
|
||||||
MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
|
MD5STEP(F4, c, d, a, b, in[10]+0xffeff47d, 15);
|
||||||
MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
|
MD5STEP(F4, b, c, d, a, in[ 1]+0x85845dd1, 21);
|
||||||
MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
|
MD5STEP(F4, a, b, c, d, in[ 8]+0x6fa87e4f, 6);
|
||||||
MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
|
MD5STEP(F4, d, a, b, c, in[15]+0xfe2ce6e0, 10);
|
||||||
MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
|
MD5STEP(F4, c, d, a, b, in[ 6]+0xa3014314, 15);
|
||||||
MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
|
MD5STEP(F4, b, c, d, a, in[13]+0x4e0811a1, 21);
|
||||||
MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
|
MD5STEP(F4, a, b, c, d, in[ 4]+0xf7537e82, 6);
|
||||||
MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
|
MD5STEP(F4, d, a, b, c, in[11]+0xbd3af235, 10);
|
||||||
MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
|
MD5STEP(F4, c, d, a, b, in[ 2]+0x2ad7d2bb, 15);
|
||||||
MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
|
MD5STEP(F4, b, c, d, a, in[ 9]+0xeb86d391, 21);
|
||||||
|
|
||||||
buf[0] += a;
|
buf[0] += a;
|
||||||
buf[1] += b;
|
buf[1] += b;
|
||||||
buf[2] += c;
|
buf[2] += c;
|
||||||
buf[3] += d;
|
buf[3] += d;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -168,12 +168,12 @@ static void MD5Transform(uint32 buf[4], const uint32 in[16]){
|
|||||||
*/
|
*/
|
||||||
static void MD5Init(MD5Context *pCtx){
|
static void MD5Init(MD5Context *pCtx){
|
||||||
struct Context *ctx = (struct Context *)pCtx;
|
struct Context *ctx = (struct Context *)pCtx;
|
||||||
ctx->buf[0] = 0x67452301;
|
ctx->buf[0] = 0x67452301;
|
||||||
ctx->buf[1] = 0xefcdab89;
|
ctx->buf[1] = 0xefcdab89;
|
||||||
ctx->buf[2] = 0x98badcfe;
|
ctx->buf[2] = 0x98badcfe;
|
||||||
ctx->buf[3] = 0x10325476;
|
ctx->buf[3] = 0x10325476;
|
||||||
ctx->bits[0] = 0;
|
ctx->bits[0] = 0;
|
||||||
ctx->bits[1] = 0;
|
ctx->bits[1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -183,47 +183,47 @@ static void MD5Init(MD5Context *pCtx){
|
|||||||
static
|
static
|
||||||
void MD5Update(MD5Context *pCtx, const unsigned char *buf, unsigned int len){
|
void MD5Update(MD5Context *pCtx, const unsigned char *buf, unsigned int len){
|
||||||
struct Context *ctx = (struct Context *)pCtx;
|
struct Context *ctx = (struct Context *)pCtx;
|
||||||
uint32 t;
|
uint32 t;
|
||||||
|
|
||||||
/* Update bitcount */
|
/* Update bitcount */
|
||||||
|
|
||||||
t = ctx->bits[0];
|
t = ctx->bits[0];
|
||||||
if ((ctx->bits[0] = t + ((uint32)len << 3)) < t)
|
if ((ctx->bits[0] = t + ((uint32)len << 3)) < t)
|
||||||
ctx->bits[1]++; /* Carry from low to high */
|
ctx->bits[1]++; /* Carry from low to high */
|
||||||
ctx->bits[1] += len >> 29;
|
ctx->bits[1] += len >> 29;
|
||||||
|
|
||||||
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
|
||||||
|
|
||||||
/* Handle any leading odd-sized chunks */
|
/* Handle any leading odd-sized chunks */
|
||||||
|
|
||||||
if ( t ) {
|
if ( t ) {
|
||||||
unsigned char *p = (unsigned char *)ctx->in + t;
|
unsigned char *p = (unsigned char *)ctx->in + t;
|
||||||
|
|
||||||
t = 64-t;
|
t = 64-t;
|
||||||
if (len < t) {
|
if (len < t) {
|
||||||
memcpy(p, buf, len);
|
memcpy(p, buf, len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(p, buf, t);
|
memcpy(p, buf, t);
|
||||||
byteReverse(ctx->in, 16);
|
byteReverse(ctx->in, 16);
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
||||||
buf += t;
|
buf += t;
|
||||||
len -= t;
|
len -= t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process data in 64-byte chunks */
|
/* Process data in 64-byte chunks */
|
||||||
|
|
||||||
while (len >= 64) {
|
while (len >= 64) {
|
||||||
memcpy(ctx->in, buf, 64);
|
memcpy(ctx->in, buf, 64);
|
||||||
byteReverse(ctx->in, 16);
|
byteReverse(ctx->in, 16);
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
||||||
buf += 64;
|
buf += 64;
|
||||||
len -= 64;
|
len -= 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle any remaining bytes of data. */
|
/* Handle any remaining bytes of data. */
|
||||||
|
|
||||||
memcpy(ctx->in, buf, len);
|
memcpy(ctx->in, buf, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -232,43 +232,43 @@ void MD5Update(MD5Context *pCtx, const unsigned char *buf, unsigned int len){
|
|||||||
*/
|
*/
|
||||||
static void MD5Final(unsigned char digest[16], MD5Context *pCtx){
|
static void MD5Final(unsigned char digest[16], MD5Context *pCtx){
|
||||||
struct Context *ctx = (struct Context *)pCtx;
|
struct Context *ctx = (struct Context *)pCtx;
|
||||||
unsigned count;
|
unsigned count;
|
||||||
unsigned char *p;
|
unsigned char *p;
|
||||||
|
|
||||||
/* Compute number of bytes mod 64 */
|
/* Compute number of bytes mod 64 */
|
||||||
count = (ctx->bits[0] >> 3) & 0x3F;
|
count = (ctx->bits[0] >> 3) & 0x3F;
|
||||||
|
|
||||||
/* Set the first char of padding to 0x80. This is safe since there is
|
/* Set the first char of padding to 0x80. This is safe since there is
|
||||||
always at least one byte free */
|
always at least one byte free */
|
||||||
p = ctx->in + count;
|
p = ctx->in + count;
|
||||||
*p++ = 0x80;
|
*p++ = 0x80;
|
||||||
|
|
||||||
/* Bytes of padding needed to make 64 bytes */
|
/* Bytes of padding needed to make 64 bytes */
|
||||||
count = 64 - 1 - count;
|
count = 64 - 1 - count;
|
||||||
|
|
||||||
/* Pad out to 56 mod 64 */
|
/* Pad out to 56 mod 64 */
|
||||||
if (count < 8) {
|
if (count < 8) {
|
||||||
/* Two lots of padding: Pad the first block to 64 bytes */
|
/* Two lots of padding: Pad the first block to 64 bytes */
|
||||||
memset(p, 0, count);
|
memset(p, 0, count);
|
||||||
byteReverse(ctx->in, 16);
|
byteReverse(ctx->in, 16);
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
||||||
|
|
||||||
/* Now fill the next block with 56 bytes */
|
/* Now fill the next block with 56 bytes */
|
||||||
memset(ctx->in, 0, 56);
|
memset(ctx->in, 0, 56);
|
||||||
} else {
|
} else {
|
||||||
/* Pad block to 56 bytes */
|
/* Pad block to 56 bytes */
|
||||||
memset(p, 0, count-8);
|
memset(p, 0, count-8);
|
||||||
}
|
}
|
||||||
byteReverse(ctx->in, 14);
|
byteReverse(ctx->in, 14);
|
||||||
|
|
||||||
/* Append length in bits and transform */
|
/* Append length in bits and transform */
|
||||||
((uint32 *)ctx->in)[ 14 ] = ctx->bits[0];
|
((uint32 *)ctx->in)[ 14 ] = ctx->bits[0];
|
||||||
((uint32 *)ctx->in)[ 15 ] = ctx->bits[1];
|
((uint32 *)ctx->in)[ 15 ] = ctx->bits[1];
|
||||||
|
|
||||||
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
MD5Transform(ctx->buf, (uint32 *)ctx->in);
|
||||||
byteReverse((unsigned char *)ctx->buf, 4);
|
byteReverse((unsigned char *)ctx->buf, 4);
|
||||||
memcpy(digest, ctx->buf, 16);
|
memcpy(digest, ctx->buf, 16);
|
||||||
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
memset(ctx, 0, sizeof(ctx)); /* In case it's sensitive */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
32
src/printf.c
32
src/printf.c
@@ -336,7 +336,7 @@ static int vxprintf(
|
|||||||
case etORDINAL:
|
case etORDINAL:
|
||||||
case etRADIX:
|
case etRADIX:
|
||||||
if( flag_long ) longvalue = va_arg(ap,long);
|
if( flag_long ) longvalue = va_arg(ap,long);
|
||||||
else longvalue = va_arg(ap,int);
|
else longvalue = va_arg(ap,int);
|
||||||
#ifdef etCOMPATIBILITY
|
#ifdef etCOMPATIBILITY
|
||||||
/* For the format %#x, the value zero is printed "0" not "0x0".
|
/* For the format %#x, the value zero is printed "0" not "0x0".
|
||||||
** I think this is stupid. */
|
** I think this is stupid. */
|
||||||
@@ -356,7 +356,7 @@ static int vxprintf(
|
|||||||
}else prefix = 0;
|
}else prefix = 0;
|
||||||
if( flag_zeropad && precision<width-(prefix!=0) ){
|
if( flag_zeropad && precision<width-(prefix!=0) ){
|
||||||
precision = width-(prefix!=0);
|
precision = width-(prefix!=0);
|
||||||
}
|
}
|
||||||
bufpt = &buf[etBUFSIZE];
|
bufpt = &buf[etBUFSIZE];
|
||||||
if( xtype==etORDINAL ){
|
if( xtype==etORDINAL ){
|
||||||
long a,b;
|
long a,b;
|
||||||
@@ -386,18 +386,18 @@ static int vxprintf(
|
|||||||
*(--bufpt) = cset[longvalue%base];
|
*(--bufpt) = cset[longvalue%base];
|
||||||
longvalue = longvalue/base;
|
longvalue = longvalue/base;
|
||||||
}while( longvalue>0 );
|
}while( longvalue>0 );
|
||||||
}
|
}
|
||||||
length = (long)&buf[etBUFSIZE]-(long)bufpt;
|
length = (long)&buf[etBUFSIZE]-(long)bufpt;
|
||||||
for(idx=precision-length; idx>0; idx--){
|
for(idx=precision-length; idx>0; idx--){
|
||||||
*(--bufpt) = '0'; /* Zero pad */
|
*(--bufpt) = '0'; /* Zero pad */
|
||||||
}
|
}
|
||||||
if( prefix ) *(--bufpt) = prefix; /* Add sign */
|
if( prefix ) *(--bufpt) = prefix; /* Add sign */
|
||||||
if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
|
if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */
|
||||||
char *pre, x;
|
char *pre, x;
|
||||||
pre = infop->prefix;
|
pre = infop->prefix;
|
||||||
if( *bufpt!=pre[0] ){
|
if( *bufpt!=pre[0] ){
|
||||||
for(pre=infop->prefix; (x=(*pre))!=0; pre++) *(--bufpt) = x;
|
for(pre=infop->prefix; (x=(*pre))!=0; pre++) *(--bufpt) = x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
length = (long)&buf[etBUFSIZE]-(long)bufpt;
|
length = (long)&buf[etBUFSIZE]-(long)bufpt;
|
||||||
break;
|
break;
|
||||||
@@ -411,11 +411,11 @@ static int vxprintf(
|
|||||||
if( realvalue<0.0 ){
|
if( realvalue<0.0 ){
|
||||||
realvalue = -realvalue;
|
realvalue = -realvalue;
|
||||||
prefix = '-';
|
prefix = '-';
|
||||||
}else{
|
}else{
|
||||||
if( flag_plussign ) prefix = '+';
|
if( flag_plussign ) prefix = '+';
|
||||||
else if( flag_blanksign ) prefix = ' ';
|
else if( flag_blanksign ) prefix = ' ';
|
||||||
else prefix = 0;
|
else prefix = 0;
|
||||||
}
|
}
|
||||||
if( infop->type==etGENERIC && precision>0 ) precision--;
|
if( infop->type==etGENERIC && precision>0 ) precision--;
|
||||||
rounder = 0.0;
|
rounder = 0.0;
|
||||||
#ifdef COMPATIBILITY
|
#ifdef COMPATIBILITY
|
||||||
@@ -439,7 +439,7 @@ static int vxprintf(
|
|||||||
length = 3;
|
length = 3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bufpt = buf;
|
bufpt = buf;
|
||||||
/*
|
/*
|
||||||
** If the field type is etGENERIC, then convert to either etEXP
|
** If the field type is etGENERIC, then convert to either etEXP
|
||||||
@@ -458,9 +458,9 @@ static int vxprintf(
|
|||||||
precision = precision - exp;
|
precision = precision - exp;
|
||||||
xtype = etFLOAT;
|
xtype = etFLOAT;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
flag_rtz = 0;
|
flag_rtz = 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
** The "exp+precision" test causes output to be of type etEXP if
|
** The "exp+precision" test causes output to be of type etEXP if
|
||||||
** the precision is too large to fit in buf[].
|
** the precision is too large to fit in buf[].
|
||||||
@@ -482,7 +482,7 @@ static int vxprintf(
|
|||||||
if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
|
if( bufpt>=buf && *bufpt=='.' ) *(bufpt--) = 0;
|
||||||
}
|
}
|
||||||
bufpt++; /* point to next free slot */
|
bufpt++; /* point to next free slot */
|
||||||
}else{ /* etEXP or etGENERIC */
|
}else{ /* etEXP or etGENERIC */
|
||||||
flag_dp = (precision>0 || flag_alternateform);
|
flag_dp = (precision>0 || flag_alternateform);
|
||||||
if( prefix ) *(bufpt++) = prefix; /* Sign */
|
if( prefix ) *(bufpt++) = prefix; /* Sign */
|
||||||
*(bufpt++) = et_getdigit(&realvalue,&nsd); /* First digit */
|
*(bufpt++) = et_getdigit(&realvalue,&nsd); /* First digit */
|
||||||
@@ -501,11 +501,11 @@ static int vxprintf(
|
|||||||
if( exp>=100 ){
|
if( exp>=100 ){
|
||||||
*(bufpt++) = (exp/100)+'0'; /* 100's digit */
|
*(bufpt++) = (exp/100)+'0'; /* 100's digit */
|
||||||
exp %= 100;
|
exp %= 100;
|
||||||
}
|
}
|
||||||
*(bufpt++) = exp/10+'0'; /* 10's digit */
|
*(bufpt++) = exp/10+'0'; /* 10's digit */
|
||||||
*(bufpt++) = exp%10+'0'; /* 1's digit */
|
*(bufpt++) = exp%10+'0'; /* 1's digit */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* The converted number is in buf[] and zero terminated. Output it.
|
/* The converted number is in buf[] and zero terminated. Output it.
|
||||||
** Note that the number is in the usual order, not reversed as with
|
** Note that the number is in the usual order, not reversed as with
|
||||||
** integer conversions. */
|
** integer conversions. */
|
||||||
@@ -541,9 +541,9 @@ static int vxprintf(
|
|||||||
if( precision>=0 ){
|
if( precision>=0 ){
|
||||||
for(idx=1; idx<precision; idx++) buf[idx] = c;
|
for(idx=1; idx<precision; idx++) buf[idx] = c;
|
||||||
length = precision;
|
length = precision;
|
||||||
}else{
|
}else{
|
||||||
length =1;
|
length =1;
|
||||||
}
|
}
|
||||||
bufpt = buf;
|
bufpt = buf;
|
||||||
break;
|
break;
|
||||||
case etSTRING:
|
case etSTRING:
|
||||||
@@ -599,7 +599,7 @@ static int vxprintf(
|
|||||||
nspace = nspace/2;
|
nspace = nspace/2;
|
||||||
width -= nspace;
|
width -= nspace;
|
||||||
flag_leftjustify = 1;
|
flag_leftjustify = 1;
|
||||||
}
|
}
|
||||||
count += nspace;
|
count += nspace;
|
||||||
while( nspace>=etSPACESIZE ){
|
while( nspace>=etSPACESIZE ){
|
||||||
(*func)(arg,spaces,etSPACESIZE);
|
(*func)(arg,spaces,etSPACESIZE);
|
||||||
|
241
src/trigger.c
241
src/trigger.c
@@ -1,39 +1,38 @@
|
|||||||
/*
|
/*
|
||||||
* All copyright on this work is disclaimed by the author.
|
** All copyright on this work is disclaimed by the author.
|
||||||
*
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is called by the parser when it sees a CREATE TRIGGER statement
|
** This is called by the parser when it sees a CREATE TRIGGER statement
|
||||||
*/
|
*/
|
||||||
void
|
void sqliteCreateTrigger(
|
||||||
sqliteCreateTrigger(
|
Parse *pParse, /* The parse context of the CREATE TRIGGER statement */
|
||||||
Parse * pParse, /* The parse context of the CREATE TRIGGER statement */
|
Token *nm, /* The name of the trigger */
|
||||||
Token * nm, /* The name of the trigger */
|
int tr_tm, /* One of TK_BEFORE, TK_AFTER */
|
||||||
int tr_tm, /* One of TK_BEFORE, TK_AFTER */
|
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
|
||||||
int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
|
IdList *cols, /* column list if this is an UPDATE OF trigger */
|
||||||
IdList * cols, /* column list if this is an UPDATE OF trigger */
|
Token *tbl, /* The name of the table/view the trigger applies to */
|
||||||
Token * tbl, /* The name of the table/view the trigger applies to */
|
int foreach, /* One of TK_ROW or TK_STATEMENT */
|
||||||
int foreach, /* One of TK_ROW or TK_STATEMENT */
|
Expr *pWhen, /* WHEN clause */
|
||||||
Expr * pWhen, /* WHEN clause */
|
TriggerStep *steps, /* The triggered program */
|
||||||
TriggerStep * steps, /* The triggered program */
|
char const *cc, /* The string data to make persistent */
|
||||||
char const * cc, int len) /* The string data to make persistent */
|
int len
|
||||||
{
|
){
|
||||||
Trigger * nt;
|
Trigger *nt;
|
||||||
Table * tab;
|
Table *tab;
|
||||||
int offset;
|
int offset;
|
||||||
TriggerStep * ss;
|
TriggerStep *ss;
|
||||||
|
|
||||||
/* Check that:
|
/* Check that:
|
||||||
1. the trigger name does not already exist.
|
** 1. the trigger name does not already exist.
|
||||||
2. the table (or view) does exist.
|
** 2. the table (or view) does exist.
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char * tmp_str = sqliteStrNDup(nm->z, nm->n);
|
char *tmp_str = sqliteStrNDup(nm->z, nm->n);
|
||||||
if (sqliteHashFind(&(pParse->db->trigHash), tmp_str, nm->n + 1)) {
|
if( sqliteHashFind(&(pParse->db->trigHash), tmp_str, nm->n + 1) ){
|
||||||
sqliteSetNString(&pParse->zErrMsg, "trigger ", -1,
|
sqliteSetNString(&pParse->zErrMsg, "trigger ", -1,
|
||||||
nm->z, nm->n, " already exists", -1, 0);
|
nm->z, nm->n, " already exists", -1, 0);
|
||||||
sqliteFree(tmp_str);
|
sqliteFree(tmp_str);
|
||||||
pParse->nErr++;
|
pParse->nErr++;
|
||||||
goto trigger_cleanup;
|
goto trigger_cleanup;
|
||||||
@@ -41,20 +40,19 @@ sqliteCreateTrigger(
|
|||||||
sqliteFree(tmp_str);
|
sqliteFree(tmp_str);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
char * tmp_str = sqliteStrNDup(tbl->z, tbl->n);
|
char *tmp_str = sqliteStrNDup(tbl->z, tbl->n);
|
||||||
tab = sqliteFindTable(pParse->db, tmp_str);
|
tab = sqliteFindTable(pParse->db, tmp_str);
|
||||||
sqliteFree(tmp_str);
|
sqliteFree(tmp_str);
|
||||||
if (!tab) {
|
if( !tab ){
|
||||||
sqliteSetNString(&pParse->zErrMsg, "no such table: ", -1,
|
sqliteSetNString(&pParse->zErrMsg, "no such table: ", -1,
|
||||||
tbl->z, tbl->n, 0);
|
tbl->z, tbl->n, 0);
|
||||||
pParse->nErr++;
|
pParse->nErr++;
|
||||||
goto trigger_cleanup;
|
goto trigger_cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build the Trigger object */
|
/* Build the Trigger object */
|
||||||
nt = (Trigger *)sqliteMalloc(sizeof(Trigger));
|
nt = (Trigger*)sqliteMalloc(sizeof(Trigger));
|
||||||
|
|
||||||
nt->name = sqliteStrNDup(nm->z, nm->n);
|
nt->name = sqliteStrNDup(nm->z, nm->n);
|
||||||
nt->table = sqliteStrNDup(tbl->z, tbl->n);
|
nt->table = sqliteStrNDup(tbl->z, tbl->n);
|
||||||
nt->op = op;
|
nt->op = op;
|
||||||
@@ -81,8 +79,9 @@ sqliteCreateTrigger(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* if we are not initializing, and this trigger is not on a TEMP table,
|
/* if we are not initializing, and this trigger is not on a TEMP table,
|
||||||
build the sqlite_master entry */
|
** build the sqlite_master entry
|
||||||
if (!pParse->initFlag && !tab->isTemp) {
|
*/
|
||||||
|
if( !pParse->initFlag && !tab->isTemp ){
|
||||||
|
|
||||||
/* Make an entry in the sqlite_master table */
|
/* Make an entry in the sqlite_master table */
|
||||||
sqliteBeginWriteOperation(pParse);
|
sqliteBeginWriteOperation(pParse);
|
||||||
@@ -247,7 +246,7 @@ void sqliteDropTrigger(Parse *pParse, Token * trigname, int nested)
|
|||||||
trig = sqliteHashFind(&(pParse->db->trigHash), tmp_name, trigname->n + 1);
|
trig = sqliteHashFind(&(pParse->db->trigHash), tmp_name, trigname->n + 1);
|
||||||
if (!trig) {
|
if (!trig) {
|
||||||
sqliteSetNString(&pParse->zErrMsg, "no such trigger: ", -1,
|
sqliteSetNString(&pParse->zErrMsg, "no such trigger: ", -1,
|
||||||
tmp_name, -1, 0);
|
tmp_name, -1, 0);
|
||||||
sqliteFree(tmp_name);
|
sqliteFree(tmp_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -266,20 +265,20 @@ void sqliteDropTrigger(Parse *pParse, Token * trigname, int nested)
|
|||||||
else {
|
else {
|
||||||
Trigger * cc = tbl->pTrigger;
|
Trigger * cc = tbl->pTrigger;
|
||||||
while (cc) {
|
while (cc) {
|
||||||
if (cc->pNext == trig) {
|
if (cc->pNext == trig) {
|
||||||
cc->pNext = cc->pNext->pNext;
|
cc->pNext = cc->pNext->pNext;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cc = cc->pNext;
|
cc = cc->pNext;
|
||||||
}
|
}
|
||||||
assert(cc);
|
assert(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 2 */
|
/* 2 */
|
||||||
sqliteHashInsert(&(pParse->db->trigHash), tmp_name,
|
sqliteHashInsert(&(pParse->db->trigHash), tmp_name,
|
||||||
trigname->n + 1, NULL);
|
trigname->n + 1, NULL);
|
||||||
sqliteHashInsert(&(pParse->db->trigDrop), trig->name,
|
sqliteHashInsert(&(pParse->db->trigDrop), trig->name,
|
||||||
trigname->n + 1, trig);
|
trigname->n + 1, trig);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unless this is a trigger on a TEMP TABLE, generate code to destroy the
|
/* Unless this is a trigger on a TEMP TABLE, generate code to destroy the
|
||||||
@@ -305,7 +304,7 @@ void sqliteDropTrigger(Parse *pParse, Token * trigname, int nested)
|
|||||||
sqliteBeginWriteOperation(pParse);
|
sqliteBeginWriteOperation(pParse);
|
||||||
|
|
||||||
base = sqliteVdbeAddOpList(pParse->pVdbe,
|
base = sqliteVdbeAddOpList(pParse->pVdbe,
|
||||||
ArraySize(dropTrigger), dropTrigger);
|
ArraySize(dropTrigger), dropTrigger);
|
||||||
sqliteVdbeChangeP3(pParse->pVdbe, base+2, tmp_name, 0);
|
sqliteVdbeChangeP3(pParse->pVdbe, base+2, tmp_name, 0);
|
||||||
|
|
||||||
if (!nested)
|
if (!nested)
|
||||||
@@ -329,7 +328,7 @@ static int checkColumnOverLap(IdList * ii, ExprList * ee)
|
|||||||
for (i = 0; i < ii->nId; i++)
|
for (i = 0; i < ii->nId; i++)
|
||||||
for (e = 0; e < ee->nExpr; e++)
|
for (e = 0; e < ee->nExpr; e++)
|
||||||
if (!sqliteStrICmp(ii->a[i].zName, ee->a[e].zName))
|
if (!sqliteStrICmp(ii->a[i].zName, ee->a[e].zName))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -364,7 +363,7 @@ int sqliteTriggersExist(
|
|||||||
tt = pTrigger;
|
tt = pTrigger;
|
||||||
while (tt) {
|
while (tt) {
|
||||||
if (tt->op == op && tt->tr_tm == tr_tm && tt->foreach == foreach &&
|
if (tt->op == op && tt->tr_tm == tr_tm && tt->foreach == foreach &&
|
||||||
checkColumnOverLap(tt->pColumns, pChanges)) {
|
checkColumnOverLap(tt->pColumns, pChanges)) {
|
||||||
TriggerStack * ss;
|
TriggerStack * ss;
|
||||||
ss = pParse->trigStack;
|
ss = pParse->trigStack;
|
||||||
while (ss && ss->pTrigger != pTrigger) ss = ss->pNext;
|
while (ss && ss->pTrigger != pTrigger) ss = ss->pNext;
|
||||||
@@ -377,70 +376,70 @@ int sqliteTriggersExist(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int codeTriggerProgram(
|
static int codeTriggerProgram(
|
||||||
Parse *pParse,
|
Parse *pParse,
|
||||||
TriggerStep * program,
|
TriggerStep * program,
|
||||||
int onError)
|
int onError)
|
||||||
{
|
{
|
||||||
TriggerStep * step = program;
|
TriggerStep * step = program;
|
||||||
int orconf;
|
int orconf;
|
||||||
|
|
||||||
while (step) {
|
while (step) {
|
||||||
int saveNTab = pParse->nTab;
|
int saveNTab = pParse->nTab;
|
||||||
orconf = (onError == OE_Default)?step->orconf:onError;
|
orconf = (onError == OE_Default)?step->orconf:onError;
|
||||||
pParse->trigStack->orconf = orconf;
|
pParse->trigStack->orconf = orconf;
|
||||||
switch(step->op) {
|
switch(step->op) {
|
||||||
case TK_SELECT: {
|
case TK_SELECT: {
|
||||||
int tmp_tbl = pParse->nTab++;
|
int tmp_tbl = pParse->nTab++;
|
||||||
sqliteVdbeAddOp(pParse->pVdbe, OP_OpenTemp, tmp_tbl, 0);
|
sqliteVdbeAddOp(pParse->pVdbe, OP_OpenTemp, tmp_tbl, 0);
|
||||||
sqliteVdbeAddOp(pParse->pVdbe, OP_KeyAsData, tmp_tbl, 1);
|
sqliteVdbeAddOp(pParse->pVdbe, OP_KeyAsData, tmp_tbl, 1);
|
||||||
sqliteSelect(pParse, step->pSelect,
|
sqliteSelect(pParse, step->pSelect,
|
||||||
SRT_Union, tmp_tbl, 0, 0, 0);
|
SRT_Union, tmp_tbl, 0, 0, 0);
|
||||||
sqliteVdbeAddOp(pParse->pVdbe, OP_Close, tmp_tbl, 0);
|
sqliteVdbeAddOp(pParse->pVdbe, OP_Close, tmp_tbl, 0);
|
||||||
pParse->nTab--;
|
pParse->nTab--;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_UPDATE: {
|
case TK_UPDATE: {
|
||||||
sqliteVdbeAddOp(pParse->pVdbe, OP_PushList, 0, 0);
|
sqliteVdbeAddOp(pParse->pVdbe, OP_PushList, 0, 0);
|
||||||
sqliteUpdate(pParse, &step->target,
|
sqliteUpdate(pParse, &step->target,
|
||||||
sqliteExprListDup(step->pExprList),
|
sqliteExprListDup(step->pExprList),
|
||||||
sqliteExprDup(step->pWhere), orconf);
|
sqliteExprDup(step->pWhere), orconf);
|
||||||
sqliteVdbeAddOp(pParse->pVdbe, OP_PopList, 0, 0);
|
sqliteVdbeAddOp(pParse->pVdbe, OP_PopList, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_INSERT: {
|
case TK_INSERT: {
|
||||||
sqliteInsert(pParse, &step->target,
|
sqliteInsert(pParse, &step->target,
|
||||||
sqliteExprListDup(step->pExprList),
|
sqliteExprListDup(step->pExprList),
|
||||||
sqliteSelectDup(step->pSelect),
|
sqliteSelectDup(step->pSelect),
|
||||||
sqliteIdListDup(step->pIdList), orconf);
|
sqliteIdListDup(step->pIdList), orconf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TK_DELETE: {
|
case TK_DELETE: {
|
||||||
sqliteVdbeAddOp(pParse->pVdbe, OP_PushList, 0, 0);
|
sqliteVdbeAddOp(pParse->pVdbe, OP_PushList, 0, 0);
|
||||||
sqliteDeleteFrom(pParse, &step->target,
|
sqliteDeleteFrom(pParse, &step->target,
|
||||||
sqliteExprDup(step->pWhere)
|
sqliteExprDup(step->pWhere)
|
||||||
);
|
);
|
||||||
sqliteVdbeAddOp(pParse->pVdbe, OP_PopList, 0, 0);
|
sqliteVdbeAddOp(pParse->pVdbe, OP_PopList, 0, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
}
|
}
|
||||||
pParse->nTab = saveNTab;
|
pParse->nTab = saveNTab;
|
||||||
step = step->pNext;
|
step = step->pNext;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sqliteCodeRowTrigger(
|
int sqliteCodeRowTrigger(
|
||||||
Parse * pParse, /* Parse context */
|
Parse * pParse, /* Parse context */
|
||||||
int op, /* One of TK_UPDATE, TK_INSERT, TK_DELETE */
|
int op, /* One of TK_UPDATE, TK_INSERT, TK_DELETE */
|
||||||
ExprList * changes, /* Changes list for any UPDATE OF triggers */
|
ExprList * changes, /* Changes list for any UPDATE OF triggers */
|
||||||
int tr_tm, /* One of TK_BEFORE, TK_AFTER */
|
int tr_tm, /* One of TK_BEFORE, TK_AFTER */
|
||||||
Table * tbl, /* The table to code triggers from */
|
Table * tbl, /* The table to code triggers from */
|
||||||
int newTable, /* The indice of the "new" row to access */
|
int newTable, /* The indice of the "new" row to access */
|
||||||
int oldTable, /* The indice of the "old" row to access */
|
int oldTable, /* The indice of the "old" row to access */
|
||||||
int onError) /* ON CONFLICT policy */
|
int onError) /* ON CONFLICT policy */
|
||||||
{
|
{
|
||||||
Trigger * pTrigger;
|
Trigger * pTrigger;
|
||||||
TriggerStack * pTriggerStack;
|
TriggerStack * pTriggerStack;
|
||||||
@@ -457,16 +456,16 @@ int sqliteCodeRowTrigger(
|
|||||||
|
|
||||||
/* determine whether we should code this trigger */
|
/* determine whether we should code this trigger */
|
||||||
if (pTrigger->op == op && pTrigger->tr_tm == tr_tm &&
|
if (pTrigger->op == op && pTrigger->tr_tm == tr_tm &&
|
||||||
pTrigger->foreach == TK_ROW) {
|
pTrigger->foreach == TK_ROW) {
|
||||||
fire_this = 1;
|
fire_this = 1;
|
||||||
pTriggerStack = pParse->trigStack;
|
pTriggerStack = pParse->trigStack;
|
||||||
while (pTriggerStack) {
|
while (pTriggerStack) {
|
||||||
if (pTriggerStack->pTrigger == pTrigger) fire_this = 0;
|
if (pTriggerStack->pTrigger == pTrigger) fire_this = 0;
|
||||||
pTriggerStack = pTriggerStack->pNext;
|
pTriggerStack = pTriggerStack->pNext;
|
||||||
}
|
}
|
||||||
if (op == TK_UPDATE && pTrigger->pColumns &&
|
if (op == TK_UPDATE && pTrigger->pColumns &&
|
||||||
!checkColumnOverLap(pTrigger->pColumns, changes))
|
!checkColumnOverLap(pTrigger->pColumns, changes))
|
||||||
fire_this = 0;
|
fire_this = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fire_this) {
|
if (fire_this) {
|
||||||
@@ -490,10 +489,10 @@ int sqliteCodeRowTrigger(
|
|||||||
endTrigger = sqliteVdbeMakeLabel(pParse->pVdbe);
|
endTrigger = sqliteVdbeMakeLabel(pParse->pVdbe);
|
||||||
whenExpr = sqliteExprDup(pTrigger->pWhen);
|
whenExpr = sqliteExprDup(pTrigger->pWhen);
|
||||||
if (sqliteExprResolveIds(pParse, 0, &dummyTablist, 0, whenExpr)) {
|
if (sqliteExprResolveIds(pParse, 0, &dummyTablist, 0, whenExpr)) {
|
||||||
pParse->trigStack = pParse->trigStack->pNext;
|
pParse->trigStack = pParse->trigStack->pNext;
|
||||||
sqliteFree(pTriggerStack);
|
sqliteFree(pTriggerStack);
|
||||||
sqliteExprDelete(whenExpr);
|
sqliteExprDelete(whenExpr);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
sqliteExprIfFalse(pParse, whenExpr, endTrigger);
|
sqliteExprIfFalse(pParse, whenExpr, endTrigger);
|
||||||
sqliteExprDelete(whenExpr);
|
sqliteExprDelete(whenExpr);
|
||||||
@@ -582,23 +581,23 @@ void sqliteViewTriggers(Parse *pParse, Table *pTab,
|
|||||||
for(ii=0; ii<pChanges->nExpr; ii++){
|
for(ii=0; ii<pChanges->nExpr; ii++){
|
||||||
int jj;
|
int jj;
|
||||||
if( sqliteExprResolveIds(pParse, oldIdx, theSelect.pSrc , 0,
|
if( sqliteExprResolveIds(pParse, oldIdx, theSelect.pSrc , 0,
|
||||||
pChanges->a[ii].pExpr) )
|
pChanges->a[ii].pExpr) )
|
||||||
goto trigger_cleanup;
|
goto trigger_cleanup;
|
||||||
|
|
||||||
if( sqliteExprCheck(pParse, pChanges->a[ii].pExpr, 0, 0) )
|
if( sqliteExprCheck(pParse, pChanges->a[ii].pExpr, 0, 0) )
|
||||||
goto trigger_cleanup;
|
goto trigger_cleanup;
|
||||||
|
|
||||||
for(jj=0; jj<pTab->nCol; jj++){
|
for(jj=0; jj<pTab->nCol; jj++){
|
||||||
if( sqliteStrICmp(pTab->aCol[jj].zName, pChanges->a[ii].zName)==0 ){
|
if( sqliteStrICmp(pTab->aCol[jj].zName, pChanges->a[ii].zName)==0 ){
|
||||||
aXRef[jj] = ii;
|
aXRef[jj] = ii;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( jj>=pTab->nCol ){
|
if( jj>=pTab->nCol ){
|
||||||
sqliteSetString(&pParse->zErrMsg, "no such column: ",
|
sqliteSetString(&pParse->zErrMsg, "no such column: ",
|
||||||
pChanges->a[ii].zName, 0);
|
pChanges->a[ii].zName, 0);
|
||||||
pParse->nErr++;
|
pParse->nErr++;
|
||||||
goto trigger_cleanup;
|
goto trigger_cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -606,23 +605,23 @@ void sqliteViewTriggers(Parse *pParse, Table *pTab,
|
|||||||
|
|
||||||
for (ii = 0; ii < pTab->nCol; ii++)
|
for (ii = 0; ii < pTab->nCol; ii++)
|
||||||
if( aXRef[ii] < 0 )
|
if( aXRef[ii] < 0 )
|
||||||
sqliteVdbeAddOp(v, OP_Column, oldIdx, ii);
|
sqliteVdbeAddOp(v, OP_Column, oldIdx, ii);
|
||||||
else
|
else
|
||||||
sqliteExprCode(pParse, pChanges->a[aXRef[ii]].pExpr);
|
sqliteExprCode(pParse, pChanges->a[aXRef[ii]].pExpr);
|
||||||
|
|
||||||
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
||||||
sqliteVdbeAddOp(v, OP_PutIntKey, newIdx, 0);
|
sqliteVdbeAddOp(v, OP_PutIntKey, newIdx, 0);
|
||||||
sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0);
|
sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0);
|
||||||
|
|
||||||
sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE,
|
sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE,
|
||||||
pTab, newIdx, oldIdx, onError);
|
pTab, newIdx, oldIdx, onError);
|
||||||
sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER,
|
sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER,
|
||||||
pTab, newIdx, oldIdx, onError);
|
pTab, newIdx, oldIdx, onError);
|
||||||
} else {
|
} else {
|
||||||
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_BEFORE, pTab, -1, oldIdx,
|
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_BEFORE, pTab, -1, oldIdx,
|
||||||
onError);
|
onError);
|
||||||
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_AFTER, pTab, -1, oldIdx,
|
sqliteCodeRowTrigger(pParse, TK_DELETE, 0, TK_AFTER, pTab, -1, oldIdx,
|
||||||
onError);
|
onError);
|
||||||
}
|
}
|
||||||
|
|
||||||
sqliteVdbeAddOp(v, OP_Next, oldIdx, startOfLoop);
|
sqliteVdbeAddOp(v, OP_Next, oldIdx, startOfLoop);
|
||||||
@@ -639,5 +638,3 @@ trigger_cleanup:
|
|||||||
sqliteExprDelete(theSelect.pWhere);
|
sqliteExprDelete(theSelect.pWhere);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
34
src/update.c
34
src/update.c
@@ -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.37 2002/05/15 08:30:14 danielk1977 Exp $
|
** $Id: update.c,v 1.38 2002/05/15 11:44:15 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -64,17 +64,17 @@ void sqliteUpdate(
|
|||||||
if(zTab != 0) {
|
if(zTab != 0) {
|
||||||
pTab = sqliteFindTable(pParse->db, zTab);
|
pTab = sqliteFindTable(pParse->db, zTab);
|
||||||
if (pTab) {
|
if (pTab) {
|
||||||
row_triggers_exist =
|
row_triggers_exist =
|
||||||
sqliteTriggersExist(pParse, pTab->pTrigger,
|
sqliteTriggersExist(pParse, pTab->pTrigger,
|
||||||
TK_UPDATE, TK_BEFORE, TK_ROW, pChanges) ||
|
TK_UPDATE, TK_BEFORE, TK_ROW, pChanges) ||
|
||||||
sqliteTriggersExist(pParse, pTab->pTrigger,
|
sqliteTriggersExist(pParse, pTab->pTrigger,
|
||||||
TK_UPDATE, TK_AFTER, TK_ROW, pChanges);
|
TK_UPDATE, TK_AFTER, TK_ROW, pChanges);
|
||||||
}
|
}
|
||||||
sqliteFree(zTab);
|
sqliteFree(zTab);
|
||||||
if (row_triggers_exist && pTab->pSelect ) {
|
if (row_triggers_exist && pTab->pSelect ) {
|
||||||
/* Just fire VIEW triggers */
|
/* Just fire VIEW triggers */
|
||||||
sqliteViewTriggers(pParse, pTab, pWhere, onError, pChanges);
|
sqliteViewTriggers(pParse, pTab, pWhere, onError, pChanges);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,10 +213,10 @@ void sqliteUpdate(
|
|||||||
|
|
||||||
sqliteVdbeAddOp(v, OP_Integer, 13, 0);
|
sqliteVdbeAddOp(v, OP_Integer, 13, 0);
|
||||||
for (ii = 0; ii < pTab->nCol; ii++) {
|
for (ii = 0; ii < pTab->nCol; ii++) {
|
||||||
if (ii == pTab->iPKey)
|
if (ii == pTab->iPKey)
|
||||||
sqliteVdbeAddOp(v, OP_Recno, base, 0);
|
sqliteVdbeAddOp(v, OP_Recno, base, 0);
|
||||||
else
|
else
|
||||||
sqliteVdbeAddOp(v, OP_Column, base, ii);
|
sqliteVdbeAddOp(v, OP_Column, base, ii);
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
sqliteVdbeAddOp(v, OP_MakeRecord, pTab->nCol, 0);
|
||||||
sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
|
sqliteVdbeAddOp(v, OP_PutIntKey, oldIdx, 0);
|
||||||
@@ -240,7 +240,7 @@ void sqliteUpdate(
|
|||||||
sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0);
|
sqliteVdbeAddOp(v, OP_Rewind, newIdx, 0);
|
||||||
|
|
||||||
if (sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE, pTab,
|
if (sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_BEFORE, pTab,
|
||||||
newIdx, oldIdx, onError)) goto update_cleanup;
|
newIdx, oldIdx, onError)) goto update_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Rewind the list of records that need to be updated and
|
/* Rewind the list of records that need to be updated and
|
||||||
@@ -340,13 +340,13 @@ void sqliteUpdate(
|
|||||||
if (row_triggers_exist) {
|
if (row_triggers_exist) {
|
||||||
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
|
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
|
||||||
if( openAll || aIdxUsed[i] )
|
if( openAll || aIdxUsed[i] )
|
||||||
sqliteVdbeAddOp(v, OP_Close, base+i+1, 0);
|
sqliteVdbeAddOp(v, OP_Close, base+i+1, 0);
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
||||||
pParse->nTab = base;
|
pParse->nTab = base;
|
||||||
|
|
||||||
if (sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER, pTab,
|
if (sqliteCodeRowTrigger(pParse, TK_UPDATE, pChanges, TK_AFTER, pTab,
|
||||||
newIdx, oldIdx, onError)) goto update_cleanup;
|
newIdx, oldIdx, onError)) goto update_cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Repeat the above with the next record to be updated, until
|
/* Repeat the above with the next record to be updated, until
|
||||||
@@ -360,7 +360,7 @@ void sqliteUpdate(
|
|||||||
if (!row_triggers_exist) {
|
if (!row_triggers_exist) {
|
||||||
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
|
for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
|
||||||
if( openAll || aIdxUsed[i] ){
|
if( openAll || aIdxUsed[i] ){
|
||||||
sqliteVdbeAddOp(v, OP_Close, base+i+1, 0);
|
sqliteVdbeAddOp(v, OP_Close, base+i+1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
sqliteVdbeAddOp(v, OP_Close, base, 0);
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
** But other routines are also provided to help in building up
|
** But other routines are also provided to help in building up
|
||||||
** a program instruction by instruction.
|
** a program instruction by instruction.
|
||||||
**
|
**
|
||||||
** $Id: vdbe.c,v 1.142 2002/05/15 08:30:14 danielk1977 Exp $
|
** $Id: vdbe.c,v 1.143 2002/05/15 11:44:15 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -4560,7 +4560,7 @@ case OP_PushList: {
|
|||||||
p->keylistStackDepth++;
|
p->keylistStackDepth++;
|
||||||
assert(p->keylistStackDepth > 0);
|
assert(p->keylistStackDepth > 0);
|
||||||
p->keylistStack = sqliteRealloc(p->keylistStack,
|
p->keylistStack = sqliteRealloc(p->keylistStack,
|
||||||
sizeof(Keylist *) * p->keylistStackDepth);
|
sizeof(Keylist *) * p->keylistStackDepth);
|
||||||
p->keylistStack[p->keylistStackDepth - 1] = p->pList;
|
p->keylistStack[p->keylistStackDepth - 1] = p->pList;
|
||||||
p->pList = 0;
|
p->pList = 0;
|
||||||
break;
|
break;
|
||||||
|
26
src/where.c
26
src/where.c
@@ -13,7 +13,7 @@
|
|||||||
** the WHERE clause of SQL statements. Also found here are subroutines
|
** the WHERE clause of SQL statements. Also found here are subroutines
|
||||||
** to generate VDBE code to evaluate expressions.
|
** to generate VDBE code to evaluate expressions.
|
||||||
**
|
**
|
||||||
** $Id: where.c,v 1.42 2002/05/15 08:30:14 danielk1977 Exp $
|
** $Id: where.c,v 1.43 2002/05/15 11:44:15 drh Exp $
|
||||||
*/
|
*/
|
||||||
#include "sqliteInt.h"
|
#include "sqliteInt.h"
|
||||||
|
|
||||||
@@ -217,20 +217,20 @@ WhereInfo *sqliteWhereBegin(
|
|||||||
for(i=0; i<nExpr; i++){
|
for(i=0; i<nExpr; i++){
|
||||||
exprAnalyze(base, &aExpr[i]);
|
exprAnalyze(base, &aExpr[i]);
|
||||||
if (pParse->trigStack && pParse->trigStack->newIdx >= 0) {
|
if (pParse->trigStack && pParse->trigStack->newIdx >= 0) {
|
||||||
aExpr[i].prereqRight =
|
aExpr[i].prereqRight =
|
||||||
aExpr[i].prereqRight & ~(1 << pParse->trigStack->newIdx - base);
|
aExpr[i].prereqRight & ~(1 << pParse->trigStack->newIdx - base);
|
||||||
aExpr[i].prereqLeft =
|
aExpr[i].prereqLeft =
|
||||||
aExpr[i].prereqLeft & ~(1 << pParse->trigStack->newIdx - base);
|
aExpr[i].prereqLeft & ~(1 << pParse->trigStack->newIdx - base);
|
||||||
aExpr[i].prereqAll =
|
aExpr[i].prereqAll =
|
||||||
aExpr[i].prereqAll & ~(1 << pParse->trigStack->newIdx - base);
|
aExpr[i].prereqAll & ~(1 << pParse->trigStack->newIdx - base);
|
||||||
}
|
}
|
||||||
if (pParse->trigStack && pParse->trigStack->oldIdx >= 0) {
|
if (pParse->trigStack && pParse->trigStack->oldIdx >= 0) {
|
||||||
aExpr[i].prereqRight =
|
aExpr[i].prereqRight =
|
||||||
aExpr[i].prereqRight & ~(1 << pParse->trigStack->oldIdx - base);
|
aExpr[i].prereqRight & ~(1 << pParse->trigStack->oldIdx - base);
|
||||||
aExpr[i].prereqLeft =
|
aExpr[i].prereqLeft =
|
||||||
aExpr[i].prereqLeft & ~(1 << pParse->trigStack->oldIdx - base);
|
aExpr[i].prereqLeft & ~(1 << pParse->trigStack->oldIdx - base);
|
||||||
aExpr[i].prereqAll =
|
aExpr[i].prereqAll =
|
||||||
aExpr[i].prereqAll & ~(1 << pParse->trigStack->oldIdx - base);
|
aExpr[i].prereqAll & ~(1 << pParse->trigStack->oldIdx - base);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user