Re: [sqlite] escape quote for csv import
Hi > (There is no official CSV standard, and there is no widely supported escaping > mechanism.) Refer to RFC4180 for CSV standard. Steve Martin Technical Lead NEC New Zealand Limited NEC House, Level 6, 40 Taranaki Street, PO Box 1936, Wellington 6140, New Zealand T: 043816291 M: 0293816291 F: +644380 steve.mar...@nec.co.nz nz.nec.com Please consider the environment before printing this email Attention: The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination, copying or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies. NEC has no liability for any act or omission in reliance on the email or any attachment. Before opening this email or any attachment(s), please check them for viruses. NEC is not responsible for any viruses in this email or any attachment(s); any changes made to this email or any attachment(s) after they are sent; or any effects this email or any attachment(s) have on your network or computer system. - ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Determine if UPDATE has worked.
Simon Slavin wrote: >On 22 Jul 2009, at 12:40am, Steve Martin wrote: > > > >>$ fred testdb "create table bob(p1 text PRIMARY KEY, p2 text)" >>SQLITE_DONE: 101 : unknown error >> >> > >You do know this, and all your subsequent commands, will fail if you >still have your data in here from the last test, don't you ? > > > > Hi Simon, Yes I do. I am more use to working with postgres and oracle. I am just getting a feel on how sqlite works and what happens when errors occurs. Steve ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Determine if UPDATE has worked.
Hi List, I am new to sqlite and having trouble determining if an update has worked. I am using the C/C++ API. For an update, when sqlite3_step is executed it returns SQLITE_DONE when a record is updated or if a record does not exist. I have not found an answer by reading and searching the documentation and searching the internet This is the same for the command line tool. Using code based on "http://www.sqlite.org/cvstrac/wiki?p=SimpleCode; $ fred testdb "create table bob(p1 text PRIMARY KEY, p2 text)" SQLITE_DONE: 101 : unknown error $ fred testdb "insert into bob (p1, p2) values('foo', 'sue')" SQLITE_DONE: 101 : unknown error $ fred testdb "insert into bob (p1, p2) values('foo', 'sue')" Error: 19 : constraint failed $ fred testdb "update bob set p2 = 'fred' where p1 = 'foo'" SQLITE_DONE: 101 : unknown error <-- update ok $ fred testdb "update bob set p2 = 'fred' where p1 = 'fo1'" SQLITE_DONE: 101 : unknown error <-- update fail $ fred testdb "select count(*) from bob" count(*) = 1 SQLITE_DONE: 101 : unknown error $ fred testdb "select * from bob" p1 = foo p2 = fred SQLITE_DONE: 101 : unknown error $ When using the command line tool. SQLite version 3.6.16 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table bob(p1 text PRIMARY KEY, p2 text); sqlite> .header on sqlite> .show echo: off explain: off headers: on mode: list nullvalue: "" output: stdout separator: "|" width: sqlite> update bob set p2 = 'fred' where p1 = 'foo'; sqlite> insert into bob (p1, p2, p3) values('foo', 'sue', 'todd'); SQL error: table bob has no column named p3 sqlite> insert into bob (p1, p2) values('foo', 'sue'); sqlite> select * from bob; p1|p2 foo|sue sqlite> update bob set p2 = 'fred' where p1 = 'foo'; sqlite> select * from bob; p1|p2 foo|fred sqlite> update bob set p2 = 'fred' where p1 = 'fo1'; sqlite> Thanks Steve ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Determine if UPDATE has worked.
Pavel Ivanov wrote: >Did you look into this: http://www.sqlite.org/c3ref/changes.html ? > >Pavel > >On Tue, Jul 21, 2009 at 7:57 PM, Steve Martin<steve.mar...@nec.co.nz> wrote: > > >>Hi List, >> >>I am new to sqlite and having trouble determining if an update has worked. >> >>I am using the C/C++ API. >> >>For an update, when sqlite3_step is executed it returns SQLITE_DONE when >>a record is updated or if a record does not exist. I have not found an >>answer by reading and searching the documentation and searching the >>internet >> >>This is the same for the command line tool. >> >>Using code based on "http://www.sqlite.org/cvstrac/wiki?p=SimpleCode; >> >>$ fred testdb "create table bob(p1 text PRIMARY KEY, p2 text)" >>SQLITE_DONE: 101 : unknown error >>$ fred testdb "insert into bob (p1, p2) values('foo', 'sue')" >>SQLITE_DONE: 101 : unknown error >>$ fred testdb "insert into bob (p1, p2) values('foo', 'sue')" >>Error: 19 : constraint failed >>$ fred testdb "update bob set p2 = 'fred' where p1 = 'foo'" >>SQLITE_DONE: 101 : unknown error <-- update ok >>$ fred testdb "update bob set p2 = 'fred' where p1 = 'fo1'" >>SQLITE_DONE: 101 : unknown error <-- update fail >>$ fred testdb "select count(*) from bob" >>count(*) = 1 >>SQLITE_DONE: 101 : unknown error >>$ fred testdb "select * from bob" >>p1 = foo >>p2 = fred >>SQLITE_DONE: 101 : unknown error >>$ >> >>When using the command line tool. >>SQLite version 3.6.16 >>Enter ".help" for instructions >>Enter SQL statements terminated with a ";" >>sqlite> create table bob(p1 text PRIMARY KEY, p2 text); >>sqlite> .header on >>sqlite> .show >> echo: off >> explain: off >> headers: on >> mode: list >>nullvalue: "" >> output: stdout >>separator: "|" >>width: >>sqlite> update bob set p2 = 'fred' where p1 = 'foo'; >>sqlite> insert into bob (p1, p2, p3) values('foo', 'sue', 'todd'); >>SQL error: table bob has no column named p3 >>sqlite> insert into bob (p1, p2) values('foo', 'sue'); >>sqlite> select * from bob; >>p1|p2 >>foo|sue >>sqlite> update bob set p2 = 'fred' where p1 = 'foo'; >>sqlite> select * from bob; >>p1|p2 >>foo|fred >>sqlite> update bob set p2 = 'fred' where p1 = 'fo1'; >>sqlite> >> >> >>Thanks >>Steve >> >> >> >> Hi Pavel, Thanks for the info, that works for me. Steve ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Determine if UPDATE has worked.
Hi List, I am new to sqlite and having trouble determining if an update has worked. I am using the C/C++ API. For an update, when sqlite3_step is executed it returns SQLITE_DONE when a record is updated or if a record does not exist. I have not found an answer by reading and searching the documentation and searching the internet This is the same for the command line tool. Using code based on "http://www.sqlite.org/cvstrac/wiki?p=SimpleCode; $ fred testdb "create table bob(p1 text PRIMARY KEY, p2 text)" SQLITE_DONE: 101 : unknown error $ fred testdb "insert into bob (p1, p2) values('foo', 'sue')" SQLITE_DONE: 101 : unknown error $ fred testdb "insert into bob (p1, p2) values('foo', 'sue')" Error: 19 : constraint failed $ fred testdb "update bob set p2 = 'fred' where p1 = 'foo'" SQLITE_DONE: 101 : unknown error <-- update ok $ fred testdb "update bob set p2 = 'fred' where p1 = 'fo1'" SQLITE_DONE: 101 : unknown error <-- update fail $ fred testdb "select count(*) from bob" count(*) = 1 SQLITE_DONE: 101 : unknown error $ fred testdb "select * from bob" p1 = foo p2 = fred SQLITE_DONE: 101 : unknown error $ When using the command line tool. SQLite version 3.6.16 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> create table bob(p1 text PRIMARY KEY, p2 text); sqlite> .header on sqlite> .show echo: off explain: off headers: on mode: list nullvalue: "" output: stdout separator: "|" width: sqlite> update bob set p2 = 'fred' where p1 = 'foo'; sqlite> insert into bob (p1, p2, p3) values('foo', 'sue', 'todd'); SQL error: table bob has no column named p3 sqlite> insert into bob (p1, p2) values('foo', 'sue'); sqlite> select * from bob; p1|p2 foo|sue sqlite> update bob set p2 = 'fred' where p1 = 'foo'; sqlite> select * from bob; p1|p2 foo|fred sqlite> update bob set p2 = 'fred' where p1 = 'fo1'; sqlite> Thanks Steve ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users