开发者

update sqlite table with perl

开发者 https://www.devze.com 2023-03-28 19:21 出处:网络
i have the below perl code to update record on sqlite DB my $database = \'dbi:SQLite:dbname=my_db.db\'; #

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

精彩评论

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