Hello,
I have a query about my use of DBI and using it with sqlite3
I have the following code and wonder if anyone knows if it will be safe to use
I am wanting to get the rows from the database and then put them into another database (I lie - I'm putting them into a google spreadsheet)
Then I want to delete the data that I've put into the google spreadsheet from the original database
My worry is that, between me selecting and processing the records, someone may have added another row which I then delete without processing
What I'm hoping is that any additions will be queued up until I've disconnected and that there is not a window opened up between my selecting and deleting where someone would be allowed to add anything new
My question is: am I ok or am I asking for trouble?
Thanks for any light that can be shone on this
MorayJ
my $dbh = DBI->connect( # connect to your database, create if "dbi:SQLite:dbname=$dbfile", # DSN: dbi, driver, database file "", # no user "", # no password { RaiseError => 1 }, # complain if something goes wrong ) or die $DBI::errstr; my $search = $dbh->prepare('SELECT * FROM addresses '); my $delete = $dbh->prepare('DELETE FROM addresses'); my $rc = $search->execute or die $search->errstr; while ( my @row = $search->fetchrow_array() ) { print @row[0] . "\n"; }; my $rc2 = $delete->execute or die $sth->errstr; $dbh->disconnect;
In reply to DBI and sqlite concurrency by MorayJ
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |