Re: how to use mysql client source filename command through DBI/DBD

2004-10-19 Thread gerald_clark

Sanjeev Sagar wrote:
Hello All,
I am trying to create a perl DBI/DBD script for creating a database initial build. My input is a extract file, which is a mysqldump result file with --opt and -B option. 

I am using DBIx::DWIW. I am able to open a successful database handler. I am having 
code like
my $dropsql=DROP DATABASE $ARGV[1];
my $loadsql=source /tmp/extract-file-name;
Source is a command built into the mysql client program, not the server.
You will have to write a perl subroutine that accomplishes the same task.
You may use 'system' to run  the mysql client.
print Running database load...\n;
$conn-Execute($dropsql);
RC=$?
die Error running in $dropsql...\n if ( RC != 0 );
$conn-Execute($loadsql);
RC=$?
die Error in running $loadsql...\n if (RC != 0);
It appears that $loadsql is not going through. It is able to drop database but not running 
source command at all. I have tried by using \. extract-file-name, still no luck.
Looks to me that I am not doing it right way. Any help will be highly appreciated.
Regards,

 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


how to use mysql client source filename command through DBI/DBD

2004-10-18 Thread Sanjeev Sagar
Hello All,
 
I am trying to create a perl DBI/DBD script for creating a database initial build. My 
input is a extract file, which is a mysqldump result file with --opt and -B option. 
 
I am using DBIx::DWIW. I am able to open a successful database handler. I am having 
code like
 
my $dropsql=DROP DATABASE $ARGV[1];
my $loadsql=source /tmp/extract-file-name;
 
print Running database load...\n;
 
$conn-Execute($dropsql);
RC=$?
die Error running in $dropsql...\n if ( RC != 0 );
 
$conn-Execute($loadsql);
RC=$?
die Error in running $loadsql...\n if (RC != 0);
 
 
It appears that $loadsql is not going through. It is able to drop database but not 
running source command at all. I have tried by using \. extract-file-name, still no 
luck.
 
Looks to me that I am not doing it right way. Any help will be highly appreciated.
 
Regards,