Re: [sqlite] problem with sqlite3_exec() and select sql statemant
Use the correct SQL delimiter for a literal - single quotes, e.g. 'google.com'. Hari wrote: > Hi as i am new to sqlite. > I have problem when i am using sqlite3_exec() function with select > as i am using sqlite3_open() to opening database > then creating table and inserting some information using sqlite3_exec() > and 'create table' and 'insert into' > then again if i use sqlite3_exec() with select like > my sql statement is : select * from my_table where > Primarykey="google.com" > where google.com primary key and its related information is not already > in my table but it is returning > SQLITE_OK...even it must be return some error as that primary key is not > in my table. > .how should i get the error...when using select and if primary key will > not be there ..after creating table with using sqlite3_exec() function + > select sql statemant. > > Thanks in advance for any ideas > Harioum > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] problem with sqlite3_exec() and select sql statemant
Hello Hariom, - use single quotes around text constants: select * from my_table where Primarykey='google.com' - use sqlite3_prepare and sqlite3_step to select data. First call sqlite3_prepare for your statement and then sqlite3_step in al loop until it returns SQLITE_DONE - It is not an error if a select statement returns no rows because of a where clause. In this case, the first call to sqlite3_stepreturns SQLITE_DONE Martin Hari schrieb: > Hi as i am new to sqlite. > I have problem when i am using sqlite3_exec() function with select > as i am using sqlite3_open() to opening database > then creating table and inserting some information using sqlite3_exec() > and 'create table' and 'insert into' > then again if i use sqlite3_exec() with select like > my sql statement is : select * from my_table where > Primarykey="google.com" > where google.com primary key and its related information is not already > in my table but it is returning > SQLITE_OK...even it must be return some error as that primary key is not > in my table. > .how should i get the error...when using select and if primary key will > not be there ..after creating table with using sqlite3_exec() function + > select sql statemant. > > Thanks in advance for any ideas > Harioum > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- * Codeswift GmbH * Traunstr. 30 A-5026 Salzburg-Aigen Tel: +49 (0) 8662 / 494330 Mob: +49 (0) 171 / 4487687 Fax: +49 (0) 12120 / 204645 [EMAIL PROTECTED] www.codeswift.com / www.swiftcash.at Codeswift Professional IT Services GmbH Firmenbuch-Nr. FN 202820s UID-Nr. ATU 50576309 ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] problem with sqlite3_exec() and select sql statemant
Hi as i am new to sqlite. I have problem when i am using sqlite3_exec() function with select as i am using sqlite3_open() to opening database then creating table and inserting some information using sqlite3_exec() and 'create table' and 'insert into' then again if i use sqlite3_exec() with select like my sql statement is : select * from my_table where Primarykey="google.com" where google.com primary key and its related information is not already in my table but it is returning SQLITE_OK...even it must be return some error as that primary key is not in my table. .how should i get the error...when using select and if primary key will not be there ..after creating table with using sqlite3_exec() function + select sql statemant. Thanks in advance for any ideas Harioum ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users