Donald Griggs ha scritto quanto segue il 16/05/2012 13.24>
Hello, Spora,
Regarding: *I have problem when import with versione superior to 3071000.
No problem with 3071000.*
..\sqlite3 -echo aa_VUOTO.db 0<aa.script
.separator "\t"
.import aa.txt aa
Error: aa line 1744: expected 5 columns of data but found 2
.import aa aa
Error: aa.txt line 82886: expected 9 columns of data but found 5
.exit
==================================
What did you find when you looked closely at lines 1744 and 82886?
1744:
i have the last line as the previous.
I tryed with and without the carriage return but i have this error.
82886:
i have many " unclosed.
do it is possible to bypass the congruity check and import as in
previous version in special cases?
Possibly, you might find some unescaped double quote characters.
My email to the list from 6 days ago describes improvements checked in on
16 January that may be of help.
If this is not relevant, you might want to post a copy of the problem lines
to this list (denoting the tab characters and disguising anything private,
obviously.)
A lot of strange things call themselves csv, but the change attempts to
make the sqlite3 utility's CSV inputs perform a bit more closely to RFC4180.
http://tools.ietf.org/html/rfc4180
http://en.wikipedia.org/wiki/Comma-separated_values#Toward_standardization
In particular, during CSV mode import:
-- Allow any field to be surrounded by double quotecharacters without
those characters being considered part of the field data.
-- Allow fields to contain embedded commas (or other separators) when the
field is surrounded by double quotecharacters.
-- Allow fields to span multiple lines if they are surrounded by double
quote characters.
-- Allow the double quote character to be escaped by having two adjacent
double quote characters. (But note that a field consisting solely of two
double quote characters still represents an empty string field.)
-- On output in CSV mode, surround text fields with double quotes when
needed.
See check-in [93aa17d866] http://www.sqlite.org/src/info/93aa17d866
(By the way, I believe the sqlite3 command line utility (CLI) was intended
to be more of a debug tool than a production component -- but it surely is
useful!)
For an example of CSV import, if I have file MyStuff.csv whose data is
shown below between the barred lines below (words in square brackets [] are
just my comments and were not present in the import file):
==============================
1,cat
2,"rat" [quotes are optional unless separator(s)
embedded]
3 ,"grey fox" [extra whitespace will be handled differently
when affinity is numeric]
4, spacedog [There's a space before and after spacedog --
trust me]
5,o'possum
6,"big, bad, wolf"
7,"two-lined [Fields can span lines]
zebra"
8, [Second field empty. (Maybe I forgot to type
"Missing lynx")]
9,imperial ("laughing") loon
==============================
Now I create a test database.
C:\util>sqlite3 test.db
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> /* Define a simple table t, comprised of an integer column and a
text column */
sqlite> Create table t ( id integer, animal);
sqlite> /* import the data above using csv mode */
sqlite> .mode csv
sqlite> .import MyStuff.csv t
sqlite> /* Show the table in CSV mode
sqlite> select * from t;
1,cat
2,rat
3,"grey fox"
4," spacedog "
5,"o'possum"
6,"big, bad, wolf"
7,"two-lined
zebra"
8,""
9,"imperial (""laughing"") loon"
sqlite>
sqlite>
sqlite>
sqlite> /* Try changing the separator and show it again in LIST mode */
sqlite> .separator |
sqlite> .mode list
sqlite> select * from t;
1|cat
2|rat
3|grey fox
4| spacedog
5|o'possum
6|big, bad, wolf
7|two-lined
zebra
8|
9|imperial ("laughing") loon
sqlite>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
autenticato? GRATIS solo con Email.it http://www.email.it/f
Sponsor:
Speciale ponte del 2 Giugno a Cesenatico all'Hotel Gallia: Pacchetto 2 giorni:
Euro 154; Pacchetto 3 giorni: Euro 231. Pensione completa, servizio spiaggia,
bevande ai pasti
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=12343&d=16-5
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users