Archive: execute the .sql scripts ..urgent


execute the .sql scripts ..urgent
HI

I want to execute the .sql scripts in mysql to create the db after installing the mysql s/w.

My code:
SetOutPath "c:\sql"
DetailPrint "coyping server.msi"
File 'C:\proj\testserver.msi'
ExecWait 'C:\WINDOWS\system32\msiexec.exe /qn /i "c:\sql\testserver.msi"'
DetailPrint "coyping my.ini"
SetOutPath "C:\Program Files\MySQL\MySQL Server 5.0\"
File 'C:\my.ini'
nsExec::Exec '"$PROGRAMFILES\MySQL\MySQL Server 5.0\bin\mysqld-nt" --install testsql --defaults-file="$PROGRAMFILES\MySQL\MySQL Server 5.0\my.ini"'
DetailPrint "starting the service"
ExecWait 'NET START testsql' $1
MessageBox MB_OK "start$1"
DetailPrint "executing the scripts"
nsExec::ExecToStack 'cmd /C "$PROGRAMFILES\MySQL\MySQL Server 5.0\bin\mysql.exe" -uroot < "c:\db\Table.txt"'
Pop $0 ; return value
DetailPrint "Schema loading returned $0"


With this i am able to install db and create windows service for the mysql but i am not able to create the database.
when i execute the following

nsExec::ExecToStack 'cmd /C "$PROGRAMFILES\MySQL\MySQL Server 5.0\bin\mysql.exe" -uroot < "c:\db\Table.txt"'
i get the reutrn code as 1 and the database is not getting created.But when i type the same command from cmd window the database is created.

Does anyone know what's going wrong with my script.

Thanks


Might be a good idea to create a batch file with FileOpen, FileWrite and FileClose, and execute that instead.

-Stu