[Mono-list] RE: [Mono] MySQL Managed Provider
Piers Haken
piersh@friskit.com
Thu, 23 Jan 2003 02:57:15 -0800
This is a multi-part message in MIME format.
------_=_NextPart_001_01C2C2CE.3073715E
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
I would consider NOT prefixing the types with 'My' since they're already
in a separate namespace and porting user code from one provider to
another will be much simpler if most of the type names remain the same.
Piers.
> -----Original Message-----
> From: Daniel Morgan [mailto:danmorg@sc.rr.com]=20
> Sent: Wednesday, January 22, 2003 9:17 PM
> To: Marlon Baculio
> Cc: Mono-List; reggie@bytefx.com
> Subject: [Mono-list] RE: [Mono] MySQL Managed Provider
>=20
>=20
> I would follow the model like System.Data.SqlTypes is for=20
> Microsoft SQL Server types. Except, have a namespace=20
> Mono.Data.MySqlTypes which holds types like the ones that=20
> MySQL has, such as, MySqlInt for int, and MySqlDateTime for datetime.
>=20
> As far as Type coersion, the ODBC.net provider probably keeps=20
> the data as a string until you try to use it, such as,=20
> GetString or GetInt32 or GetInt16.
>=20
> Have you tried using something like the ProviderFactory found=20
> in Mono.Data?
>=20
> Here is some sample code:
>=20
> // test.cs
> using System;
> using System.Data;
>=20
> public class Test {
> public static void Main(string[] args) {
> IDbConnection conn =3D=20
> ProviderFactory.CreateConnectionFromConfig("PubsConnStr");
> Console.WriteLine("Open Connection");
> conn.Open();
> IDbCommand cmd =3D conn.CreateCommand();
> cmd.CommandText =3D "select somecolumn from sometable";
> IDataReader reader =3D cmd.ExecuteReader();
> reader.Read();
> Console.WriteLine("SomeColumn: " +=20
> reader["somecolumn"].ToString());
> }
> }
>=20
> Or you could use:
> IDbConneciton conn =3D=20
> ProviderFactory.Provider["Mono.Data.MySql"].CreateConnection();
> conn.ConnectionString =3D "Server=3Dlocalhost;Database=3Dtest;User
> ID=3Dmysql;Password=3Dmysecret";
> conn.Open();
>=20
> I have provided a modified test.exe.config for you.
>=20
> <?xml version=3D"1.0" encoding=3D"utf-8" ?>
> <configuration>
> <configSections>
> <sectionGroup name=3D"mono.data">
> <section name=3D"providers"=20
> type=3D"Mono.Data.ProviderSectionHandler,Mono.Data" />
> </sectionGroup>
> </configSections>
> <appSettings>
> <add key=3D"MySqlOdbc"=20
> value=3D"factory=3DSystem.Data.Odbc;DSN=3Dmyodbcdsn;UID=3Dsomeuser;PWD
> =3Dsomepass" />
> <add key=3D"MonoMySql"=20
> =
value=3D"factory=3DMono.Data.MySql;Server=3Dlocalhost;Database=3Dtest;Use=
r
> ID=3Dmysql;Password=3Dmyscret" />
> <add key=3D"MySqlNet"=20
> value=3D"factory=3DByteFX.Data.MySQLClient;Server=3Dlocalhost;Databa
> se=3Dtest;User
> ID=3Dmysql;Password=3Dmyscret" />
> </appSettings>
> <mono.data>
> <providers>
> <provider
> name=3D"System.Data.Odbc"
> =09
> connection=3D"System.Data.Odbc.OdbcConnection"
> =09
> adapter=3D"System.Data.Odbc.OdbcDataAdapter"
> command=3D"System.Data.Odbc.OdbcCommand"
> assembly=3D"odbc"
> description=3D"ODBC (Mono)" />
> <provider name=3D"Mono.Data.MySql"
> =09
> connection=3D"Mono.Data.MySql.MySqlConnection"
> =09
> adapter=3D"Mono.Data.MySql.MySqlDataAdapter"
> command=3D"Mono.Data.MySql.MySqlCommand"
> assembly=3D"Mono.Data.MySql"
> description=3D"MySQL (Mono)" />
> <provider name=3D"ByteFX.Data.MySQLClient"
> =09
> connection=3D"ByteFX.Data.MySQLClient.MySQLConnection"
> =09
> adapter=3D"ByteFX.Data.MySQLClient.MySQLDataAdapter"
> =09
> command=3D"ByteFX.Data.MySQLClient.MySQLCommand"
> assembly=3D"ByteFX.Data"
> description=3D"MySQL (ByteFX)" />
> </providers>
> </mono.data>
> </configuration>
>=20
> -----Original Message-----
> From: Marlon Baculio [mailto:mbaculio@hotmail.com]
> Sent: Wednesday, January 22, 2003 11:25 PM
> To: danmorg@sc.rr.com
> Cc: reggie@bytefx.com
> Subject: RE: [Mono] MySQL Managed Provider
>=20
>=20
> Hi Daniel,
>=20
> All my code in the data layer is using the generic interfaces (such as
> IDataReader) as opposed to provider-specific classes (except=20
> when instantiating a concrete provider class, in which case,=20
> what I do is create an alias using the "using" C# keyword, so=20
> that my code just refers to the
> (abstracted) alias then I just switch back-and-forth between=20
> ODBC.NET and MySQLNet by changing the alias).
>=20
> Since my code has been coded around ODBC.NET, the problems I=20
> find are compatibility issues, for example:
>=20
> 0. [enhancement] In connection string, support for "UID" in=20
> addition to "user id"
>=20
> 1. [bugs] parsing value for MySQLFieldType.BYTE should use=20
> Byte.Parse() and not Int16.Parse()
>=20
> 2. ODBC.NET is more forgiving for type coercion. For example,=20
> you can call
> IDataReader.GetString() against an integral type, or you can call
> IDataReader.GetInt32() against a 16-bit column.
>=20
> 3. I'm also worried about how MySQLField is storing field=20
> values as objects. This will require a lot of boxing and=20
> unboxing when value is passed to the client-code, specially=20
> if we want to support more relaxed type coercion (although=20
> the cost of the boxing/unboxing would be negligible compared=20
> to the overall SQL call, but I'm a performance freak so I=20
> tend to be paranoid :). My recommendation is to create an=20
> abstract class for a field value, then derive classes for=20
> each type, for example:
>=20
> abstract class MySQLFieldValue
> {
> ...
> public virtual byte GetByte();
> public virtual Int32 GetInt32();
> ...
> };
>=20
> class MySQLByteFieldValue : MySQLFieldValue
> {
> public MySQLByteFieldValue(byte[] data)
> {
> ...
> }
> public override byte GetByte()
> {
> return _value;
> }
> public override Int32 GetInt32()
> {
> // no boxing required, while being type-relaxed
> return /*(Int32)*/ _value;
> }
>=20
> private byte _value;
> };
>=20
> 4. I feel confident on using MySQLNet because of its=20
> performance and the fact that I can fix the code myself being=20
> open source. It would be nice though to support connection=20
> pooling. Maybe we can create a simple ObjectPool that we can=20
> use in MySQLConnection.Open() and .Close().
>=20
>=20
> (I hope Reggie is reading this) I think what I'm going to do=20
> is continue making the changes on my copy of the MySQLNet=20
> code and then send the original and modified code to Reggie=20
> so he can do a diff and decide if my changes deserve to be included.
>=20
> I've been frequenting the "MySQL forum section" at=20
> http://www.asp.net/Forums/ShowForum.aspx?tabindex=3D1&ForumID=3D56
> Maybe we can get some help/idea from there.
>=20
> Thank you so much Daniel! I'm been following Mono for quite=20
> sometime now, hoping that eventually I will use that to run=20
> my ASP.NET web site on Linux.
>=20
>=20
> Marlon Baculio
> mbaculio@hotmail.com
>=20
>=20
> >From: "Daniel Morgan" <danmorg@sc.rr.com>
> >To: "Marlon Baculio" <mbaculio@hotmail.com>
> >CC: "Reggie Burnett" <reggie@bytefx.com>
> >Subject: RE: [Mono] MySQL Managed Provider
> >Date: Wed, 22 Jan 2003 21:57:22 -0500
> >
> >Hi Marlon,
> >
> >Reggie Burneet is the lead developer of MySQLNet. He would=20
> be glad to=20
> >have patches to the provider. Can you be more specific about the=20
> >problems you are having. Can you provide simple test cases?
> >
> >Same thing with the provider in Mono - patches are welcome.
> >
> >Mono.Data.MySql is in maintenance mode and is mainly meant=20
> to work on=20
> >Mono. Try using MySQLNet which will become the choice for=20
> Mono in the=20
> >future since it works on Mono and .NET, faster,
> >and no dependencies on a client library.
> >
> >Have you been using the various interfaces in ADO.NET, such as,=20
> >IDbConnection, IDbCommand, IDataReader, IDbDataAdapter, etc. ?
> >
> >IDbConnection dbcon =3D new MySqlConnection();=20
> dbcon.ConnectionString =3D=20
> >"Server=3Dlocalhost;Database=3Dtest;User
> >ID=3Dmysql;Password=3Dmysecret";
> >IDbCommand dbcmd =3D dbcon.CreateCommand();
> >dbcmd.CommandText =3D "select * from sometable";
> >IDataReader reader =3D dbcmd.ExecuteReader();
> >
> >These interfaces provide a generic way to use different providers. =20
> >Also, there is the ProviderFactory and DataTools found in=20
> Mono.Data.dll=20
> >which can be used to dynamically create connections, commands,=20
> >parameters, and adapters via some configuration. Take a look at the=20
> >test for it at mcs/class/Mono.Data/Test/test.cs which uses a .config=20
> >file named test.exe.config for various app settings and providers.
> >
> >Daniel
> >
> >-----Original Message-----
> >From: Marlon Baculio [mailto:mbaculio@hotmail.com]
> >Sent: Wednesday, January 22, 2003 1:09 AM
> >To: danmorg@sc.rr.com
> >Subject: [Mono] MySQL Managed Provider
> >
> >
> >Hi Daniel,
> >
> >(Please excuse me if this e-mail or this address is inappropriate.)
> >
> >I've been checking out MySQLNet from ByteFX. I've heard you are also=20
> >writing a separate MySQL Managed Provider for Mono.
> >
> >I'm writing a web site that uses MySQL using ODBC.NET. I am not=20
> >satisfied with the performance so I am looking for alternatives.=20
> >MySQLNet from ByteFX looks so promising but there's a few=20
> problems with=20
> >it. My ultimate test for ADO.NET compatibility (at least for=20
> my site)=20
> >is to able to switch between ODBC.NET and MySQLNet (or any MySQL=20
> >Provider) without a problem like this:
> >
> >using DBConnection =3D Microsoft.Data.Odbc.OdbcConnection;
> >using DBCommand =3D Microsoft.Data.Odbc.OdbcCommand;
> >
> >//using DBConnection =3D ByteFX.Data.MySQLClient.MySQLConnection;
> >//using DBCommand =3D ByteFX.Data.MySQLClient.MySQLCommand;
> >
> >
> >In fact, I've been making bug fixes/adjustments to my copy of the=20
> >ByteFX code until I get a word from Reggie Burnette.
> >
> >If I don't get a response from him, I wish to ask you the following
> >question:
> >
> >0. Any timeline or chance your provider will use pure C# to talk=20
> >directly with the MySQL Server? 1. Any immediate plans for=20
> connection=20
> >pooling? 2. Any chance I could contribute? (example: for=20
> ByteFX, I wish=20
> >to make it more forgiving on type coercions like ODBC.NET, and less=20
> >boxing/unboxing)
> >
> >So, basically, I'm torn as to which project I would use in=20
> my site :-)
> >
> >Thank you!!!
> >
> >Marlon Baculio
> >mbaculio@hotmail.com
> >
> >
> >
> >_________________________________________________________________
> >Add photos to your e-mail with MSN 8. Get 2 months FREE*.=20
> >http://join.msn.com/?page=3Dfeatures/featuredemail
>=20
>=20
> _________________________________________________________________
> Protect your PC - get McAfee.com VirusScan Online=20
> http://clinic.mcafee.com/clinic/ibuy/campaign.asp?> cid=3D3963
>=20
>=20
> _______________________________________________
>=20
> Mono-list maillist - Mono-list@lists.ximian.com=20
> http://lists.ximian.com/mailman/listinfo/mono-list
>=20
------_=_NextPart_001_01C2C2CE.3073715E
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.0.4417.0">
<TITLE>RE: [Mono-list] RE: [Mono] MySQL Managed Provider</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=3D2>I would consider NOT prefixing the types with 'My' =
since they're already in a separate namespace and porting user code from =
one provider to another will be much simpler if most of the type names =
remain the same.</FONT></P>
<P><FONT SIZE=3D2>Piers.</FONT>
</P>
<P><FONT SIZE=3D2>> -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>> From: Daniel Morgan [<A =
HREF=3D"mailto:danmorg@sc.rr.com">mailto:danmorg@sc.rr.com</A>] </FONT>
<BR><FONT SIZE=3D2>> Sent: Wednesday, January 22, 2003 9:17 PM</FONT>
<BR><FONT SIZE=3D2>> To: Marlon Baculio</FONT>
<BR><FONT SIZE=3D2>> Cc: Mono-List; reggie@bytefx.com</FONT>
<BR><FONT SIZE=3D2>> Subject: [Mono-list] RE: [Mono] MySQL Managed =
Provider</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> I would follow the model like =
System.Data.SqlTypes is for </FONT>
<BR><FONT SIZE=3D2>> Microsoft SQL Server types. Except, have a =
namespace </FONT>
<BR><FONT SIZE=3D2>> Mono.Data.MySqlTypes which holds types like the =
ones that </FONT>
<BR><FONT SIZE=3D2>> MySQL has, such as, MySqlInt for int, and =
MySqlDateTime for datetime.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> As far as Type coersion, the ODBC.net provider =
probably keeps </FONT>
<BR><FONT SIZE=3D2>> the data as a string until you try to use it, =
such as, </FONT>
<BR><FONT SIZE=3D2>> GetString or GetInt32 or GetInt16.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Have you tried using something like the =
ProviderFactory found </FONT>
<BR><FONT SIZE=3D2>> in Mono.Data?</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Here is some sample code:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> // test.cs</FONT>
<BR><FONT SIZE=3D2>> using System;</FONT>
<BR><FONT SIZE=3D2>> using System.Data;</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> public class Test {</FONT>
<BR><FONT SIZE=3D2>> public static void =
Main(string[] args) {</FONT>
<BR><FONT SIZE=3D2>> =
IDbConnection conn =3D </FONT>
<BR><FONT SIZE=3D2>> =
ProviderFactory.CreateConnectionFromConfig("PubsConnStr");</FON=
T>
<BR><FONT SIZE=3D2>> =
Console.WriteLine("Open Connection");</FONT>
<BR><FONT SIZE=3D2>> =
conn.Open();</FONT>
<BR><FONT SIZE=3D2>> IDbCommand =
cmd =3D conn.CreateCommand();</FONT>
<BR><FONT SIZE=3D2>> =
cmd.CommandText =3D "select somecolumn from sometable";</FONT>
<BR><FONT SIZE=3D2>> IDataReader =
reader =3D cmd.ExecuteReader();</FONT>
<BR><FONT SIZE=3D2>> =
reader.Read();</FONT>
<BR><FONT SIZE=3D2>> =
Console.WriteLine("SomeColumn: " + </FONT>
<BR><FONT SIZE=3D2>> =
reader["somecolumn"].ToString());</FONT>
<BR><FONT SIZE=3D2>> }</FONT>
<BR><FONT SIZE=3D2>> }</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Or you could use:</FONT>
<BR><FONT SIZE=3D2>> IDbConneciton conn =3D </FONT>
<BR><FONT SIZE=3D2>> =
ProviderFactory.Provider["Mono.Data.MySql"].CreateConnection();=
</FONT>
<BR><FONT SIZE=3D2>> conn.ConnectionString =3D =
"Server=3Dlocalhost;Database=3Dtest;User</FONT>
<BR><FONT SIZE=3D2>> ID=3Dmysql;Password=3Dmysecret";</FONT>
<BR><FONT SIZE=3D2>> conn.Open();</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> I have provided a modified test.exe.config for =
you.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> <?xml version=3D"1.0" =
encoding=3D"utf-8" ?></FONT>
<BR><FONT SIZE=3D2>> <configuration></FONT>
<BR><FONT SIZE=3D2>> =
<configSections></FONT>
<BR><FONT SIZE=3D2>> =
<sectionGroup =
name=3D"mono.data"></FONT>
<BR><FONT SIZE=3D2>> =
=
<section =
name=3D"providers" </FONT>
<BR><FONT SIZE=3D2>> =
type=3D"Mono.Data.ProviderSectionHandler,Mono.Data" =
/></FONT>
<BR><FONT SIZE=3D2>> =
</sectionGroup></FONT>
<BR><FONT SIZE=3D2>> =
</configSections></FONT>
<BR><FONT SIZE=3D2>> =
<appSettings></FONT>
<BR><FONT SIZE=3D2>> =
<add =
key=3D"MySqlOdbc" </FONT>
<BR><FONT SIZE=3D2>> =
value=3D"factory=3DSystem.Data.Odbc;DSN=3Dmyodbcdsn;UID=3Dsomeuser;P=
WD</FONT>
<BR><FONT SIZE=3D2>> =3Dsomepass" /></FONT>
<BR><FONT SIZE=3D2>> =
<add =
key=3D"MonoMySql" </FONT>
<BR><FONT SIZE=3D2>> =
value=3D"factory=3DMono.Data.MySql;Server=3Dlocalhost;Database=3Dtes=
t;User</FONT>
<BR><FONT SIZE=3D2>> ID=3Dmysql;Password=3Dmyscret" /></FONT>
<BR><FONT SIZE=3D2>> =
<add =
key=3D"MySqlNet" </FONT>
<BR><FONT SIZE=3D2>> =
value=3D"factory=3DByteFX.Data.MySQLClient;Server=3Dlocalhost;Databa=
</FONT>
<BR><FONT SIZE=3D2>> se=3Dtest;User</FONT>
<BR><FONT SIZE=3D2>> ID=3Dmysql;Password=3Dmyscret" /></FONT>
<BR><FONT SIZE=3D2>> =
</appSettings></FONT>
<BR><FONT SIZE=3D2>> =
<mono.data></FONT>
<BR><FONT SIZE=3D2>> =
<providers></FONT>
<BR><FONT SIZE=3D2>> =
=
<provider</FONT>
<BR><FONT SIZE=3D2>> =
=
=
=
name=3D"System.Data.Odbc"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
</FONT>
<BR><FONT SIZE=3D2>> =
connection=3D"System.Data.Odbc.OdbcConnection"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
</FONT>
<BR><FONT SIZE=3D2>> =
adapter=3D"System.Data.Odbc.OdbcDataAdapter"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
=
command=3D"System.Data.Odbc.OdbcCommand"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
=
assembly=3D"odbc"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
description=3D"ODBC =
(Mono)" /></FONT>
<BR><FONT SIZE=3D2>> =
=
<provider =
name=3D"Mono.Data.MySql"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
</FONT>
<BR><FONT SIZE=3D2>> =
connection=3D"Mono.Data.MySql.MySqlConnection"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
</FONT>
<BR><FONT SIZE=3D2>> =
adapter=3D"Mono.Data.MySql.MySqlDataAdapter"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
=
command=3D"Mono.Data.MySql.MySqlCommand"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
=
assembly=3D"Mono.Data.MySql"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
description=3D"MySQL =
(Mono)" /></FONT>
<BR><FONT SIZE=3D2>> =
=
<provider =
name=3D"ByteFX.Data.MySQLClient"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
</FONT>
<BR><FONT SIZE=3D2>> =
connection=3D"ByteFX.Data.MySQLClient.MySQLConnection"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
</FONT>
<BR><FONT SIZE=3D2>> =
adapter=3D"ByteFX.Data.MySQLClient.MySQLDataAdapter"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
</FONT>
<BR><FONT SIZE=3D2>> =
command=3D"ByteFX.Data.MySQLClient.MySQLCommand"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
=
assembly=3D"ByteFX.Data"</FONT>
<BR><FONT SIZE=3D2>> =
=
=
description=3D"MySQL =
(ByteFX)" /></FONT>
<BR><FONT SIZE=3D2>> =
</providers></FONT>
<BR><FONT SIZE=3D2>> =
</mono.data></FONT>
<BR><FONT SIZE=3D2>> </configuration></FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> -----Original Message-----</FONT>
<BR><FONT SIZE=3D2>> From: Marlon Baculio [<A =
HREF=3D"mailto:mbaculio@hotmail.com">mailto:mbaculio@hotmail.com</A>]</FO=
NT>
<BR><FONT SIZE=3D2>> Sent: Wednesday, January 22, 2003 11:25 =
PM</FONT>
<BR><FONT SIZE=3D2>> To: danmorg@sc.rr.com</FONT>
<BR><FONT SIZE=3D2>> Cc: reggie@bytefx.com</FONT>
<BR><FONT SIZE=3D2>> Subject: RE: [Mono] MySQL Managed =
Provider</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Hi Daniel,</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> All my code in the data layer is using the =
generic interfaces (such as</FONT>
<BR><FONT SIZE=3D2>> IDataReader) as opposed to provider-specific =
classes (except </FONT>
<BR><FONT SIZE=3D2>> when instantiating a concrete provider class, in =
which case, </FONT>
<BR><FONT SIZE=3D2>> what I do is create an alias using the =
"using" C# keyword, so </FONT>
<BR><FONT SIZE=3D2>> that my code just refers to the</FONT>
<BR><FONT SIZE=3D2>> (abstracted) alias then I just switch =
back-and-forth between </FONT>
<BR><FONT SIZE=3D2>> ODBC.NET and MySQLNet by changing the =
alias).</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Since my code has been coded around ODBC.NET, =
the problems I </FONT>
<BR><FONT SIZE=3D2>> find are compatibility issues, for =
example:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> 0. [enhancement] In connection string, support =
for "UID" in </FONT>
<BR><FONT SIZE=3D2>> addition to "user id"</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> 1. [bugs] parsing value for MySQLFieldType.BYTE =
should use </FONT>
<BR><FONT SIZE=3D2>> Byte.Parse() and not Int16.Parse()</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> 2. ODBC.NET is more forgiving for type coercion. =
For example, </FONT>
<BR><FONT SIZE=3D2>> you can call</FONT>
<BR><FONT SIZE=3D2>> IDataReader.GetString() against an integral =
type, or you can call</FONT>
<BR><FONT SIZE=3D2>> IDataReader.GetInt32() against a 16-bit =
column.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> 3. I'm also worried about how MySQLField is =
storing field </FONT>
<BR><FONT SIZE=3D2>> values as objects. This will require a lot of =
boxing and </FONT>
<BR><FONT SIZE=3D2>> unboxing when value is passed to the =
client-code, specially </FONT>
<BR><FONT SIZE=3D2>> if we want to support more relaxed type coercion =
(although </FONT>
<BR><FONT SIZE=3D2>> the cost of the boxing/unboxing would be =
negligible compared </FONT>
<BR><FONT SIZE=3D2>> to the overall SQL call, but I'm a performance =
freak so I </FONT>
<BR><FONT SIZE=3D2>> tend to be paranoid :). My recommendation is to =
create an </FONT>
<BR><FONT SIZE=3D2>> abstract class for a field value, then derive =
classes for </FONT>
<BR><FONT SIZE=3D2>> each type, for example:</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> abstract class MySQLFieldValue</FONT>
<BR><FONT SIZE=3D2>> {</FONT>
<BR><FONT SIZE=3D2>> ...</FONT>
<BR><FONT SIZE=3D2>> public virtual byte =
GetByte();</FONT>
<BR><FONT SIZE=3D2>> public virtual Int32 =
GetInt32();</FONT>
<BR><FONT SIZE=3D2>> ...</FONT>
<BR><FONT SIZE=3D2>> };</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> class MySQLByteFieldValue : =
MySQLFieldValue</FONT>
<BR><FONT SIZE=3D2>> {</FONT>
<BR><FONT SIZE=3D2>> public =
MySQLByteFieldValue(byte[] data)</FONT>
<BR><FONT SIZE=3D2>> {</FONT>
<BR><FONT SIZE=3D2>> =
...</FONT>
<BR><FONT SIZE=3D2>> }</FONT>
<BR><FONT SIZE=3D2>> public override byte =
GetByte()</FONT>
<BR><FONT SIZE=3D2>> {</FONT>
<BR><FONT SIZE=3D2>> =
return _value;</FONT>
<BR><FONT SIZE=3D2>> }</FONT>
<BR><FONT SIZE=3D2>> public override Int32 =
GetInt32()</FONT>
<BR><FONT SIZE=3D2>> {</FONT>
<BR><FONT SIZE=3D2>> =
// no boxing required, while being type-relaxed</FONT>
<BR><FONT SIZE=3D2>> =
return /*(Int32)*/ _value;</FONT>
<BR><FONT SIZE=3D2>> }</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> private byte =
_value;</FONT>
<BR><FONT SIZE=3D2>> };</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> 4. I feel confident on using MySQLNet because of =
its </FONT>
<BR><FONT SIZE=3D2>> performance and the fact that I can fix the code =
myself being </FONT>
<BR><FONT SIZE=3D2>> open source. It would be nice though to support =
connection </FONT>
<BR><FONT SIZE=3D2>> pooling. Maybe we can create a simple ObjectPool =
that we can </FONT>
<BR><FONT SIZE=3D2>> use in MySQLConnection.Open() and =
.Close().</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> (I hope Reggie is reading this) I think what I'm =
going to do </FONT>
<BR><FONT SIZE=3D2>> is continue making the changes on my copy of the =
MySQLNet </FONT>
<BR><FONT SIZE=3D2>> code and then send the original and modified =
code to Reggie </FONT>
<BR><FONT SIZE=3D2>> so he can do a diff and decide if my changes =
deserve to be included.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> I've been frequenting the "MySQL forum =
section" at </FONT>
<BR><FONT SIZE=3D2>> <A =
HREF=3D"http://www.asp.net/Forums/ShowForum.aspx?tabindex=3D1&ForumID=3D5=
6">http://www.asp.net/Forums/ShowForum.aspx?tabindex=3D1&ForumID=3D56</A>=
</FONT>
<BR><FONT SIZE=3D2>> Maybe we can get some help/idea from =
there.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Thank you so much Daniel! I'm been following =
Mono for quite </FONT>
<BR><FONT SIZE=3D2>> sometime now, hoping that eventually I will use =
that to run </FONT>
<BR><FONT SIZE=3D2>> my ASP.NET web site on Linux.</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Marlon Baculio</FONT>
<BR><FONT SIZE=3D2>> mbaculio@hotmail.com</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> >From: "Daniel Morgan" =
<danmorg@sc.rr.com></FONT>
<BR><FONT SIZE=3D2>> >To: "Marlon Baculio" =
<mbaculio@hotmail.com></FONT>
<BR><FONT SIZE=3D2>> >CC: "Reggie Burnett" =
<reggie@bytefx.com></FONT>
<BR><FONT SIZE=3D2>> >Subject: RE: [Mono] MySQL Managed =
Provider</FONT>
<BR><FONT SIZE=3D2>> >Date: Wed, 22 Jan 2003 21:57:22 -0500</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Hi Marlon,</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Reggie Burneet is the lead developer of =
MySQLNet. He would </FONT>
<BR><FONT SIZE=3D2>> be glad to </FONT>
<BR><FONT SIZE=3D2>> >have patches to the provider. Can you =
be more specific about the </FONT>
<BR><FONT SIZE=3D2>> >problems you are having. Can you =
provide simple test cases?</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Same thing with the provider in Mono - =
patches are welcome.</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Mono.Data.MySql is in maintenance mode and =
is mainly meant </FONT>
<BR><FONT SIZE=3D2>> to work on </FONT>
<BR><FONT SIZE=3D2>> >Mono. Try using MySQLNet which will become =
the choice for </FONT>
<BR><FONT SIZE=3D2>> Mono in the </FONT>
<BR><FONT SIZE=3D2>> >future since it works on Mono and .NET, =
faster,</FONT>
<BR><FONT SIZE=3D2>> >and no dependencies on a client =
library.</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Have you been using the various interfaces =
in ADO.NET, such as, </FONT>
<BR><FONT SIZE=3D2>> >IDbConnection, IDbCommand, IDataReader, =
IDbDataAdapter, etc. ?</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >IDbConnection dbcon =3D new =
MySqlConnection(); </FONT>
<BR><FONT SIZE=3D2>> dbcon.ConnectionString =3D </FONT>
<BR><FONT SIZE=3D2>> =
>"Server=3Dlocalhost;Database=3Dtest;User</FONT>
<BR><FONT SIZE=3D2>> >ID=3Dmysql;Password=3Dmysecret";</FONT>
<BR><FONT SIZE=3D2>> >IDbCommand dbcmd =3D =
dbcon.CreateCommand();</FONT>
<BR><FONT SIZE=3D2>> >dbcmd.CommandText =3D "select * from =
sometable";</FONT>
<BR><FONT SIZE=3D2>> >IDataReader reader =3D =
dbcmd.ExecuteReader();</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >These interfaces provide a generic way to =
use different providers. </FONT>
<BR><FONT SIZE=3D2>> >Also, there is the ProviderFactory and =
DataTools found in </FONT>
<BR><FONT SIZE=3D2>> Mono.Data.dll </FONT>
<BR><FONT SIZE=3D2>> >which can be used to dynamically create =
connections, commands, </FONT>
<BR><FONT SIZE=3D2>> >parameters, and adapters via some =
configuration. Take a look at the </FONT>
<BR><FONT SIZE=3D2>> >test for it at =
mcs/class/Mono.Data/Test/test.cs which uses a .config </FONT>
<BR><FONT SIZE=3D2>> >file named test.exe.config for various app =
settings and providers.</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Daniel</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>> >From: Marlon Baculio [<A =
HREF=3D"mailto:mbaculio@hotmail.com">mailto:mbaculio@hotmail.com</A>]</FO=
NT>
<BR><FONT SIZE=3D2>> >Sent: Wednesday, January 22, 2003 1:09 =
AM</FONT>
<BR><FONT SIZE=3D2>> >To: danmorg@sc.rr.com</FONT>
<BR><FONT SIZE=3D2>> >Subject: [Mono] MySQL Managed =
Provider</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Hi Daniel,</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >(Please excuse me if this e-mail or this =
address is inappropriate.)</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >I've been checking out MySQLNet from ByteFX. =
I've heard you are also </FONT>
<BR><FONT SIZE=3D2>> >writing a separate MySQL Managed Provider =
for Mono.</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >I'm writing a web site that uses MySQL using =
ODBC.NET. I am not </FONT>
<BR><FONT SIZE=3D2>> >satisfied with the performance so I am =
looking for alternatives. </FONT>
<BR><FONT SIZE=3D2>> >MySQLNet from ByteFX looks so promising but =
there's a few </FONT>
<BR><FONT SIZE=3D2>> problems with </FONT>
<BR><FONT SIZE=3D2>> >it. My ultimate test for ADO.NET =
compatibility (at least for </FONT>
<BR><FONT SIZE=3D2>> my site) </FONT>
<BR><FONT SIZE=3D2>> >is to able to switch between ODBC.NET and =
MySQLNet (or any MySQL </FONT>
<BR><FONT SIZE=3D2>> >Provider) without a problem like =
this:</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >using DBConnection =3D =
Microsoft.Data.Odbc.OdbcConnection;</FONT>
<BR><FONT SIZE=3D2>> >using DBCommand =3D =
Microsoft.Data.Odbc.OdbcCommand;</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >//using DBConnection =3D =
ByteFX.Data.MySQLClient.MySQLConnection;</FONT>
<BR><FONT SIZE=3D2>> >//using DBCommand =3D =
ByteFX.Data.MySQLClient.MySQLCommand;</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >In fact, I've been making bug =
fixes/adjustments to my copy of the </FONT>
<BR><FONT SIZE=3D2>> >ByteFX code until I get a word from Reggie =
Burnette.</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >If I don't get a response from him, I wish =
to ask you the following</FONT>
<BR><FONT SIZE=3D2>> >question:</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >0. Any timeline or chance your provider will =
use pure C# to talk </FONT>
<BR><FONT SIZE=3D2>> >directly with the MySQL Server? 1. Any =
immediate plans for </FONT>
<BR><FONT SIZE=3D2>> connection </FONT>
<BR><FONT SIZE=3D2>> >pooling? 2. Any chance I could contribute? =
(example: for </FONT>
<BR><FONT SIZE=3D2>> ByteFX, I wish </FONT>
<BR><FONT SIZE=3D2>> >to make it more forgiving on type coercions =
like ODBC.NET, and less </FONT>
<BR><FONT SIZE=3D2>> >boxing/unboxing)</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >So, basically, I'm torn as to which project =
I would use in </FONT>
<BR><FONT SIZE=3D2>> my site :-)</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Thank you!!!</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> >Marlon Baculio</FONT>
<BR><FONT SIZE=3D2>> >mbaculio@hotmail.com</FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> ></FONT>
<BR><FONT SIZE=3D2>> =
>_________________________________________________________________</FO=
NT>
<BR><FONT SIZE=3D2>> >Add photos to your e-mail with MSN 8. Get 2 =
months FREE*. </FONT>
<BR><FONT SIZE=3D2>> ><A =
HREF=3D"http://join.msn.com/?page=3Dfeatures/featuredemail">http://join.m=
sn.com/?page=3Dfeatures/featuredemail</A></FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> =
_________________________________________________________________</FONT>
<BR><FONT SIZE=3D2>> Protect your PC - get McAfee.com VirusScan =
Online </FONT>
<BR><FONT SIZE=3D2>> <A =
HREF=3D"http://clinic.mcafee.com/clinic/ibuy/campaign.asp">http://clinic.=
mcafee.com/clinic/ibuy/campaign.asp</A>?> cid=3D3963</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> =
_______________________________________________</FONT>
<BR><FONT SIZE=3D2>> </FONT>
<BR><FONT SIZE=3D2>> Mono-list maillist - =
Mono-list@lists.ximian.com </FONT>
<BR><FONT SIZE=3D2>> <A =
HREF=3D"http://lists.ximian.com/mailman/listinfo/mono-list">http://lists.=
ximian.com/mailman/listinfo/mono-list</A></FONT>
<BR><FONT SIZE=3D2>> </FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C2C2CE.3073715E--