Dan Brown <[EMAIL PROTECTED]> said:

Another option would be to use the perl DBI module.  The dbd::mysql DBI 
drivers contains a fairly wide array of mysqladmin functions via the admin
() method call.  To create a table or tables, the following code could be 
used:

#Attach modules
use DBI;
use strict;

#Set DBI for manual error handling
my %dbiAttr = (
               PrintError => 0,
               RaiseError => 0
              );

#Open a connection to mysql
my $dbh = DBI->connect( "dbi:mysql:databasename", "username", "password",\
%dbiAttr) || die $DBI::errstr;

#Prepare SQL statement
my $sth = $dbh->prepare("CREATE TABLE table1 (
                         key int(10) NOT NULL ,
                         field1 char(5),
                         PRIMARY KEY(key))") || die $DBI::errstr

#Execute SQL statment
$sth->execute() || die $DBI::errstr;

#Close mysql connection
$sth->finish;
$dbh->disconnect;

This is a pretty basic example, but works none the less.  As long as have 
the appropriate username and password, you're set.


Regards,


-- 
Greg J. Zartman, P.E.
Vice-President

Logging Engineering International, Inc.
1243 West 7th Avenue
Eugene, Oregon 97402
541-683-8383    fax 541-683-8144


--
Please report bugs to [EMAIL PROTECTED]
Please mail [EMAIL PROTECTED] (only) to discuss security issues
Support for registered customers and partners to [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Archives by mail and http://www.mail-archive.com/devinfo%40lists.e-smith.org

Reply via email to