On Thu, Mar 19, 2009 at 12:01 PM, jose isaias cabrera
<[email protected]> wrote:
>
> Greetings...
>
> I am updating an sqlite db from another sqlite db and it is working fine,
> unless the record does not exists.  ie.
>
>    "ATTACH db2 AS client; ";
>
>    BEGIN;
>    INSERT OR REPLACE INTO LSOpenJobs
>          SELECT * FROM client.LSOpenJobs
>            WHERE login='x' AND XtraB > '2000';
>    COMMIT;
>
> this works fine if the record already exists in the db getting updated.
> However, if the record was deleted, inadvertively, from the db getting
> updated, this will not work.
>
> Is there a way to insert the record back in the db getting updated if it is
> not there?  You should know that this record did exists previously in this
> db, but it was deleted.


José, you didn't communicate the above very well, because the above
sentence makes no sense whatsoever. If you are still in a transaction
and delete something that you didn't mean to, you can always bring it
back by not committing the transaction.

If you have already committed the transaction or were not in a
transaction to begin with, then you could rely on a backup.

Did you say you didn't have a backup? Well, you are out of luck then.
How would the database know what to bring back?

You could do one other thing -- not delete a record when a user
"deletes" it... instead, mark it for deletion, and then never show it
to the user. But, that is another story.


>
> This is the CREATE table schema:
> CREATE TABLE LSOpenJobs
>        (
>         id integer primary key,
>         ProjID integer,
>         login,
>         ...,
>         XtraB,
>         XtraC,
>         XtraD,
>         XtraE,
>         XtraF
>        );
>
> Thanks for the help,
>
> josé
>
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Puneet Kishor http://www.punkish.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Carbon Model http://carbonmodel.org/
Open Source Geospatial Foundation http://www.osgeo.org/
Sent from: Madison WI United States.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to