-C UPDATE\striggers\son\sTEMP\stables\swere\sbroken.\s(CVS\s693)
-D 2002-07-21T23:09:55
+C Fix\sfor\sticket\s#71:\sCorrectly\shandle\sCR\sand\sCRLF\sline\sterminators\sin\sthe\ninput\sfiles\sfor\sthe\sCOPY\scommand.\s(CVS\s694)
+D 2002-07-30T17:20:40
F Makefile.in 6291a33b87d2a395aafd7646ee1ed562c6f2c28c
F Makefile.template 4e11752e0b5c7a043ca50af4296ec562857ba495
F README a4c0ba11354ef6ba0776b400d057c59da47a4cc0
F src/select.c a43eabfc2e3e4d67660027f016889935f706deab
F src/shell.c 37a8405aec5740726c4ee18826c1ff5fd2c29b96
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
-F src/sqlite.h.in 75c5bbb066d0faf34424b7d1babf8b44d5b31af2
-F src/sqliteInt.h a7a088cd9e69e9dbefe0fdfe411bb6387b50f384
+F src/sqlite.h.in d3999a9c6374675779058d6cfe5431131618e92b
+F src/sqliteInt.h d0a54982e1eb01f9b05aa9329e8d569acb0996ea
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c c502819c209011659e1bbb428cbac5670cce7f79
F src/test1.c 456cb080db85056be723e770435d9509afc3a83a
F src/trigger.c d88ab4d68d68955c217b38fb6717e090fbbf54a4
F src/update.c f07e6ed2c517c92871e54d3f5886d1cf56121b11
F src/util.c 7a99e754c44dd220e881122e30581c08b6d6adef
-F src/vdbe.c 7433a7811fbbb7cfec4f12c142913b4d8a02231e
+F src/vdbe.c b35ea5d6af6c4649d6cda171d326352ff616875d
F src/vdbe.h a9292f2b5fcecef924fa255fb74609e9cbc776c2
F src/where.c 6a43aa6c80eab12221eeca754cba852a9ecd1e13
F test/all.test f296d27fff6aca72348af15092154f879d1fc7d4
F test/btree2.test e3b81ec33dc2f89b3e6087436dfe605b870c9080
F test/btree3.test 9caa9e22491dd8cd8aa36d7ac3b48b089817c895
F test/conflict.test 4518cc3c1c40c4ba74220d9ee814257ae7d09c47
-F test/copy.test 92e21ebea11319c3f70448d3763fdaa0e2f1c21f
+F test/copy.test 55d60a4d5ed342a0fa08b7cd07d46d43ea0d0d7f
F test/delete.test 5821a95a66061ae09723a88938f23d10d8a881ad
F test/expr.test 5fadd0bc87c223b424ce6752b576c1df346abf1f
F test/func.test cae5f27e09736cfdcc978c3719ac1345405b848c
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 610b7bc70a12b271994255bd01a76b3525421535
-R 8d04659c9e44b4da98d3cabd50c7863c
-U danielk1977
-Z 554b81b4d4eac0c4e8ece2aa3bada3ab
+P c080ed01ea51628b86050762f097e702e3aeafdf
+R 2c19fd10fe86bd88ef844a3055d315b5
+U drh
+Z e835230fdc0a66edc7f339264e4e0fbb
-c080ed01ea51628b86050762f097e702e3aeafdf
\ No newline at end of file
+be1315755ef801b5ec07f469134e0d33a3ece990
\ No newline at end of file
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.33 2002/06/25 19:31:18 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.34 2002/07/30 17:20:40 drh Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
char **errmsg, /* Error msg written here */
va_list ap /* Arguments to the format string */
);
+char *sqlite_mprintf(const char*,...);
/*
** Windows systems should call this routine to free memory that
*************************************************************************
** Internal interface definitions for SQLite.
**
-** @(#) $Id: sqliteInt.h,v 1.140 2002/07/19 17:46:39 drh Exp $
+** @(#) $Id: sqliteInt.h,v 1.141 2002/07/30 17:20:40 drh Exp $
*/
#include "sqlite.h"
#include "hash.h"
void sqliteBeginTransaction(Parse*, int);
void sqliteCommitTransaction(Parse*);
void sqliteRollbackTransaction(Parse*);
-char *sqlite_mprintf(const char *, ...);
int sqliteExprIsConstant(Expr*);
int sqliteExprIsInteger(Expr*, int*);
int sqliteIsRowid(const char*);
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
-** $Id: vdbe.c,v 1.165 2002/07/18 00:34:12 drh Exp $
+** $Id: vdbe.c,v 1.166 2002/07/30 17:20:40 drh Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
# define VERIFY(X) X
#endif
+/*
+** The following routine works like a replacement for the standard
+** library routine fgets(). The difference is in how end-of-line (EOL)
+** is handled. Standard fgets() uses LF for EOL under unix, CRLF
+** under windows, and CR under mac. This routine accepts any of these
+** character sequences as an EOL mark. The EOL mark is replaced by
+** a single LF character in zBuf.
+*/
+static char *vdbe_fgets(char *zBuf, int nBuf, FILE *in){
+ int i, c;
+ for(i=0; i<nBuf-1 && (c=getc(in))!=EOF; i++){
+ zBuf[i] = c;
+ if( c=='\r' || c=='\n' ){
+ if( c=='\r' ){
+ zBuf[i] = '\n';
+ c = getc(in);
+ if( c!=EOF && c!='\n' ) ungetc(c, in);
+ }
+ i++;
+ break;
+ }
+ }
+ zBuf[i] = 0;
+ return i>0 ? zBuf : 0;
+}
+
/*
** Execute the program in the VDBE.
**
}
p->zLine = zLine;
}
- if( fgets(&p->zLine[n], p->nLineAlloc-n, p->pFile)==0 ){
+ if( vdbe_fgets(&p->zLine[n], p->nLineAlloc-n, p->pFile)==0 ){
eol = 1;
p->zLine[n] = 0;
}else{
# This file implements regression tests for SQLite library. The
# focus of this file is testing the COPY statement.
#
-# $Id: copy.test,v 1.11 2002/06/25 13:16:04 drh Exp $
+# $Id: copy.test,v 1.12 2002/07/30 17:20:41 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
puts $f "11|22|33"
puts $f "22|33|11"
close $f
+set f [open dataX.txt w]
+puts -nonewline $f "11|22|33\r"
+puts -nonewline $f "22|33|44\r\n"
+puts -nonewline $f "33|44|55\n"
+puts -nonewline $f "44|55|66\r"
+puts -nonewline $f "55|66|77\r\n"
+puts -nonewline $f "66|77|88\n"
+close $f
# Try to COPY into a non-existant table.
#
}
} {0}
-integrity_check copy-6.0
+do_test copy-6.1 {
+ execsql {
+ PRAGMA count_changes=off;
+ CREATE TABLE t2(a,b,c);
+ COPY t2 FROM 'dataX.txt' USING DELIMITERS '|';
+ SELECT * FROM t2;
+ }
+} {11 22 33 22 33 44 33 44 55 44 55 66 55 66 77 66 77 88}
+
+integrity_check copy-7.1
# Cleanup
#
-file delete -force data1.txt data2.txt data3.txt data4.txt data5.txt data6.txt
+file delete -force data1.txt data2.txt data3.txt data4.txt data5.txt \
+ data6.txt dataX.txt
finish_test