On Mon, Aug 16, 2010 at 11:53 AM, Peng Yu <pengyu...@gmail.com> wrote:
> Hi,
>
> According to the man page, .mode works only for output mode.
>
>       .mode MODE ?TABLE?     Set output mode where MODE is one of:
>                                csv      Comma-separated values
>                               ......
>
> However, it seems that it works for .import as well (see my example
> below). I'm wondering whether this is the case. If so, should the man
> page be revised to make this clearer? Where I should send the request
> to revise the man page?
>
> $ cat main.sql
> #!/usr/bin/env bash
>
> rm -f main.db
> sqlite3 main.db <<EOF
>
> create table test (id integer primary key, value text);
> insert into test (value) values('eenie a');
> insert into test (value) values('meenie e');
> insert into test (value) values('miny');
> insert into test (value) values('mo');
>
> .output file.csv
> .mode csv
> select * from test;
> .output stdout
>
> EOF
>
> rm -f main.db
> sqlite3 main.db <<EOF
>
> create table test (id integer primary key, value text);
> .mode csv
> .import file.csv test
>
> .headers on
> .mode column
> select * from test;
>
> EOF


I guess that I misunderstood .mode csv. It seems that .import don't
treat double quote specially. So .import only can read file that has
some character (set by .separator) separates different fields?

-- 
Regards,
Peng
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to