disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting)
The following code which grabs data from MySQL gets executed successfully, but will cause Apache to generate the above message in its error log:
my $driver = "mysql";
my $server = "localhost:3306";
my $database = "test";
my $url = "DBI:$driver:$database:$server";
my $user = "apache";
my $password = "";
#Connect to database
my $db_handle = DBI->connect( $url, $user, $password )
or die $DBI::errstr;
#SQL query to execute
my $sql = "SELECT * FROM tests WHERE id=?";
#Prepare SQL query
my $statement = $db_handle->prepare($sql)
or die "Couldn't prepare query '$sql': $DBI::errstr\n";
#Execute SQL Query
$statement->execute($idFromSomewhere)
or die "Couldn't execute query '$sql': $DBI::errstr\n";
#Get query results as hash
my $results = $statement->fetchall_hashref('id');
$db_handle->disconnect();
Will there be any dire consequences by ignoring the said error/warning? The code has been running for a week without any ill effects.
Is there anything wrong with the code or is this just a harmless warning?
Edit
Code is executed via mod_perl.