Name
Msql::selectdb
Synopsis
$db->selectdb($database);
Msql::selectdb
selects a database from the
database server. If the selection fails, the error is placed in
Msql::errmsg
. The only effective way to test for
the success of this function is to examine the value of
$db->database
and compare it to the database to
which you intended to connect. You may switch databases at any time
during your program.
Example
use Msql; my $db = Msql->connect; $db->selectdb('mydata'); # The database is now 'mydata' if ($db->database ne 'mydata') { warn('AWOOOGA! The database wasn't properly selected!'); } ... $db->selectdb('myotherdata'); # The database is now 'myotherdata'
Get MySQL and mSQL now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.