On 10/1/12 1:32 PM, "Duquette, William H (318K)"
<william.h.duque...@jpl.nasa.gov> wrote:


>Howdy!
>
>I have some code that does the following:
>
>1. Takes a snapshot of some number of database tables, e.g., saves the
>data from those tables as a text string.
>2. Later, clears the tables and restores their content from the snapshot.
>
>The snapshot is restored by creating a new INSERT statement for each row,
>with the literal column values in it, and evaluating each of these
>statements in sequence.
>
>The tables contain foreign key constraints with "DEFERRABLE INITIALLY
>DEFERRED" specified; thus, I execute all of these INSERTs within a
>transaction so that I won't get spurious constraint failures.
>
>This has been working, but it's slow, so I'm trying to rework the
>algorithm to use queries with variable references.  Then I update the
>variables once for each row, and call the same query over and over again.
> This is much faster...but at the end of the transaction I'm getting a
>foreign key constraint failure.  So far as I can tell, all the data is as
>it should be; and the only difference, so far as I can tell, is that I'm
>now using variables rather than literals.

NULLs.  The old code preserves NULLs, the new code doesn't.

*Never mind.* :-)

Will




>
>Any ideas?
>
>Will
>
>
>--
>Will Duquette -- william.h.duque...@jpl.nasa.gov
>Athena Development Lead -- Jet Propulsion Laboratory
>"It's amazing what you can do with the right tools."
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@sqlite.org
>http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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

Reply via email to