The output is an SQL script, formatted for later insert, so I don't
have access to the return values, and can't use the API.  The update
names table (a temporary table) is used to maintain the current ID's
so that the dependent inserts don't require all the information
leading up to the current insert.  The sql scripts are inserted, one
at a time, in a transaction; each of the scripts has lots and lots of
sql in it (think of a log file).

--Keith


On Fri, 11 Feb 2005 08:15:49 -0500 (EST), Clay Dowling
<[EMAIL PROTECTED]> wrote:
> 
> Keith Herold said:
> > I have a question about how to reset values if an insert fails.  Using
> > the following tables, is there any relatively straightforward way to
> > set LastNameIDInserted to -1 if the UNIQUE constraint on tblNames
> > fails?
> 
> It looks to me like you're trying to put a burden on the database that
> properly belongs in your code.  You'll be able to tell if the insert
> failed by the response code of the sqlite_exec or sqlite_step function
> call.  You'll be able to get the most recent value with
> sqlite_last_insertid, if there was no error condition on your return.
> 
> If you ever need to know what the highest value is for the insertion id
> you can do SELECT MAX(ROWID) FROM myTable;  You shouldn't be trying to
> maintain these keys yourself though.  Let the database do it for you.
> 
> Clay
> --
> Lazarus Notes from Lazarus Internet Development
> http://www.lazarusid.com/notes/
> Articles, Reviews and Commentary on web development
> 


-- 
******************************************************
- Ever notice how 'big' isn't, compared to 'small'?

- Sounds like a Wookie; acts like mad cow.

- I'm not a professional; I just get paid to do this.

- Rules for programming:
   1.  Get it working, right?
   2.  Get it working right.

- Things I've learned about multithreaded programming:

    123...   PPArrvooottieedcc ttm  ueelvvteeirrtyyhtt
rhheiianndgge  dwi hnpi rctohhg eri aslm omscitanalgt 
 iowcbh,je engceltvo ebwrah lip,co hso srci abonlt ehb
.ee^Nr waicscee snsoetd  'aotb jtehcet -slaomcea lt'il
m^Ne from two or more threads
******************************************************

Reply via email to