Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | :-) (CVS 16) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b56d1b9c0f957f3dfb380c01d31ff7c0 |
User & Date: | drh 2000-05-30 17:30:36.000 |
Context
2000-05-30
| ||
18:45 | loads the complete ACD database! (CVS 17) (check-in: 97a0fb780e user: drh tags: trunk) | |
17:30 | :-) (CVS 16) (check-in: b56d1b9c0f user: drh tags: trunk) | |
16:27 | :-) (CVS 15) (check-in: 8d66c7355d user: drh tags: trunk) | |
Changes
Changes to src/build.c.
︙ | ︙ | |||
20 21 22 23 24 25 26 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains C code routines that are called by the parser ** when syntax rules are reduced. ** | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ************************************************************************* ** This file contains C code routines that are called by the parser ** when syntax rules are reduced. ** ** $Id: build.c,v 1.8 2000/05/30 17:30:36 drh Exp $ */ #include "sqliteInt.h" /* ** This routine is called after a single SQL statement has been ** parsed and we want to execute the code to implement ** the statement. Prior action routines should have already |
︙ | ︙ | |||
1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 | pParse->nErr++; goto copy_cleanup; } v = pParse->pVdbe = sqliteVdbeCreate(pParse->db->pBe); if( v ){ addr = sqliteVdbeAddOp(v, OP_FileOpen, 0, 0, 0, 0); sqliteVdbeChangeP3(v, addr, pFilename->z, pFilename->n); sqliteVdbeAddOp(v, OP_Open, 0, 0, pTab->zName, 0); for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ sqliteVdbeAddOp(v, OP_Open, i, 0, pIdx->zName, 0); } end = sqliteVdbeMakeLabel(v); addr = sqliteVdbeAddOp(v, OP_FileRead, pTab->nCol, end, 0, 0); if( pDelimiter ){ | > | 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 | pParse->nErr++; goto copy_cleanup; } v = pParse->pVdbe = sqliteVdbeCreate(pParse->db->pBe); if( v ){ addr = sqliteVdbeAddOp(v, OP_FileOpen, 0, 0, 0, 0); sqliteVdbeChangeP3(v, addr, pFilename->z, pFilename->n); sqliteVdbeDequoteP3(v, addr); sqliteVdbeAddOp(v, OP_Open, 0, 0, pTab->zName, 0); for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ sqliteVdbeAddOp(v, OP_Open, i, 0, pIdx->zName, 0); } end = sqliteVdbeMakeLabel(v); addr = sqliteVdbeAddOp(v, OP_FileRead, pTab->nCol, end, 0, 0); if( pDelimiter ){ |
︙ | ︙ |
Added test/copy.test.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | # Copyright (c) 1999, 2000 D. Richard Hipp # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Author contact information: # drh@hwaci.com # http://www.hwaci.com/drh/ # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing the COPY statement. # # $Id: copy.test,v 1.1 2000/05/30 17:30:36 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a file of data from which to copy. # set f [open data1.txt w] puts $f "11\t22\t33" puts $f "22\t33\t11" close $f set f [open data2.txt w] puts $f "11\t22\t33" puts $f "\\." puts $f "22\t33\t11" close $f set f [open data3.txt w] puts $f "11\t22\t33\t44" puts $f "22\t33\t11" close $f set f [open data4.txt w] puts $f "11 | 22 | 33" puts $f "22 | 33 | 11" close $f set f [open data5.txt w] puts $f "11|22|33" puts $f "22|33|11" close $f # Try to COPY into a non-existant table. # do_test copy-1.1 { set v [catch {execsql {COPY test1 FROM 'data1.txt'}} msg] lappend v $msg } {1 {no such table: test1}} # Try to insert into sqlite_master # do_test copy-1.2 { set v [catch {execsql {COPY sqlite_master FROM 'data2.txt'}} msg] lappend v $msg } {1 {table sqlite_master may not be modified}} # Do some actual inserts # do_test copy-1.3 { execsql {CREATE TABLE test1(one int, two int, three int)} execsql {COPY test1 FROM 'data1.txt'} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33 22 33 11} # Make sure input terminates at \. # do_test copy-1.4 { execsql {DELETE FROM test1} execsql {COPY test1 FROM 'data2.txt'} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33} # Test out the USING DELIMITERS clause # do_test copy-1.5 { execsql {DELETE FROM test1} execsql {COPY test1 FROM 'data4.txt' USING DELIMITERS ' | '} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33 22 33 11} do_test copy-1.6 { execsql {DELETE FROM test1} execsql {COPY test1 FROM 'data5.txt' USING DELIMITERS '|'} execsql {SELECT * FROM test1 ORDER BY one} } {11 22 33 22 33 11} # Try inserting really long data # set x {} for {set i 0} {$i<100} {incr i} { append x "($i)-abcdefghijklmnopqrstyvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-" } do_test copy-2.1 { execsql {CREATE TABLE test2(a int, x text)} set f [open data21.txt w] puts $f "123\t$x" close $f execsql {COPY test2 FROM 'data21.txt'} execsql {SELECT x from test2} } $x # Cleanup # file delete -force data1.txt data2.txt data3.txt data4.txt data5.txt data21.txt finish_test |