|
|
@@ -1,79 +1,131 @@
|
|
|
* MySQL Data Provider
|
|
|
|
|
|
+ <p>There are two ADO.NET providers in Mono
|
|
|
+ for a <a href="http://www.mysql.com/">MySQL</a> database:
|
|
|
+
|
|
|
<ul>
|
|
|
- <li>MySQL Data Provider for
|
|
|
- <a href="http://www.mysql.com/">MySQL</a> databases. It is written in C# and uses
|
|
|
- the MySQL C Client Library</li>
|
|
|
+ <li><a href="http://sourceforge.net/projects/mysqlnet/">ByteFX.Data.MySQLClient</a>
|
|
|
+ <ul>
|
|
|
+ <li>Written in 100% C#</li>
|
|
|
+ <li>Does not require a client library</li>
|
|
|
+ <li>Works on Mono and Microsoft .NET</li>
|
|
|
+ <li>Requires at least Mono 0.18 and MySQLNet 0.65 for it to work on Mono</li>
|
|
|
+ <li>Works in the SQL# command-line and GTK# GUI version</li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
|
|
|
- <li>Exists in namespace Mono.Data.MySql and assembly Mono.Data.MySql</li>
|
|
|
-
|
|
|
- <li>Works on Windows and Linux via the MySQL client shared library
|
|
|
- (libmySQL.dll on Windows and libmysqlclient.so on Linux).</li>
|
|
|
-
|
|
|
- <li>Started by Daniel Morgan using
|
|
|
- <a href="http://www.cybercom.net/~zbrad/DotNet/MySql/">C# Bindings to MySQL</a> from <a href="mailto:[email protected]">Brad Merill</a>
|
|
|
-
|
|
|
- <li><a href="http://www.mysql.com/articles/dotnet/">Exploring MySQL in the Microsoft .NET Environment</a> is an article
|
|
|
- by Mr. Venu who is a MySQL AB developer.</li>
|
|
|
-
|
|
|
- <li>There is a good alternative to the provider in Mono:
|
|
|
+ <li>Mono.Data.MySql (deprecated)
|
|
|
<ul>
|
|
|
- <li><a href="http://sourceforge.net/projects/mysqlnet/">MySQLNet</a> from ByteFX
|
|
|
- is a MySQL Managed provider written in 100% C#,
|
|
|
- does not require a client library, and works on Microsoft .NET and Mono. You
|
|
|
- need at least Mono 0.18 and MySQLNet 0.65 for it to work on Mono. MySQLNet
|
|
|
- works in the SQL# command-line and GTK# GUI version</li>
|
|
|
+ <li>Deprecated in favor of ByteFX.Data.MySQLClient
|
|
|
+
|
|
|
+ <li>Written in C# and uses
|
|
|
+ the MySQL C Client Library</li>
|
|
|
|
|
|
+ <li>Exists in namespace Mono.Data.MySql and assembly Mono.Data.MySql</li>
|
|
|
+
|
|
|
+ <li>Works on Windows and Linux via the MySQL client shared library
|
|
|
+ (libmySQL.dll on Windows and libmysqlclient.so on Linux).</li>
|
|
|
+
|
|
|
+ <li>Started by Daniel Morgan using
|
|
|
+ <a href="http://www.cybercom.net/~zbrad/DotNet/MySql/">C# Bindings to MySQL</a> from <a href="mailto:[email protected]">Brad Merill</a></li>
|
|
|
</ul>
|
|
|
- </li>
|
|
|
- <li>Testing for Mono's Mono.Data.MySql and ByteFX's ByteFX.Data.MySQLClient is below...</li>
|
|
|
+ </li>
|
|
|
+
|
|
|
</ul>
|
|
|
+
|
|
|
+ <p><a href="http://www.mysql.com/articles/dotnet/">Exploring MySQL
|
|
|
+ in the Microsoft .NET Environment</a> is an article
|
|
|
+ by Mr. Venu who is a MySQL AB developer.</li>
|
|
|
+
|
|
|
+ <p>Testing for Mono's Mono.Data.MySql and ByteFX's ByteFX.Data.MySQLClient is below.
|
|
|
|
|
|
** Current Status
|
|
|
|
|
|
+ Current Status of the MySQL providers:
|
|
|
+
|
|
|
<ul>
|
|
|
- <li>can connect
|
|
|
+
|
|
|
+ <li>ByteFX.Data.MySQLClient
|
|
|
+ <ul>
|
|
|
+ <li>Build and Runs on Microsoft .NET and Mono</li>
|
|
|
+ <li>Works with SQL# (command-line and GTK# GUI versions)</li>
|
|
|
+ <li>MySQLCommandBuilder now implemented</li>
|
|
|
+ <li>Transaction support now implemented (not all table types support this)</li>
|
|
|
+ <li>GetSchemaTable fixed to not use xsd (for Mono)</li>
|
|
|
+ <li>Driver is now Mono-compatible</li>
|
|
|
+ <li>TIME data type now supported</li>
|
|
|
+ <li>More work to improve Timestamp data type handling</li>
|
|
|
+ <li>Changed signatures of all classes to match corresponding SqlClient classes</li>
|
|
|
+ <li>Protocol compression using <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/default.asp">SharpZipLib</a></li>
|
|
|
+ <li>Named pipes on Windows now working properly</li>
|
|
|
+ <li>Work done to improve Timestamp data type handling</li>
|
|
|
+ <li>Implemented IEnumerable on DataReader so DataGrid would work</li>
|
|
|
+ <li>Speed increased dramatically by removing bugging network sync code</li>
|
|
|
+ <li>Driver no longer buffers rows of data (more ADO.Net compliant)</li>
|
|
|
+ <li>Conversion bugs related to TIMESTAMP and DATETIME fields fixed</li>
|
|
|
+
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
|
|
|
- <li>can execute non-queries via ExecuteNonQuery()
|
|
|
+ <li>Mono.Data.MySql (deprecated)
|
|
|
+ <ul>
|
|
|
+ <li>can connect</li>
|
|
|
+
|
|
|
+ <li>can execute non-queries via ExecuteNonQuery()</li>
|
|
|
|
|
|
- <li>can execute aggregates via ExecuteScalar() and retrieve the
|
|
|
- single row/single column result
|
|
|
+ <li>can execute aggregates via ExecuteScalar() and retrieve the
|
|
|
+ single row/single column result</li>
|
|
|
|
|
|
- <li>can execute queries and retrieve results using a data reader.
|
|
|
+ <li>can execute queries and retrieve results using a data reader.</li>
|
|
|
|
|
|
- <li>a schema DataTable has been partially
|
|
|
- implemented which is returned from GetSchemaTable() in MySqlDataReader.
|
|
|
+ <li>a schema DataTable has been partially
|
|
|
+ implemented which is returned from GetSchemaTable() in MySqlDataReader.</li>
|
|
|
|
|
|
- <li>a DataTable in a DataSet can be filled via a MySqlDataAdapter
|
|
|
+ <li>a DataTable in a DataSet can be filled via a MySqlDataAdapter</li>
|
|
|
|
|
|
- <li>The shared client libraries
|
|
|
- between windows version and linux are different: windows has libmySQL.dll
|
|
|
- while linux has libmysqlclient.so. This is handled by the
|
|
|
- file etc/mono/config which is mapped by the mono runtime in knowing
|
|
|
- which native shared library to load. In cvs, this file is mono/config.in and
|
|
|
- can be modified with a text editor.
|
|
|
+ <li>The shared client libraries
|
|
|
+ between windows version and linux are different: windows has libmySQL.dll
|
|
|
+ while linux has libmysqlclient.so. This is handled by the
|
|
|
+ file etc/mono/config which is mapped by the mono runtime in knowing
|
|
|
+ which native shared library to load. In cvs, this file is mono/config.in and
|
|
|
+ can be modified with a text editor.</li>
|
|
|
+
|
|
|
+ <li>Works in the SQL# command-line and GTK# GUI version</li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
|
|
|
- <li>Works in the SQL# command-line and GTK# GUI version</li>
|
|
|
</ul>
|
|
|
|
|
|
** Action plan
|
|
|
|
|
|
-The current plan to work on the MySQL data provider:
|
|
|
-
|
|
|
- <ul>
|
|
|
- <li>Parameters support via MySqlParameter and MySqlParameterCollection
|
|
|
-
|
|
|
- <li>Support LOBs (Large Object)
|
|
|
-
|
|
|
- <li>Change the MySQL provider to not be dependent on a client library and
|
|
|
- be written in 100% C#
|
|
|
-
|
|
|
- <li>Connection pooling
|
|
|
-
|
|
|
- <li>Get the provider to work like other data providers
|
|
|
- </ul>
|
|
|
+ The current plan for the MySQL data providers:
|
|
|
+
|
|
|
+ <ul>
|
|
|
+ <li>ByteFX.Data.MySQLClient
|
|
|
+ <ul>
|
|
|
+ <li>Testing and fixes</li>
|
|
|
+ <li>Implement missing features</li>
|
|
|
+ <li>Only fixes for bugs to build and run MySQLClient on Mono
|
|
|
+ will be accepted in mono-cvs. Most bugs and any new features will
|
|
|
+ go into sourceforge cvs. Anytime there is a release of MySQLClient,
|
|
|
+ the source code will be copied from sourceforge cvs to mono-cvs</li>
|
|
|
+ <li>Releases of MySQLClient are determined by Reggie Burnett and releases
|
|
|
+ of Mono are determined by Miguel de Icaza</li>
|
|
|
+ <li>Implement any missing features or fix any bugs in Mono to get new
|
|
|
+ features all of MySQLClient to work on Mono</li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+ <li>Mono.Data.MySql (deprecated)
|
|
|
+ <ul>
|
|
|
+ <li>Testing and bug fixes</li>
|
|
|
+ <li>Mono.Data.MySql is deprecated and therefore maybe removed
|
|
|
+ at a later date. It will stay in Mono for now because other
|
|
|
+ programs maybe using it now.</li>
|
|
|
+ </ul>
|
|
|
+ </li>
|
|
|
+</ul>
|
|
|
|
|
|
-** Testing for Mono's MySQL provider (Mono.Data.MySql)
|
|
|
+** Testing for MySQLNet provider (ByteFX.Data.MySQLClient)
|
|
|
|
|
|
<ul>
|
|
|
<li>Have access to a MySQL database or download it from
|
|
|
@@ -82,26 +134,28 @@ The current plan to work on the MySQL data provider:
|
|
|
</ul>
|
|
|
</li>
|
|
|
|
|
|
- <li>Take a look at MySqlTest.cs in mcs/class/Mono.Data.MySql/Test</li>
|
|
|
+ <li>MySQLNet can be gotten from <a href="http://sourceforge.net/projects/mysqlnet/">here</a> and the
|
|
|
+ binary assembly ByteFX.Data.dll needs to be installed
|
|
|
+ in the same place as the mono class libraries.</li>
|
|
|
+
|
|
|
+ <li>MySQLNet requires <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/default.asp">SharpZipLib</a> which is
|
|
|
+ a Zip Library written in 100% C#. This is used for compression/decompression of data
|
|
|
+ sent/received over the network. The SharpZipLib binary assembly SharpZipLib.dll should
|
|
|
+ be installed in the same place as the mono class libraries.</li>
|
|
|
|
|
|
<li>Has a ConnectionString format:
|
|
|
<pre>
|
|
|
- "Server=hostname;" +
|
|
|
- "Database=database;" +
|
|
|
- "User ID=username;" +
|
|
|
- "Password=password"
|
|
|
- (or)
|
|
|
- "host=hostname;" +
|
|
|
- "dbname=database;" +
|
|
|
- "user=username;" +
|
|
|
- "passwd=password"
|
|
|
+"Server=hostname;" +
|
|
|
+"Database=database;" +
|
|
|
+"User ID=username;" +
|
|
|
+"Password=password"
|
|
|
</pre>
|
|
|
-
|
|
|
+ </li>
|
|
|
<li>C# Example:
|
|
|
<pre>
|
|
|
using System;
|
|
|
using System.Data;
|
|
|
- using Mono.Data.MySql;
|
|
|
+ using ByteFX.Data.MySQLClient;
|
|
|
|
|
|
public class Test
|
|
|
{
|
|
|
@@ -113,7 +167,7 @@ The current plan to work on the MySQL data provider:
|
|
|
"User ID=myuserid;" +
|
|
|
"Password=mypassword;";
|
|
|
IDbConnection dbcon;
|
|
|
- dbcon = new MySqlConnection(connectionString);
|
|
|
+ dbcon = new MySQLConnection(connectionString);
|
|
|
IDbCommand dbcmd = dbcon.CreateCommand();
|
|
|
// requires a table to be created named employee
|
|
|
// with columns firstname and lastname
|
|
|
@@ -122,15 +176,15 @@ The current plan to work on the MySQL data provider:
|
|
|
// firstname varchar(32),
|
|
|
// lastname varchar(32));
|
|
|
string sql =
|
|
|
- "SELECT firstname, lastname " +
|
|
|
- "FROM employee";
|
|
|
+ "SELECT firstname, lastname " +
|
|
|
+ "FROM employee";
|
|
|
dbcmd.CommandText = sql;
|
|
|
IDataReader reader = dbcmd.ExecuteReader();
|
|
|
while(reader.Read()) {
|
|
|
string FirstName = reader["firstname"];
|
|
|
string LastName = reader["lastname"];
|
|
|
Console.WriteLine("Name: " +
|
|
|
- FirstName + " " + LastName);
|
|
|
+ FirstName + " " + LastName);
|
|
|
}
|
|
|
// clean up
|
|
|
reader.Close();
|
|
|
@@ -148,9 +202,8 @@ The current plan to work on the MySQL data provider:
|
|
|
<li>Save the example to a file, such as, TestExample.cs</li>
|
|
|
<li>Build on Linux:
|
|
|
<pre>
|
|
|
- mcs TestExample.cs \
|
|
|
- -r System.Data.dll \
|
|
|
- -r Mono.Data.MySql.dll
|
|
|
+ mcs TestExample.cs -r System.Data.dll \
|
|
|
+ -r ByteFX.Data.dll
|
|
|
</pre>
|
|
|
</li>
|
|
|
<li>Build on Windows via Cygwin:
|
|
|
@@ -158,8 +211,7 @@ The current plan to work on the MySQL data provider:
|
|
|
mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
|
|
|
TestExample.cs \
|
|
|
-lib:C:/cygwin/home/MyHome/mono/install/lib \
|
|
|
- -r System.Data.dll \
|
|
|
- -r Mono.Data.MySql.dll
|
|
|
+ -r System.Data.dll -r ByteFX.Data.dll
|
|
|
</pre>
|
|
|
</li>
|
|
|
</ul>
|
|
|
@@ -172,7 +224,7 @@ mono TestExample.exe
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
-** Testing for MySQLNet provider (ByteFX.Data.MySQLClient)
|
|
|
+** Testing for Mono's MySQL provider (Mono.Data.MySql)
|
|
|
|
|
|
<ul>
|
|
|
<li>Have access to a MySQL database or download it from
|
|
|
@@ -181,28 +233,27 @@ mono TestExample.exe
|
|
|
</ul>
|
|
|
</li>
|
|
|
|
|
|
- <li>MySQLNet can be gotten from <a href="http://sourceforge.net/projects/mysqlnet/">here</a> and the
|
|
|
- binary assembly ByteFX.Data.dll needs to be installed
|
|
|
- in the same place as the mono class libraries.</li>
|
|
|
-
|
|
|
- <li>MySQLNet requires <a href="http://www.icsharpcode.net/OpenSource/SharpZipLib/default.asp">SharpZipLib</a> which is
|
|
|
- a Zip Library written in 100% C#. This is used for compression/decompression of data
|
|
|
- sent/received over the network. The SharpZipLib binary assembly SharpZipLib.dll should
|
|
|
- be installed in the same place as the mono class libraries.</li>
|
|
|
+ <li>Take a look at MySqlTest.cs in mcs/class/Mono.Data.MySql/Test</li>
|
|
|
+ <li>On Linux, you may need to make a symbolic link from libmySQL.dll to libmysqlclient.dll</li>
|
|
|
|
|
|
<li>Has a ConnectionString format:
|
|
|
<pre>
|
|
|
-"Server=hostname;" +
|
|
|
-"Database=database;" +
|
|
|
-"User ID=username;" +
|
|
|
-"Password=password"
|
|
|
+ "Server=hostname;" +
|
|
|
+ "Database=database;" +
|
|
|
+ "User ID=username;" +
|
|
|
+ "Password=password"
|
|
|
+ (or)
|
|
|
+ "host=hostname;" +
|
|
|
+ "dbname=database;" +
|
|
|
+ "user=username;" +
|
|
|
+ "passwd=password"
|
|
|
</pre>
|
|
|
- </li>
|
|
|
+
|
|
|
<li>C# Example:
|
|
|
<pre>
|
|
|
using System;
|
|
|
using System.Data;
|
|
|
- using ByteFX.Data.MySQLClient;
|
|
|
+ using Mono.Data.MySql;
|
|
|
|
|
|
public class Test
|
|
|
{
|
|
|
@@ -214,7 +265,7 @@ mono TestExample.exe
|
|
|
"User ID=myuserid;" +
|
|
|
"Password=mypassword;";
|
|
|
IDbConnection dbcon;
|
|
|
- dbcon = new MySQLConnection(connectionString);
|
|
|
+ dbcon = new MySqlConnection(connectionString);
|
|
|
IDbCommand dbcmd = dbcon.CreateCommand();
|
|
|
// requires a table to be created named employee
|
|
|
// with columns firstname and lastname
|
|
|
@@ -223,15 +274,15 @@ mono TestExample.exe
|
|
|
// firstname varchar(32),
|
|
|
// lastname varchar(32));
|
|
|
string sql =
|
|
|
- "SELECT firstname, lastname " +
|
|
|
- "FROM employee";
|
|
|
+ "SELECT firstname, lastname " +
|
|
|
+ "FROM employee";
|
|
|
dbcmd.CommandText = sql;
|
|
|
IDataReader reader = dbcmd.ExecuteReader();
|
|
|
while(reader.Read()) {
|
|
|
string FirstName = reader["firstname"];
|
|
|
string LastName = reader["lastname"];
|
|
|
Console.WriteLine("Name: " +
|
|
|
- FirstName + " " + LastName);
|
|
|
+ FirstName + " " + LastName);
|
|
|
}
|
|
|
// clean up
|
|
|
reader.Close();
|
|
|
@@ -249,8 +300,9 @@ mono TestExample.exe
|
|
|
<li>Save the example to a file, such as, TestExample.cs</li>
|
|
|
<li>Build on Linux:
|
|
|
<pre>
|
|
|
- mcs TestExample.cs -r System.Data.dll \
|
|
|
- -r ByteFX.Data.dll
|
|
|
+ mcs TestExample.cs \
|
|
|
+ -r System.Data.dll \
|
|
|
+ -r Mono.Data.MySql.dll
|
|
|
</pre>
|
|
|
</li>
|
|
|
<li>Build on Windows via Cygwin:
|
|
|
@@ -258,7 +310,8 @@ mono TestExample.exe
|
|
|
mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
|
|
|
TestExample.cs \
|
|
|
-lib:C:/cygwin/home/MyHome/mono/install/lib \
|
|
|
- -r System.Data.dll -r ByteFX.Data.dll
|
|
|
+ -r System.Data.dll \
|
|
|
+ -r Mono.Data.MySql.dll
|
|
|
</pre>
|
|
|
</li>
|
|
|
</ul>
|
|
|
@@ -270,4 +323,3 @@ mono TestExample.exe
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
-
|