Can't create stored procedure via script

Can't create stored procedure via script

Postby Stevod » Mon 11 Feb 2008 15:18

I am having great problems copying a database SP using the mySQLDump object.

While it works fine when there are no SPs, as soon as I add one, I get the following exception.

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7"

A simple test project which shows the problem is shown below.

Any help would be much appreciated.

Stevod


Imports CoreLab.MySql
Public Class Form1

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim srcSQLAccessor As New xrSQLAccessor("test")


Dim srcSQLdump As New MySqlDump
Try
srcSQLdump.Connection = srcSQLCommand.Connection
srcSQLdump.Connection.Unicode = True
srcSQLdump.Connection.Database = "test"
srcSQLdump.GenerateHeader = True
srcSQLdump.IncludeDatabase = True
srcSQLdump.ExportAll = True
srcSQLdump.Mode = DumpMode.Schema
srcSQLdump.Tables = ""
srcSQLdump.Backup()

Dim Dbname As String = "test"
Dim dstSQLAccessor As New xrSQLAccessor(Dbname)
Dim dstSQLCommand As CoreLab.MySql.MySqlCommand = srcSQLAccessor.Command

dstSQLCommand.CommandText = "DROP DATABASE IF EXISTS `" & DBName & "`;"
dstSQLCommand.ExecuteNonQuery()
dstSQLCommand.CommandText = "CREATE DATABASE IF NOT EXISTS `" & DBName & "`;"
dstSQLCommand.ExecuteNonQuery()

Dim dstSQLdump As New MySqlDump()
dstSQLdump.Connection = New xrSQLAccessor(DBName).Connection
dstSQLdump.Connection.Database = DBName
dstSQLdump.Connection.Unicode = True
dstSQLdump.DumpText = srcSQLdump.DumpText.Replace("test", Dbname)


dstSQLdump.Restore()
Catch ex As Exception
Stop
End Try
End Sub
End Class
Stevod
 
Posts: 6
Joined: Mon 21 Nov 2005 12:53

Postby Alexey.mdr » Mon 11 Feb 2008 15:25

Please send me (alexeyman*crlab*com) your project to reproduce the problem.
It is desirable to use 'test' schema objects, otherwise include the
definition of your own database objects.
Alexey.mdr
 
Posts: 729
Joined: Thu 13 Dec 2007 10:24


Return to dotConnect for MySQL