OK, now copy the data line several times, and you'll see there are errors for several lines, unrelated to the final CRLF (which I removed this next sample).

-- data --
"Year","Debt","GDP1","GDP2","RGDP","dRGDP","Infl","debtgdp"
"1833","","49.3275923134","","118.3483703666","","",""
"1833","","49.3275923134","","118.3483703666","","",""
"1833","","49.3275923134","","118.3483703666","","",""
"1833","","49.3275923134","","118.3483703666","","",""
"1833","","49.3275923134","","118.3483703666","","",""
"1833","","49.3275923134","","118.3483703666","","",""
-----------

C:\temp>sqlite3.exe
SQLite version 3.8.0 2013-08-26 04:50:08
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .sep ,
sqlite> .import data tab
data:3: unescaped " character
data:4: unescaped " character
data:5: unescaped " character
data:6: unescaped " character
data:7: unescaped " character
data:2: expected 8 columns but found 43 - extras ignored
sqlite>

-----Original Message----- From: Simon Davies
Sent: Wednesday, August 28, 2013 4:06 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] v3.8 .import misbehaves

On 28 August 2013 13:51,  <[email protected]> wrote:
I did.  I just download the precompiled binaries for Windows, and this is
what I see (for that sample data file):

C:\temp>sqlite3.exe
SQLite version 3.8.0 2013-08-26 04:50:08
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .sep ,
sqlite> .import data tab
data:2: unterminated "-quoted field
sqlite>




I can confirm the behaviour with
C:\>xd -c data.txt
    0: 22 59 65 61 72 22 2C 22  44 65 62 74 22 2C 22 47 | "Year","Debt","G
   10: 44 50 31 22 2C 22 47 44  50 32 22 2C 22 52 47 44 | DP1","GDP2","RGD
   20: 50 22 2C 22 64 52 47 44  50 22 2C 22 49 6E 66 6C | P","dRGDP","Infl
   30: 22 2C 22 64 65 62 74 67  64 70 22 0D 0A 22 31 38 | ","debtgdp".."18
   40: 33 33 22 2C 22 22 2C 22  34 39 2E 33 32 37 35 39 | 33","","49.32759
   50: 32 33 31 33 34 22 2C 22  22 2C 22 31 31 38 2E 33 | 23134","","118.3
   60: 34 38 33 37 30 33 36 36  36 22 2C 22 22 2C 22 22 | 483703666","",""
   70: 2C 22 22 0D 0A                                   | ,""..
C:> sqlite3
SQLite version 3.8.0 2013-08-26 04:50:08
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .sep ,
sqlite>
sqlite> .import data.txt tab
data.txt:2: unterminated "-quoted field

But change file to:

C:\Joinerysoft\Software\sqlite\3_8_0>xd -c data.txt
    0: 22 59 65 61 72 22 2C 22  44 65 62 74 22 2C 22 47 | "Year","Debt","G
   10: 44 50 31 22 2C 22 47 44  50 32 22 2C 22 52 47 44 | DP1","GDP2","RGD
   20: 50 22 2C 22 64 52 47 44  50 22 2C 22 49 6E 66 6C | P","dRGDP","Infl
   30: 22 2C 22 64 65 62 74 67  64 70 22 0D 0A 22 31 38 | ","debtgdp".."18
   40: 33 33 22 2C 22 22 2C 22  34 39 2E 33 32 37 35 39 | 33","","49.32759
   50: 32 33 31 33 34 22 2C 22  22 2C 22 31 31 38 2E 33 | 23134","","118.3
   60: 34 38 33 37 30 33 36 36  36 22 2C 22 22 2C 22 22 | 483703666","",""
   70: 2C 22 22                                         | ,""

(remove trailing newline) and the import works with no errors.

Regards,
Simon
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to