-C :-)\s(CVS\s15)
-D 2000-05-30T16:27:04
+C :-)\s(CVS\s16)
+D 2000-05-30T17:30:36
F COPYRIGHT 74a8a6531a42e124df07ab5599aad63870fa0bd4
F Makefile.in 89921c1ee4de75275bfadfbac198396da31704d1
F README 6b5960603c7f8bf42fc022b4b6436f242f238dbb
F configure 00a5b5c82147a576fa6e82d7c1b0d55c321d6d2c x
F configure.in 6ccfd5fc80517f7cfe605a7fc7e0f62d962a233c
F doc/lemon.html e233a3e97a779c7a87e1bc4528c664a58e49dd47
-F src/build.c 971796c068b8ae25b476f924e5e0da0b57adb9e6
+F src/build.c 82e7dfdf900428d706ab4f50e72732ce9110767a
F src/dbbe.c ab05293e89525041eaab8b4aca10516db3648792
F src/dbbe.h bedeb3a0985bb584458e7849fb59927e99e751e6
F src/main.c 25cce7bce0eb3ba10bada7c05f4b38dc6dbbc86f
F src/vdbe.h 03de26632f2e608c2a44a40262fbba21a8bdfd81
F src/where.c be3973952e9bb5d2bb0bc5523b03f5d1f9e9d6f9
F test/all.test 66a8a5b8291a472157944edcdce51a320ebd1f35
+F test/copy.test 641bd3cfaab61c4ee32889587e21e4c70788a97a
F test/delete.test 814d53e3b0d2d7069fb17e005d4041454d6585d4
F test/expr.test 11e00880d2de0f60ff1ba7fdd4e09a0d72a01910
F test/index.test 8d4f26901a5582daa353fe3c8266cbf4a53af830
F www/c_interface.tcl f875864edf7974157d1c257ca08de854660882a5
F www/index.tcl 2466d1b2e26c6f354b0acedee12025309a216799
F www/sqlite.tcl 947e067bcc347dc767af4c1a6e5a8d47d8404aa3
-P 1bb8ee8d9f1d3c409a11910e7552e4bb5e7f5f87
-R 0bda635e569bcbbf1f49ce4a3f5d3df9
+P 8d66c7355de1d87b25c4fb92d0ef3603da72899a
+R d80f9589af9e1517c7c756c7ca40c0f1
U drh
-Z 1c759b788ddf2200404a81ace8a2be6e
+Z 0d13d400c7a8e0dc46e87c85f7c6e1d5
** This file contains C code routines that are called by the parser
** when syntax rules are reduced.
**
-** $Id: build.c,v 1.7 2000/05/30 16:27:04 drh Exp $
+** $Id: build.c,v 1.8 2000/05/30 17:30:36 drh Exp $
*/
#include "sqliteInt.h"
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);
--- /dev/null
+# 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