Q&D answer in PERL!
my ($file);
$file = 'database_names';
$cmd = qq!show databases;!;
open O, ">cmd" or die "could open cmd - $!";
print O "$cmd\n";
close O;
system ("mysql -uusername -ppassword < cmd > $file")
== 0 or die "could not do system - $!";
open I, "<$file" or die "could not open $file - $!";
while (<I>){
print "$_";
}
close I;
-----Original Message-----
From: Bernd Prager [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 2:33 PM
To: Sarah Killcoyne; [EMAIL PROTECTED]
Subject: Re: Perl DBI or C++ API Help!
----- Original Message -----
From: "Sarah Killcoyne" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 03, 2002 11:14 AM
> I need to be able to connect to mysql through a perl or C++ script without
> knowing the name of the database to connect to.
,,,
I'm not an expert om the C++ API. But if the host is a UNIX system
you can do a RSH command in C++ as well as in Perl.
"mysql -u username 'show databases;'"
Maybe there's a better solution, but in worst case this would do it.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php