""Severin Müller"" <severin.muel...@gmx.net> wrote
in message news:20090327084050.24...@gmx.net
> I wam writing a program where i need some data.
>
> I try to dynamically create a database for this. All my data are
> stored in a struct, resp. several structs. What I need now, is to
> know, whether it's possible to check every row I'm submitting for
> existance, like:
>
> row1: data1 data2 data3 data4
> row2: data1 data2 data3 data4
>
> If the column "data1" already exists in the table, i want to update
> the row, if there is now row with "data1" i want to insert a new one.
>
> Is INSERT OR REPLACE something i may want to look at?

Yes. It would require that the first column (the one where "data1" goes) 
have a UNIQUE constraint (either explicitly, or as part of a UNIQUE 
index, or by virtue of being a PRIMARY KEY). Then INSERT OR REPLACE 
would do precisely what you want.

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to