Add additional backslash escapes to the COPY command for compatibility

with PostgreSQL.  Ticket #460. (CVS 1104)

FossilOrigin-Name: 70a50bdda318f353c8be1ba200f9aedc34642c93
This commit is contained in:
drh 2003-09-27 00:56:31 +00:00
parent 562528c480
commit 3775084a75
4 changed files with 32 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Do\sall\sWHERE\sclauses\stests,\seven\sif\san\sindex\sis\sused\sfor\slookup\sso\sthat\nwe\sknow\sthe\stest\scannot\sbe\sFALSE.\s\sThe\stest\smight\send\sup\sbeing\sNULL\sin\swhich\ncase\sit\swould\sneed\sto\sbe\streated\sas\sfalse.\s\sTicket\s#461.\s(CVS\s1103)
D 2003-09-27T00:41:28
C Add\sadditional\sbackslash\sescapes\sto\sthe\sCOPY\scommand\sfor\scompatibility\nwith\sPostgreSQL.\s\sTicket\s#460.\s(CVS\s1104)
D 2003-09-27T00:56:32
F Makefile.in ab585a91e34bc33928a1b6181fa2f6ebd4fb17e1
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -61,7 +61,7 @@ F src/trigger.c 474581eaab388233df01bb019e558af2965decbf
F src/update.c 24260b4fda00c9726d27699a0561d53c0dccc397
F src/util.c f16efa2d60bfd4e31ae06b07ed149557e828d294
F src/vacuum.c e4724eade07e4cf8897060a8cf632dbd92408eeb
F src/vdbe.c 4570d4361838327f45aa3788034e108c048b4d3f
F src/vdbe.c a9923a38a24ee86dd2e237c9f7e9d0116e329394
F src/vdbe.h 3957844e46fea71fd030e78f6a3bd2f7e320fb43
F src/vdbeInt.h 2824bf88895b901b3a8c9e44527c67530e1c0dcb
F src/vdbeaux.c 1145fa169021d7fb3962fab6e99f5f8fc2608f8a
@ -81,7 +81,7 @@ F test/btree4.test fa955a3d7a8bc91d6084b7f494f9e5d1bdfb15b6
F test/btree4rb.test ae6f0438512edcb45cf483471cd6070a765963a9
F test/capi2.test ec96e0e235d87b53cbaef3d8e3e0f8ccf32c71ca
F test/conflict.test 0911bb2f079046914a6e9c3341b36658c4e2103e
F test/copy.test cfd2e9cd738081d9c0a3977acd9e4d0538afde84
F test/copy.test 88dabd4e811b17644b726aa81d404e73b7635c84
F test/delete.test 92256384f1801760180ded129f7427884cf28886
F test/expr.test 48bc6400627532ec97e233809e33d336468bc84c
F test/fkey1.test d65c824459916249bee501532d6154ddab0b5db7
@ -173,7 +173,7 @@ F www/speed.tcl 2f6b1155b99d39adb185f900456d1d592c4832b3
F www/sqlite.tcl 3c83b08cf9f18aa2d69453ff441a36c40e431604
F www/tclsqlite.tcl b9271d44dcf147a93c98f8ecf28c927307abd6da
F www/vdbe.tcl 9b9095d4495f37697fd1935d10e14c6015e80aa1
P 4bb256ee3ecd44d71d90556e16bb56c0389fd5b5
R c6afe2445864efb925570f28ec556288
P 5aea81488b2d3bcdc009ccf0f0ffcda046e38d79
R 26781a0b0fc1fd1d9abd211114ab21da
U drh
Z e801647f10cab2f01f8d94808db9306f
Z 5212ee3a64fc51376d349d4fdd45cba4

View File

@ -1 +1 @@
5aea81488b2d3bcdc009ccf0f0ffcda046e38d79
70a50bdda318f353c8be1ba200f9aedc34642c93

View File

@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.240 2003/09/06 22:18:08 drh Exp $
** $Id: vdbe.c,v 1.241 2003/09/27 00:56:32 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@ -4125,7 +4125,17 @@ case OP_FileRead: {
}
while( z[from] ){
if( z[from]=='\\' && z[from+1]!=0 ){
z[to++] = z[from+1];
int tx = z[from+1];
switch( tx ){
case 'b': tx = '\b'; break;
case 'f': tx = '\f'; break;
case 'n': tx = '\n'; break;
case 'r': tx = '\r'; break;
case 't': tx = '\t'; break;
case 'v': tx = '\v'; break;
default: break;
}
z[to++] = tx;
from += 2;
continue;
}

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this file is testing the COPY statement.
#
# $Id: copy.test,v 1.15 2003/08/05 13:13:39 drh Exp $
# $Id: copy.test,v 1.16 2003/09/27 00:56:33 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -158,6 +158,17 @@ do_test copy-3.2 {
}
} {1 {hello
world} 2 {hello world}}
do_test copy-3.3 {
set fd [open data6.txt w]
puts $fd "1:hello\\b\\f\\n\\r\\t\\vworld"
puts $fd "2:hello world"
close $fd
execsql {
DELETE FROM t1;
COPY t1 FROM 'data6.txt' USING DELIMITERS ':';
SELECT * FROM t1 ORDER BY a;
}
} [list 1 "hello\b\f\n\r\t\vworld" 2 "hello world"]
# Test the embedded NULL logic.
#