[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] system() call in usertag, again... :(


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

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.