Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Perl: Find the number of rows affected by a SQL query

Perl: Find the number of rows affected by a SQL query
{filelink=14658}

#!/usr/bin/perl
use warnings;
use strict;
use DBI;
# Create a connection to MySQL Database
my $db_connect = DBI->connect('dbi:mysql:Customers',
								'user',
								'password',
								 {RaiseError => 1, AutoCommit => 0 });
 # Delete rows from the table
my $rows = $db_connect->do("DELETE FROM Useras WHERE Sales<='2000€'");
if (! defined $rows)
{
  print "Error deleting";
} else
{
  # Display the number of rows deleted
  print "$rows row(s) deleted";
}

Users who found this page were searching for:

  • python dictionary loop
  • python compare strings
  • how to define python suboutines
  • python change entry in dictionary
  • perl number of rows in file

No comments yet.

Leave a Comment