This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- creating and calling stored procedures of mysql from installshield 2010
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 18, 2011
07:11 AM
creating and calling stored procedures of mysql from installshield 2010
hi
How to create a stored procedure and call the created stored procedure(via script) of MYSQL from installshiled.
thanks in advance..
How to create a stored procedure and call the created stored procedure(via script) of MYSQL from installshiled.
thanks in advance..
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Jul 21, 2011
07:01 AM
Hi hcl_60
You can use LaunchAppAndWait:
Below i have a .sql file that i would like to run,
in my case i use SQL osql Command line:
osql -S\ -U -P
You would need to know the mysql command line:
LaunchAppAndWait("\"" + MSDETARGETLOCATION + "\\binn" + "\\osql.exe\""," -S (local)\\SL -U sa -P -i \"" + TARGETDIR ^ "\\TestProc.sql\" -o \"" + TARGETDIR ^ "\\TestProc.log\"",WAIT);
If you want, you can create your stored procedure dynamically or just have the file ready to use with the command, but the following code will create the stored procedure dynamically and execute it:
// Create the stored proc
OpenFileMode( FILE_MODE_NORMAL );
CreateFile( nvFilehandle, TARGETDIR", "TestProc.sql" );
WriteLine( nvFilehandle, "CREATE PROCEDURE [dbo].[TestProc]" );
WriteLine( nvFilehandle, "@ColName as sysname")
WriteLine( nvFilehandle, "AS")
WriteLine( nvFilehandle, "DECLARE @STR AS VARCHAR(200)");
WriteLine( nvFilehandle, "SET @STR = " select count(*) from " + @TableName + " where " + @ColName + " is not null");
WriteLine( nvFilehandle, "EXEC (@STR)");
WriteLine( nvFilehandle, "GO");
CloseFile (nvFilehandle);
// Launch the stored procedure
LaunchAppAndWait("\"" + MSDETARGETLOCATION + "\\binn" + "\\osql.exe\""," -S (local)\\SL -U sa -P -i \"" + TARGETDIR ^ "\\TestProc.sql\" -o \"" ^ "\\TestProc.log\"",WAIT);
You can use LaunchAppAndWait:
Below i have a .sql file that i would like to run,
in my case i use SQL osql Command line:
osql -S
You would need to know the mysql command line:
LaunchAppAndWait("\"" + MSDETARGETLOCATION + "\\binn" + "\\osql.exe\""," -S (local)\\SL -U sa -P -i \"" + TARGETDIR ^ "\\TestProc.sql\" -o \"" + TARGETDIR ^ "\\TestProc.log\"",WAIT);
If you want, you can create your stored procedure dynamically or just have the file ready to use with the command, but the following code will create the stored procedure dynamically and execute it:
// Create the stored proc
OpenFileMode( FILE_MODE_NORMAL );
CreateFile( nvFilehandle, TARGETDIR", "TestProc.sql" );
WriteLine( nvFilehandle, "CREATE PROCEDURE [dbo].[TestProc]" );
WriteLine( nvFilehandle, "@ColName as sysname")
WriteLine( nvFilehandle, "AS")
WriteLine( nvFilehandle, "DECLARE @STR AS VARCHAR(200)");
WriteLine( nvFilehandle, "SET @STR = " select count(*) from " + @TableName + " where " + @ColName + " is not null");
WriteLine( nvFilehandle, "EXEC (@STR)");
WriteLine( nvFilehandle, "GO");
CloseFile (nvFilehandle);
// Launch the stored procedure
LaunchAppAndWait("\"" + MSDETARGETLOCATION + "\\binn" + "\\osql.exe\""," -S (local)\\SL -U sa -P -i \"" + TARGETDIR ^ "\\TestProc.sql\" -o \"" ^ "\\TestProc.log\"",WAIT);