Assumptions : Your database scheme contains this declarations
CREATE TABLE data (
num INTEGER,
di CHAR(4),
data CHAR(12),
time1 INTEGER,
time2 INTEGER,
format CHAR(1)
);
CREATE UNIQUE INDEX i_data ON data (
num, di, time1
);
You want to do :
================
A) Insert or Replace without looking at the previous value if one existed :
***************************************************************************
INSERT OR REPLACE INTO data (num, di, data, time1, time2, format)
VALUES (12, '1290', '732e4a390000', 8323000, 8323255, 22);
B) You want to see if an entry exists read that and edit it manually :
**********************************************************************
in this case it is best to search also for the hidden rowid which
simplifies updates
SELECT rowid, num, di, data, time1, time2, format FROM data
WHERE num=12 AND di='1290' AND time1=8323000 ;
depending on the resultset :
B1) there was a result you'll get as the first column a rowid (lets say
it was 894)then update
UPDATE data SET data='732e4a390000' WHERE rowid=894 ;
B2) there was no result set and you want to insert a new one
INSERT INTO data (num, di, data, time1, time2, format)
VALUES (12, '1290', '732e4a390000', 8323000, 8323255, 22);
Good luck ;)
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users