Re: [sqlite] Recommended method of atomically inserting if data is not present

2008-11-18 Thread Hugh Gibson
> Clients can be referred to by one or more names and so there's > another table: > > CREATE TABLE client_names ( > id integer, > name text > ); > > Names aren't unique. Two clients can have the same name. But the combination of id and name are unique: hence try this: CREATE TABLE

Re: [sqlite] Recommended method of atomically inserting if data is not present

2008-11-18 Thread sqlite
On 20081118 15:25:32, MikeW wrote: > <[EMAIL PROTECTED]> writes: > > Can't make the 'name' column > > 'unique' as two clients may have the same name. Can't make > > the 'id' column 'unique' as a client may have more than one > > name... > > However you can specify that the name/id pair is

Re: [sqlite] Recommended method of atomically inserting if data is not present

2008-11-18 Thread MikeW
<[EMAIL PROTECTED]> writes: Can't make the 'name' column > 'unique' as two clients may have the same name. Can't make > the 'id' column 'unique' as a client may have more than one > name... However you can specify that the name/id pair is unique ... PRIMARY KEY (name, id) Regards, MikeW

[sqlite] Recommended method of atomically inserting if data is not present

2008-11-18 Thread sqlite
I'm working with an application that keeps a list of clients: CREATE TABLE clients ( id integer primary key, fingerprint varchar (40) unique, ... ); Clients are uniquely identified by fingerprint but are referenced by an integer id in most places in the database. Clients can be