Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Bug fix: Get INSERT INTO ... SELECT working when the target is a virtual table. (CVS 3374) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7912485705c96e365a942932bb12d5b9 |
User & Date: | drh 2006-08-29 18:46:13.975 |
Original User & Date: | drh 2006-08-29 18:46:14.000 |
Context
2006-08-29
| ||
18:46 | Bug fix: Get INSERT INTO ... SELECT working when the target is a virtual table. (CVS 3375) (check-in: 7cdc41e748 user: drh tags: trunk) | |
18:46 | Bug fix: Get INSERT INTO ... SELECT working when the target is a virtual table. (CVS 3374) (check-in: 7912485705 user: drh tags: trunk) | |
13:08 | Document the fact that SQLite allows NULL values in PRIMARY KEY columns and the fact that we might design to change this in the future. Ticket #518. (CVS 3373) (check-in: b99d845ef4 user: drh tags: trunk) | |
Changes
Changes to src/insert.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** ** $Id: insert.c,v 1.172 2006/08/29 18:46:14 drh Exp $ */ #include "sqliteInt.h" /* ** Set P3 of the most recently inserted opcode to a column affinity ** string for index pIdx. A column affinity string has one character ** for each column in the table, according to the affinity of the column: |
︙ | ︙ | |||
617 618 619 620 621 622 623 | } } if( nColumn==0 || (pColumn && j>=pColumn->nId) ){ sqlite3ExprCode(pParse, pTab->aCol[i].pDflt); }else if( useTempTable ){ sqlite3VdbeAddOp(v, OP_Column, srcTab, j); }else if( pSelect ){ | | | 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | } } if( nColumn==0 || (pColumn && j>=pColumn->nId) ){ sqlite3ExprCode(pParse, pTab->aCol[i].pDflt); }else if( useTempTable ){ sqlite3VdbeAddOp(v, OP_Column, srcTab, j); }else if( pSelect ){ sqlite3VdbeAddOp(v, OP_Dup, i+nColumn-j+IsVirtual(pTab), 1); }else{ sqlite3ExprCode(pParse, pList->a[j].pExpr); } } /* Generate code to check constraints and generate index keys and ** do the insertion. |
︙ | ︙ |
Added test/vtab9.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # 2006 August 29 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file inserting into virtual tables from a SELECT # statement. # # $Id: vtab9.test,v 1.1 2006/08/29 18:46:14 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl ifcapable !vtab { finish_test return } do_test vtab9-1.1 { register_echo_module [sqlite3_connection_pointer db] execsql { CREATE TABLE t0(a); CREATE VIRTUAL TABLE t1 USING echo(t0); INSERT INTO t1 SELECT 'hello'; SELECT rowid, * FROM t1; } } {1 hello} do_test vtab9-1.2 { execsql { CREATE TABLE t2(a,b,c); CREATE VIRTUAL TABLE t3 USING echo(t2); CREATE TABLE d1(a,b,c); INSERT INTO d1 VALUES(1,2,3); INSERT INTO d1 VALUES('a','b','c'); INSERT INTO d1 VALUES(NULL,'x',123.456); INSERT INTO d1 VALUES(x'6869',123456789,-12345); INSERT INTO t3(a,b,c) SELECT * FROM d1; SELECT rowid, * FROM t3; } } {1 1 2 3 2 a b c 3 {} x 123.456 4 hi 123456789 -12345} unset -nocomplain echo_module_begin_fail finish_test |