Skip to content

Commit

Permalink
MySQLDatabase class now supports latest MySQL 5.1 driver. Closes #55.
Browse files Browse the repository at this point in the history
Also updated to use FLAG_MULTI_STATEMENTS and FLAG_FOUND_ROWS options in the connection string. See reference: http://dev.mysql.com/doc/refman/5.0/en/connector-odbc-configuration-connection-parameters.html
  • Loading branch information
hisystems committed Apr 27, 2012
1 parent 78612df commit 87836cb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Database/MySQLDatabase.vb
Expand Up @@ -11,13 +11,18 @@ Option Explicit On
Public Class MySQLDatabase
Inherits Database

'Flags from http://dev.mysql.com/doc/refman/5.0/en/connector-odbc-configuration-connection-parameters.html
Private Const FLAG_MULTI_STATEMENTS As Integer = 67108864
Private Const FLAG_FOUND_ROWS As Integer = 2
Private Const Options As Integer = FLAG_MULTI_STATEMENTS Or FLAG_FOUND_ROWS

''' <summary>
''' Connects to a MySQL database using the ODBC driver.
''' </summary>
''' <remarks></remarks>
Public Sub New(ByVal strDataSource As String, ByVal strDatabaseName As String, ByVal strUserName As String, ByVal strPassword As String)

MyBase.New("Driver={MySQL}; Server=" & strDataSource & "; Database=" & strDatabaseName & "; UID=" & strUserName & "; PWD=" & strPassword & ";", ConnectionType.MySQL)
MyBase.New("Driver={MySQL ODBC 5.1 Driver}; Server=" & strDataSource & "; Database=" & strDatabaseName & "; UID=" & strUserName & "; PWD=" & strPassword & ";Option=" & Options, ConnectionType.MySQL)

If String.IsNullOrEmpty(strDataSource) Then
Throw New ArgumentNullException("DataSource")
Expand Down

0 comments on commit 87836cb

Please sign in to comment.