Hi, If you could post how it does fail, exactly, maybe we can help ....
Martin jose isaias cabrera wrote: > Ok. That is what I am doing now. Every so often, it fails, for some > reason. It could be a network problem, but I don't think so. Anyway, > thanks for the help. > > josé > > ----- Original Message ----- > From: "Martin Engelschalk" <engelsch...@codeswift.com> > To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org> > Sent: Monday, March 02, 2009 1:14 PM > Subject: Re: [sqlite] INSERTing OR REPLACEing Together or one at a time > > > >> Hi, >> >> it seems to me that between LSOpenProjects and LSOpenSubProjects you >> have a 1:n relationship, and also between LSOpenSubProjects and >> LSOpenJobs. >> Also, it seems that you want to copy data from an attached database "c" >> to the main database. >> So, if you want to preserve this relationship in your main database, you >> have to use one transaction, Command #2, and rollback in case of failure. >> >> Martin >> >> jose isaias cabrera wrote: >> >>> Greetings. >>> >>> which command is safer to use: >>> >>> Command #1: >>> >>> BEGIN; >>> INSERT OR REPLACE INTO LSOpenProjects >>> SELECT * FROM c.LSOpenProjects >>> WHERE ProjID = 2000; >>> COMMIT; >>> BEGIN; >>> INSERT OR REPLACE INTO LSOpenSubProjects >>> SELECT * FROM c.LSOpenSubProjects >>> WHERE ProjID = 2000; >>> COMMIT; >>> BEGIN; >>> INSERT OR REPLACE INTO LSOpenJobs >>> SELECT * FROM c.LSOpenJobs >>> WHERE ProjID = 2000; >>> COMMIT; >>> >>> >>> Command #2: >>> >>> BEGIN; >>> INSERT OR REPLACE INTO LSOpenProjects >>> SELECT * FROM c.LSOpenProjects >>> WHERE ProjID = 2000; >>> INSERT OR REPLACE INTO LSOpenSubProjects >>> SELECT * FROM c.LSOpenSubProjects >>> WHERE ProjID = 2000; >>> INSERT OR REPLACE INTO LSOpenJobs >>> SELECT * FROM c.LSOpenJobs >>> WHERE ProjID = 2000; >>> COMMIT; >>> >>> This latter one is failing every so often. But, it should not matter >>> much, >>> since it is writing to three different tables. I should say that there >>> is >>> always, just one LSOpenProject record; at least, one LSOpenSubProjects >>> records and, at least, one LSOpenJobs record. But 99% of the time, there >>> is >>> always more than one LSOpenJobs. >>> >>> Any ideas? >>> >>> thanks, >>> >>> josé >>> >>> >>> _______________________________________________ >>> 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 >> >> > > _______________________________________________ > 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