开发者

update sqlite table with perl

i have the below perl code to update record on sqlite DB

my $database = 'dbi:SQLite:dbname=my_db.db'; #

my $dbh = DBI->connect($database,"","",{AutoCommit => 1}) || die "Cannot  

connect: $DBI::errstr";



  my $sql = "update  my_table set table_id=51853 where table_id like '%49805%'";

  my $sth = $dbh->prepare( $sql );

 $sth->execute();


  $sth->开发者_JAVA百科;finish;




   $dbh->disconnect();

it seems the code works but the update is not saved on the DB could someone help with this issue ?


Check to see how many rows were updated. Log into the database and try this query to see how many rows would be affected:

SELECT COUNT(*) FROM my_table WHERE table_id LIKE '%49805%';

Also, make sure that you are using the correct database.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜