Re: [sqlite] detect a flaw

2011-03-24 Thread Shalom Elkin
Igor, Well, libversion is 3003006 Ok. Now I'll start looking for a reason I am using an older library... Thanks, Shalom On Thu, Mar 24, 2011 at 3:51 PM, Igor Tandetnik wrote: > Shalom Elkin wrote: > > I use 3.7.5 , and Linux (centos). > >

Re: [sqlite] detect a flaw

2011-03-24 Thread Igor Tandetnik
Shalom Elkin wrote: > I use 3.7.5 , and Linux (centos). Consider using sqlite3_libversion to confirm that. It's possible that more than one sqlite version is installed on the system, and you are linking to the wrong one. Your code looks OK (except that in "pragma

Re: [sqlite] detect a flaw

2011-03-24 Thread Shalom Elkin
I use 3.7.5 , and Linux (centos). On Thu, Mar 24, 2011 at 12:56 PM, BareFeetWare wrote: > On 24/03/2011, at 4:41 PM, Shalom Elkin wrote: > > > Sorry - it doesn't work. > > sqlite3_exec with the pragma directive returns no error, but the

Re: [sqlite] detect a flaw

2011-03-24 Thread BareFeetWare
On 24/03/2011, at 4:41 PM, Shalom Elkin wrote: > Sorry - it doesn't work. > sqlite3_exec with the pragma directive returns no error, but the program > still agrees to insert a record that violates foreign_key constraint. What version of SQLite are you using? I think

Re: [sqlite] detect a flaw

2011-03-24 Thread Shalom Elkin
I am ready to rebuild sqlite3 with the foreign_key support enabled as default. to do this, I should UNDEFINE SQLITE_OMIT_FOREIGN_KEY. I can't find a decent way to do this undef. I use g++ on linux. Thanks, Shalom On Thu, Mar 24, 2011 at 7:41 AM, Shalom Elkin wrote: >

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
Sorry - it doesn't work. sqlite3_exec with the pragma directive returns no error, but the program still agrees to insert a record that violates foreign_key constraint. Here is the tables creation == CREATE TABLE people( id integer, nm text); INSERT INTO "people"

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
All, I have done exactly like BareFeetWare suggested. The referential integrity "feature" is a no brainer for "serious" systems, where you do care about your data consistency. SQL doesn't have clauses where you declare where do you want Erroneous records to go. This is usually mandated to tools

Re: [sqlite] detect a flaw

2011-03-23 Thread BareFeetWare
On 24/03/2011, at 2:50 AM, Shalom Elkin wrote: > I appreciate the input. Some of the advice comes obviously from very good > and talented people who find a challenge at doing things WITHOUT reverting > to code writing. Doing as much (or most often, all) of the logic in SQL (instead of

Re: [sqlite] detect a flaw

2011-03-23 Thread Igor Tandetnik
On 3/23/2011 11:50 AM, Shalom Elkin wrote: > what is the API equivalent of > > PRAGMA foreign_keys = ON; It's a SQL statement like any other. You can run it with sqlite3_exec, for example -- Igor Tandetnik ___ sqlite-users mailing list

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
All, I appreciate the input. Some of the advice comes obviously from very good and talented people who find a challenge at doing things WITHOUT reverting to code writing. I did a small program. Current show -stopper : what is the API equivalent of PRAGMA foreign_keys = ON; If I can not turn

Re: [sqlite] detect a flaw

2011-03-23 Thread BareFeetWare
On 23/03/2011, at 9:03 PM, Shalom Elkin wrote: > I am new to SQLITE. Here's the challenge: > > sqlite> .dump > BEGIN TRANSACTION; > CREATE TABLE people( >id integer, >nm text); > INSERT INTO "people" VALUES(1,'Jack'); > INSERT INTO "people" VALUES(2,'Jill'); > CREATE TABLE

Re: [sqlite] detect a flaw

2011-03-23 Thread Shalom Elkin
Thanks, guys. i was afraid of the "Do it yourself". Im doing a small specialized version, to be generalized later ... Shalom On Wed, Mar 23, 2011 at 3:41 PM, Igor Tandetnik wrote: > On 3/23/2011 8:42 AM, Simon Slavin wrote: > > On 23 Mar 2011, at 11:27am, Igor Tandetnik

Re: [sqlite] detect a flaw

2011-03-23 Thread Igor Tandetnik
On 3/23/2011 8:42 AM, Simon Slavin wrote: > On 23 Mar 2011, at 11:27am, Igor Tandetnik wrote: >> Shalom Elkin wrote: >>> id 3 doesn't exist, the insertion fails. Now, this was easy. what if >>> ac.inhad millions of rows? I am looking for some way to get a message >>> like

Re: [sqlite] detect a flaw

2011-03-23 Thread Simon Slavin
On 23 Mar 2011, at 11:27am, Igor Tandetnik wrote: > Shalom Elkin wrote: >> id 3 doesn't exist, the insertion fails. Now, this was easy. what if >> ac.inhad millions of rows? I am looking for some way to get a message >> like "error >> in line 3: foreign key mismatch". >

Re: [sqlite] detect a flaw

2011-03-23 Thread Igor Tandetnik
Shalom Elkin wrote: > id 3 doesn't exist, the insertion fails. Now, this was easy. what if > ac.inhad millions of rows? I am looking for some way to get a message > like "error > in line 3: foreign key mismatch". Write a program that parses the file, runs INSERT statement