-C Fix\sfor\sbug\s#10:\sPop\sthe\sstack\sby\sthe\sright\samount\son\san\sIGNORE\sso\sthat\sthe\nstack\sdoes\snot\sgrow\swithout\sbound.\s(CVS\s523)
-D 2002-04-09T03:15:07
+C Fix\sfor\sbug\s#11:\sOutput\sthe\scorrect\srow\scount\swhen\sand\sINSERT\sdoes\san\nIGNORE\saction.\s(CVS\s524)
+D 2002-04-09T03:28:01
F Makefile.in 50f1b3351df109b5774771350d8c1b8d3640130d
F Makefile.template 89e373b2dad0321df00400fa968dc14b61a03296
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
F src/func.c dca9df811298cd0beb3724d40cee348e884352b2
F src/hash.c cc259475e358baaf299b00a2c7370f2b03dda892
F src/hash.h dca065dda89d4575f3176e75e9a3dc0f4b4fb8b9
-F src/insert.c bae1964a0923e4716d73639becda6f8040b8889e
+F src/insert.c 9ddb3b05a77644cd0e325a97a4d896c328c13601
F src/main.c b21019084b93fe685a8a25217d01f6958584ae9b
F src/md5.c b2b1a34fce66ceca97f4e0dabc20be8be7933c92
F src/os.c 5ab8b6b4590d0c1ab8e96c67996c170e4462e0fc
F test/btree.test bf326f546a666617367a7033fa2c07451bd4f8e1
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895
-F test/conflict.test cbefdd1acf526d516ee355bcbae3f6ac20dba433
+F test/conflict.test 3383ac08da14cdba11bb4c9495583cf87f67afb1
F test/copy.test b3cefcb520c64d7e7dfedbab06b4d4c31fa5b99a
F test/delete.test c904a62129fe102b314a96111a8417f10249e4d8
F test/expr.test 846795016b5993a7411f772eebe82ab67bd7230a
F www/sqlite.tcl 8b5884354cb615049aed83039f8dfe1552a44279
F www/tclsqlite.tcl 829b393d1ab187fd7a5e978631b3429318885c49
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 760bf568c882d7b28746b1e004309ef08d2ff4c0
-R 6b0c28f4fe8903649bf342fb8427f838
+P f46acfc3b828620e4e97b09f9aff119b9313e5d7
+R 692fc2d1862a53490444758eb16748ac
U drh
-Z 331e7f72889413d22a80eccdf9b3c49a
+Z 6902a29913af9f8655adc77cc99b4640
-f46acfc3b828620e4e97b09f9aff119b9313e5d7
\ No newline at end of file
+bb83642e9a6c1c9ade861618496933c9f922a8f8
\ No newline at end of file
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
-** $Id: insert.c,v 1.49 2002/04/09 03:15:07 drh Exp $
+** $Id: insert.c,v 1.50 2002/04/09 03:28:01 drh Exp $
*/
#include "sqliteInt.h"
}
pParse->nTab += idx;
+ /* Initialize the count of rows to be inserted
+ */
+ if( db->flags & SQLITE_CountRows ){
+ sqliteVdbeAddOp(v, OP_Integer, 0, 0); /* Initialize the row count */
+ }
+
/* If the data source is a SELECT statement, then we have to create
** a loop because there might be multiple rows of data. If the data
** source is an expression list, then exactly one row will be inserted
** and the loop is not used.
*/
if( srcTab>=0 ){
- if( db->flags & SQLITE_CountRows ){
- sqliteVdbeAddOp(v, OP_Integer, 0, 0); /* Initialize the row count */
- }
iBreak = sqliteVdbeMakeLabel(v);
sqliteVdbeAddOp(v, OP_Rewind, srcTab, iBreak);
iCont = sqliteVdbeCurrentAddr(v);
sqliteGenerateConstraintChecks(pParse, pTab, base, 0,0,0, onError, endOfLoop);
sqliteCompleteInsertion(pParse, pTab, base, 0,0,0);
- /* If inserting from a SELECT, keep a count of the number of
- ** rows inserted.
+ /* Update the count of rows that are inserted
*/
- if( srcTab>=0 && (db->flags & SQLITE_CountRows)!=0 ){
+ if( (db->flags & SQLITE_CountRows)!=0 ){
sqliteVdbeAddOp(v, OP_AddImm, 1, 0);
}
sqliteVdbeAddOp(v, OP_ColumnCount, 1, 0);
sqliteVdbeAddOp(v, OP_ColumnName, 0, 0);
sqliteVdbeChangeP3(v, -1, "rows inserted", P3_STATIC);
- if( srcTab<0 ){
- sqliteVdbeAddOp(v, OP_Integer, 1, 0);
- }
sqliteVdbeAddOp(v, OP_Callback, 1, 0);
}
# This file implements tests for the conflict resolution extension
# to SQLite.
#
-# $Id: conflict.test,v 1.9 2002/04/09 03:15:08 drh Exp $
+# $Id: conflict.test,v 1.10 2002/04/09 03:28:01 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
}
} {1}
+# Make sure the row count is right for rows that are ignored on
+# an insert.
+#
+do_test conflict-8.1 {
+ execsql {
+ DELETE FROM t1;
+ INSERT INTO t1 VALUES(1,2);
+ }
+ execsql {
+ INSERT OR IGNORE INTO t1 VALUES(2,3);
+ }
+} {1}
+do_test conflict-8.2 {
+ execsql {
+ INSERT OR IGNORE INTO t1 VALUES(2,4);
+ }
+} {0}
+do_test conflict-8.3 {
+ execsql {
+ INSERT OR REPLACE INTO t1 VALUES(2,4);
+ }
+} {1}
+do_test conflict-8.4 {
+ execsql {
+ INSERT OR IGNORE INTO t1 SELECT * FROM t1;
+ }
+} {0}
+do_test conflict-8.5 {
+ execsql {
+ INSERT OR IGNORE INTO t1 SELECT a+2,b+2 FROM t1;
+ }
+} {2}
+do_test conflict-8.6 {
+ execsql {
+ INSERT OR IGNORE INTO t1 SELECT a+3,b+3 FROM t1;
+ }
+} {3}
do_test insert-99.1 {
set x [execsql {PRAGMA integrity_check}]