Hello
I am just beginning my thorn-ridden way up the steep slope with SQLite and
C++ to keep me company. And i am stuck at one point, so if you could help me
to continue it would be awsome.
I have a database contaning a table with a layout like this:
NAME PART1 PART2
blob blob blob
blob blob blob
... ... ...
I am thinking of creating it like:
CREATE TABLE points (NAME blob unique, PART1 blob, PART2 blob);
Then, in a loop, i will obtain new blob tuples and insert them in my table:
INSERT INTO points VALUES(?,?,?); // using prepare statement and bind
blob
Then comes a tricky bit:
1) If there is a tuple with same NAME ( SQL error: column name is not
unique) already,
2) I want to fetch its components PART1 and PART2
SELECT PART1, PART2 FROM points WHERE NAME = ?;
// using prepare statement and bind blob
The problem is, i dont know how to *DETECT* a collision gracefully.
I first thought of looking at an error code, but i am not sure its a good
idea. Then
I heard somewhere about a thing called TRIGGERS, but still i am not sure, if
thats
the easiest way.
So, basically, how do you detect duplicates and handle them how you consider
appropriate?
Thanks,
Eugene
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users