[ic] system() call in usertag, again... :(
John Young
john_young at sonic.net
Thu Jul 29 04:45:22 EDT 2004
Carsten Jahnke wrote:
> Stefan Hornburg wrote:
>
>> Additionally I doubt
>> that a Perl scripts needs to be use mysqladmin instead of SQL commands.
>>
>> Bye
>> Racke
>
>
> Hi Racke, thanks for your reply. I am no perl or database guru. How can
> I transmit a "CREATE DATABASE..." via DBI when I'm not connected to one?
> The script must create databases dynamically.
This is covered in O'Reilly's Perl DBI book.
For MySQL, a single private method called admin() is supported, providing
a range of functions corresponding to the respective functions of mysqladmin
and msqladmin (as in 'mini'-SQL, which I doubt any of us use):
$rc = $drh->func('createdb', $db, $host, $user, $password, 'admin');
$rc = $drh->func('dropdb', $db, $host, $user, $password, 'admin');
$rc = $drh->func('shutdown', $host, $user, $password, 'admin');
$rc = $drh->func('reload', $host, $user, $password, 'admin');
$rc = $dbh->func('createdb', $database, 'admin');
$rc = $dbh->func('dropdb', $database, 'admin');
$rc = $dbh->func('shutdown', 'admin');
$rc = $dbh->func('reload', 'admin');
Be careful about where you store passwords, of course...
Have fun,
-John Young
More information about the interchange-users
mailing list