Hi,
  I'm having problem inserting one record into a table that has Foreign Key
constraint, whereas I can succeed with the same SQL statement in command
line to the same table.
 Though I found I can bypass this problem by not including the FK in my c++
code at all.  I'd still like to know the reason.
 My SQL statement in c++ before being prepared is as below:
  Insert into sometable
(name,l_id,_id,mxrp,status,cnt,ts,metadata,slug,ctype,FK_id,cdate) VALUES
(?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12)

 And the real statement after passed the prepare API is like this:
  INSERT INTO sometable
(name,l_id,_id,mxrp,status,cnt,ts,metadata,slug,ctype,FK_id,cdate) VALUES
('test','','c05f1e6f37bd8641b7d18892','13000','','0','1311744399','','','2','','Wed
Jul 27 12:06:02 CST 2011');

And the above statement worked well in command line for me to the same
table, but failed with the error message of "constraint failed" from
sqlite_errmsg(). Also that I don't have the constraint of NOT NULL in my
FK_id column, which means that the value of empty string to the column of
FK_id should not cause problem as how it acted in command line. Plus I'm
using the xxxx_v2 version of APIs to open connection and prepare statement.

Any idea is very appreciated in advance.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to