Modified:
trunk/CHANGES
trunk/Client.build
trunk/TestSuite/PerfMonTests.cs
trunk/TestSuite/StoredProcedure.cs
trunk/mysqlclient/CommandBuilder.cs
trunk/mysqlclient/CompressedStream.cs
trunk/mysqlclient/Connection.cs
trunk/mysqlclient/MySql.Data.2005.csproj
trunk/mysqlclient/MySqlConnectionStringBuilder.cs
trunk/mysqlclient/NativeDriver.cs
trunk/mysqlclient/common/SharedMemoryStream.cs
trunk/mysqlclient/common/StreamCreator.cs
trunk/mysqlclient/parameter.cs
Log:
Minor changes for mono compatibility
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/CHANGES 2006-08-07 03:06:43 UTC (rev 298)
@@ -49,6 +49,7 @@
Bug #19936 DataReader already open exception [fixed]
Bug #17106 MySql.Data.MySqlClient.CharSetMap.GetEncoding thread synchronization issue
[fixed]
Bug #17736 Selecting a row with with empty date '0000-00-00' results in Read()
hanging. [fixed]
+ Bug #20581 Null Reference Exception when closing reader after stored procedure.
Version 1.0.7
Modified: trunk/Client.build
===================================================================
--- trunk/Client.build 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/Client.build 2006-08-07 03:06:43 UTC (rev 298)
@@ -106,6 +106,13 @@
<call target="client"/>
</target>
+ <target name="mono-2.0" description="Mono 2.0 Target">
+ <property name="defines" value="${defines},MONO,NET20"/>
+ <property name="nunit-lib" value="c:/program
files/nunit/src/build/mono/2.0/debug"/>
+ <property name="framework" value="mono-2.0"/>
+ <call target="client"/>
+ </target>
+
<!-- testing targets -->
<target name="alltests" depends="test-net-2.0, test-net-1.1, test-net-1.0">
</target>
Modified: trunk/TestSuite/PerfMonTests.cs
===================================================================
--- trunk/TestSuite/PerfMonTests.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/TestSuite/PerfMonTests.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -18,6 +18,8 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#if !MONO
+
using System;
using System.Data;
using MySql.Data.MySqlClient;
@@ -110,3 +112,5 @@
}
}
+
+#endif
Modified: trunk/TestSuite/StoredProcedure.cs
===================================================================
--- trunk/TestSuite/StoredProcedure.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/TestSuite/StoredProcedure.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -842,5 +842,37 @@
execSQL("DROP PROCEDURE IF EXISTS spTest" + x);
}
}
+
+ /// <summary>
+ /// Bug #20581 Null Reference Exception when closing reader after stored
procedure.
+ /// </summary>
+ [Test]
+ public void Bug20581()
+ {
+ execSQL("CREATE PROCEDURE spTest(p int) BEGIN SELECT p; END");
+ MySqlParameter param1;
+ MySqlCommand command = new MySqlCommand("spTest", conn);
+ command.CommandType = System.Data.CommandType.StoredProcedure;
+
+ param1 = command.Parameters.Add("p", MySqlDbType.Int32);
+ param1.Value = 3;
+
+ MySqlDataReader reader = null;
+ try
+ {
+ command.Prepare();
+ reader = command.ExecuteReader(CommandBehavior.SingleRow);
+ reader.Read();
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
+ finally
+ {
+ if (reader != null)
+ reader.Close();
+ }
+ }
}
}
Modified: trunk/mysqlclient/CommandBuilder.cs
===================================================================
--- trunk/mysqlclient/CommandBuilder.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/CommandBuilder.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -152,6 +152,8 @@
/// <include file='docs/MySqlCommandBuilder.xml' path='docs/RefreshSchema/*'/>
public override void RefreshSchema()
{
+ marker = (DataAdapter.SelectCommand.Connection as
MySqlConnection).ParameterMarker;
+ base.RefreshSchema();
}
#endregion
@@ -181,20 +183,7 @@
return base.InitializeCommand(command);
}
- protected override DataTable GetSchemaTable(DbCommand sourceCommand)
- {
- marker = (sourceCommand.Connection as MySqlConnection).ParameterMarker;
- DataTable schema;
- using (MySqlDataReader reader = (MySqlDataReader)sourceCommand.ExecuteReader(
- CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly))
- {
- schema = reader.GetSchemaTable();
- }
-
- return schema;
- }
-
protected override void ApplyParameterInfo(DbParameter parameter, DataRow row,
StatementType statementType, bool whereClause)
{
Modified: trunk/mysqlclient/CompressedStream.cs
===================================================================
--- trunk/mysqlclient/CompressedStream.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/CompressedStream.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -1,293 +1,293 @@
-// Copyright (C) 2004-2006 MySQL AB
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License version 2 as published by
-// the Free Software Foundation
-//
-// There are special exceptions to the terms and conditions of the GPL
-// as it is applied to this software. View the full text of the
-// exception in file EXCEPTIONS in the directory of this software
-// distribution.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-using System;
-using System.IO;
-#if NET20
-using System.IO.Compression;
-#else
-using ICSharpCode.SharpZipLib.Zip.Compression;
-using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
-#endif
-using MySql.Data.Common;
-using System.Diagnostics;
-
-namespace MySql.Data.MySqlClient
-{
- /// <summary>
- /// Summary description for CompressedStream.
- /// </summary>
- internal class CompressedStream : Stream
- {
- // writing fields
- private Stream baseStream;
- private MemoryStream cache;
- private int numWritten;
- private int expecting;
-
- // reading fields
- private byte[] buffer;
- private int index;
-
- public CompressedStream( Stream baseStream )
- {
- this.baseStream = baseStream;
- cache = new MemoryStream();
-
- buffer = new byte[0];
- }
-
- #region Properties
-
- //TODO: remove comment
-/* public Stream BaseStream
- {
- get { return baseStream; }
- }
-*/
- public override bool CanRead
- {
- get { return baseStream.CanRead; }
- }
-
- public override bool CanWrite
- {
- get { return baseStream.CanWrite; }
- }
-
- public override bool CanSeek
- {
- get { return baseStream.CanSeek; }
- }
-
- public override long Length
- {
- get { return baseStream.Length; }
- }
-
- public override long Position
- {
- get { return baseStream.Position; }
- set { baseStream.Position = value; }
- }
-
- #endregion
-
- public override void Close()
- {
- baseStream.Close();
- base.Close ();
- }
-
- public override void SetLength(long value)
- {
- throw new NotSupportedException(Resources.CSNoSetLength);
- }
-
- public override int ReadByte()
- {
- EnsureData(1);
-
- return (int)buffer[index++];
- }
-
- public override int Read(byte[] buffer, int offset, int count)
- {
- if (buffer == null)
- throw new ArgumentNullException("buffer", Resources.BufferCannotBeNull);
- if (offset < 0 || offset >= buffer.Length)
- throw new ArgumentOutOfRangeException("offset", Resources.OffsetMustBeValid);
- if ((offset + count) > buffer.Length)
- throw new ArgumentException(Resources.BufferNotLargeEnough, "buffer");
-
- EnsureData(count);
-
- Array.Copy(this.buffer, index, buffer, offset, count);
- index += count;
-
- return count;
- }
-
- private byte[] CompressData( byte[] buff, int offset, int count )
- {
- MemoryStream ms = new MemoryStream();
- DeflateStream deflater = new DeflateStream(ms, CompressionMode.Compress);
-
- byte[] cacheBuff = cache.GetBuffer();
-
- byte seq = cacheBuff[3];
- cacheBuff[3] = 0;
-
- deflater.Write(cacheBuff, 0, (int)cache.Length);
- if ( count > 0 )
- deflater.Write(buff, offset, count);
- deflater.Flush();
-
- cacheBuff[3] = seq;
-
- long unCompLen = cache.Length + count;
-
- if (ms.Length >= unCompLen)
- return null;
- return ms.ToArray();
- }
-
- public override void Flush()
- {
- baseStream.Flush();
- }
-
- private bool InputDone()
- {
- // if we have not done so yet, see if we can calculate how many bytes we are
expecting
- if (cache.Length < 4) return false;
- byte[] buf = cache.GetBuffer();
- int expectedLen = buf[0] + (buf[1] << 8) + (buf[2] << 16);
- if (cache.Length < (expectedLen + 4)) return false;
- return true;
- }
-
- private void FlushData(byte[] buff, int offset, int count)
- {
- // if we have already flushed, then just return
- if (cache.Length < 4) return;
-
- if (! InputDone()) return;
-
- byte[] compressedData = CompressData(buff, offset, count);
-
- int comp_len = compressedData == null ? numWritten : (int)compressedData.Length;
- int ucomp_len = compressedData == null ? 0 : numWritten;
- byte[] cacheBuff = cache.GetBuffer();
-
- baseStream.WriteByte( (byte)(comp_len & 0xff) );
- baseStream.WriteByte( (byte)((comp_len >> 8) & 0xff) );
- baseStream.WriteByte( (byte)((comp_len >> 16) & 0Xff) );
- baseStream.WriteByte( cacheBuff[3] );
- baseStream.WriteByte( (byte)(ucomp_len & 0xff) );
- baseStream.WriteByte( (byte)((ucomp_len >> 8) & 0xff) );
- baseStream.WriteByte( (byte)((ucomp_len >> 16) & 0Xff) );
-
- if (ucomp_len == 0)
- {
- cacheBuff[3] = 0;
-
- baseStream.Write( cacheBuff, 0, (int)cache.Length );
-
- if (count > 0)
- baseStream.Write( buff, offset, count );
- }
- else
- baseStream.Write( compressedData, 0, compressedData.Length );
-
- baseStream.Flush();
-
- cache.SetLength(0);
- expecting = numWritten = 0;
- }
-
-
-
- public override void WriteByte(byte value)
- {
- cache.WriteByte( value );
- numWritten++;
- FlushData( null, 0, 0);
- }
-
- public override void Write(byte[] buffer, int offset, int count)
- {
- numWritten += count;
- if (! InputDone())
- cache.Write( buffer, offset, count );
- else
- FlushData( buffer, offset, count );
- }
-
- public override long Seek(long offset, SeekOrigin origin)
- {
- return baseStream.Seek( offset, origin );
- }
-
- private static void ReadBuffer(Stream s, byte[] buf, int offset, int length)
- {
- while (length > 0)
- {
- int amountRead = s.Read(buf, offset, length);
- if (amountRead == 0)
- throw new MySqlException("Unexpected end of data encountered");
- length -= amountRead;
- offset += amountRead;
- }
- }
-
- private void ReadCompressedBuffer(byte[] buf, int index, int compLen, int unCompLen)
- {
- DeflateStream stream = new DeflateStream(baseStream,
CompressionMode.Decompress, true);
- stream.Read(buf, index, unCompLen);
- }
-
- private void ReadNextPacket()
- {
- // read off the uncompressed and compressed lengths
- byte b1 = (byte)baseStream.ReadByte();
- byte b2 = (byte)baseStream.ReadByte();
- byte b3 = (byte)baseStream.ReadByte();
- int compressedLen = b1 + (b2 << 8) + (b3 << 16);
-
-// int compressedLen = baseStream.ReadByte() + (baseStream.ReadByte() << 8) +
-// (baseStream.ReadByte() << 16);
- baseStream.ReadByte(); // seq
- int unCompressedLen = baseStream.ReadByte() + (baseStream.ReadByte() << 8) +
- (baseStream.ReadByte() << 16);
-
- // if the data is in fact compressed, then uncompress it
- byte[] unCompressedBuffer = null;
- if (unCompressedLen > 0)
- {
- unCompressedBuffer = new byte[ unCompressedLen ];
- ReadCompressedBuffer( unCompressedBuffer, 0, compressedLen, unCompressedLen );
- }
- else
- {
- unCompressedBuffer = new byte[ compressedLen ];
- ReadBuffer( baseStream, unCompressedBuffer, 0, compressedLen );
- }
-
- // now join this buffer to our existing one
- int left = buffer.Length - index;
- byte[] newBuffer = new byte[ left + unCompressedBuffer.Length ];
-
- int newIndex = 0;
- // first copy in the rest of the original
- for (int i=index; i < buffer.Length; i++)
- newBuffer[newIndex++] = buffer[i];
- unCompressedBuffer.CopyTo( newBuffer, newIndex );
- buffer = newBuffer;
- index = 0;
- }
-
- private void EnsureData( int size )
- {
- while ((buffer.Length - index) < size)
- ReadNextPacket();
- }
- }
-}
+// Copyright (C) 2004-2006 MySQL AB
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License version 2 as published by
+// the Free Software Foundation
+//
+// There are special exceptions to the terms and conditions of the GPL
+// as it is applied to this software. View the full text of the
+// exception in file EXCEPTIONS in the directory of this software
+// distribution.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System;
+using System.IO;
+#if NET20
+using System.IO.Compression;
+#else
+using ICSharpCode.SharpZipLib.Zip.Compression;
+using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
+#endif
+using MySql.Data.Common;
+using System.Diagnostics;
+
+namespace MySql.Data.MySqlClient
+{
+ /// <summary>
+ /// Summary description for CompressedStream.
+ /// </summary>
+ internal class CompressedStream : Stream
+ {
+ // writing fields
+ private Stream baseStream;
+ private MemoryStream cache;
+ private int numWritten;
+ private int expecting;
+
+ // reading fields
+ private byte[] buffer;
+ private int index;
+
+ public CompressedStream( Stream baseStream )
+ {
+ this.baseStream = baseStream;
+ cache = new MemoryStream();
+
+ buffer = new byte[0];
+ }
+
+ #region Properties
+
+ //TODO: remove comment
+/* public Stream BaseStream
+ {
+ get { return baseStream; }
+ }
+*/
+ public override bool CanRead
+ {
+ get { return baseStream.CanRead; }
+ }
+
+ public override bool CanWrite
+ {
+ get { return baseStream.CanWrite; }
+ }
+
+ public override bool CanSeek
+ {
+ get { return baseStream.CanSeek; }
+ }
+
+ public override long Length
+ {
+ get { return baseStream.Length; }
+ }
+
+ public override long Position
+ {
+ get { return baseStream.Position; }
+ set { baseStream.Position = value; }
+ }
+
+ #endregion
+
+ public override void Close()
+ {
+ baseStream.Close();
+ base.Close ();
+ }
+
+ public override void SetLength(long value)
+ {
+ throw new NotSupportedException(Resources.CSNoSetLength);
+ }
+
+ public override int ReadByte()
+ {
+ EnsureData(1);
+
+ return (int)buffer[index++];
+ }
+
+ public override int Read(byte[] buffer, int offset, int count)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException("buffer", Resources.BufferCannotBeNull);
+ if (offset < 0 || offset >= buffer.Length)
+ throw new ArgumentOutOfRangeException("offset", Resources.OffsetMustBeValid);
+ if ((offset + count) > buffer.Length)
+ throw new ArgumentException(Resources.BufferNotLargeEnough, "buffer");
+
+ EnsureData(count);
+
+ Array.Copy(this.buffer, index, buffer, offset, count);
+ index += count;
+
+ return count;
+ }
+
+ private byte[] CompressData( byte[] buff, int offset, int count )
+ {
+ MemoryStream ms = new MemoryStream();
+ DeflateStream deflater = new DeflateStream(ms, CompressionMode.Compress);
+
+ byte[] cacheBuff = cache.GetBuffer();
+
+ byte seq = cacheBuff[3];
+ cacheBuff[3] = 0;
+
+ deflater.Write(cacheBuff, 0, (int)cache.Length);
+ if ( count > 0 )
+ deflater.Write(buff, offset, count);
+ deflater.Flush();
+
+ cacheBuff[3] = seq;
+
+ long unCompLen = cache.Length + count;
+
+ if (ms.Length >= unCompLen)
+ return null;
+ return ms.ToArray();
+ }
+
+ public override void Flush()
+ {
+ baseStream.Flush();
+ }
+
+ private bool InputDone()
+ {
+ // if we have not done so yet, see if we can calculate how many bytes we are
expecting
+ if (cache.Length < 4) return false;
+ byte[] buf = cache.GetBuffer();
+ int expectedLen = buf[0] + (buf[1] << 8) + (buf[2] << 16);
+ if (cache.Length < (expectedLen + 4)) return false;
+ return true;
+ }
+
+ private void FlushData(byte[] buff, int offset, int count)
+ {
+ // if we have already flushed, then just return
+ if (cache.Length < 4) return;
+
+ if (! InputDone()) return;
+
+ byte[] compressedData = CompressData(buff, offset, count);
+
+ int comp_len = compressedData == null ? numWritten : (int)compressedData.Length;
+ int ucomp_len = compressedData == null ? 0 : numWritten;
+ byte[] cacheBuff = cache.GetBuffer();
+
+ baseStream.WriteByte( (byte)(comp_len & 0xff) );
+ baseStream.WriteByte( (byte)((comp_len >> 8) & 0xff) );
+ baseStream.WriteByte( (byte)((comp_len >> 16) & 0Xff) );
+ baseStream.WriteByte( cacheBuff[3] );
+ baseStream.WriteByte( (byte)(ucomp_len & 0xff) );
+ baseStream.WriteByte( (byte)((ucomp_len >> 8) & 0xff) );
+ baseStream.WriteByte( (byte)((ucomp_len >> 16) & 0Xff) );
+
+ if (ucomp_len == 0)
+ {
+ cacheBuff[3] = 0;
+
+ baseStream.Write( cacheBuff, 0, (int)cache.Length );
+
+ if (count > 0)
+ baseStream.Write( buff, offset, count );
+ }
+ else
+ baseStream.Write( compressedData, 0, compressedData.Length );
+
+ baseStream.Flush();
+
+ cache.SetLength(0);
+ expecting = numWritten = 0;
+ }
+
+
+
+ public override void WriteByte(byte value)
+ {
+ cache.WriteByte( value );
+ numWritten++;
+ FlushData( null, 0, 0);
+ }
+
+ public override void Write(byte[] buffer, int offset, int count)
+ {
+ numWritten += count;
+ if (! InputDone())
+ cache.Write( buffer, offset, count );
+ else
+ FlushData( buffer, offset, count );
+ }
+
+ public override long Seek(long offset, SeekOrigin origin)
+ {
+ return baseStream.Seek( offset, origin );
+ }
+
+ private static void ReadBuffer(Stream s, byte[] buf, int offset, int length)
+ {
+ while (length > 0)
+ {
+ int amountRead = s.Read(buf, offset, length);
+ if (amountRead == 0)
+ throw new MySqlException("Unexpected end of data encountered");
+ length -= amountRead;
+ offset += amountRead;
+ }
+ }
+
+ private void ReadCompressedBuffer(byte[] buf, int index, int compLen, int unCompLen)
+ {
+ DeflateStream stream = new DeflateStream(baseStream,
CompressionMode.Decompress, true);
+ stream.Read(buf, index, unCompLen);
+ }
+
+ private void ReadNextPacket()
+ {
+ // read off the uncompressed and compressed lengths
+ byte b1 = (byte)baseStream.ReadByte();
+ byte b2 = (byte)baseStream.ReadByte();
+ byte b3 = (byte)baseStream.ReadByte();
+ int compressedLen = b1 + (b2 << 8) + (b3 << 16);
+
+// int compressedLen = baseStream.ReadByte() + (baseStream.ReadByte() << 8) +
+// (baseStream.ReadByte() << 16);
+ baseStream.ReadByte(); // seq
+ int unCompressedLen = baseStream.ReadByte() + (baseStream.ReadByte() << 8) +
+ (baseStream.ReadByte() << 16);
+
+ // if the data is in fact compressed, then uncompress it
+ byte[] unCompressedBuffer = null;
+ if (unCompressedLen > 0)
+ {
+ unCompressedBuffer = new byte[ unCompressedLen ];
+ ReadCompressedBuffer( unCompressedBuffer, 0, compressedLen, unCompressedLen );
+ }
+ else
+ {
+ unCompressedBuffer = new byte[ compressedLen ];
+ ReadBuffer( baseStream, unCompressedBuffer, 0, compressedLen );
+ }
+
+ // now join this buffer to our existing one
+ int left = buffer.Length - index;
+ byte[] newBuffer = new byte[ left + unCompressedBuffer.Length ];
+
+ int newIndex = 0;
+ // first copy in the rest of the original
+ for (int i=index; i < buffer.Length; i++)
+ newBuffer[newIndex++] = buffer[i];
+ unCompressedBuffer.CopyTo( newBuffer, newIndex );
+ buffer = newBuffer;
+ index = 0;
+ }
+
+ private void EnsureData( int size )
+ {
+ while ((buffer.Length - index) < size)
+ ReadNextPacket();
+ }
+ }
+}
Modified: trunk/mysqlclient/Connection.cs
===================================================================
--- trunk/mysqlclient/Connection.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/Connection.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -51,6 +51,11 @@
/// <include file='docs/MySqlConnection.xml' path='docs/InfoMessage/*'/>
public event MySqlInfoMessageEventHandler InfoMessage;
+#if MONO
+ /// <include file='docs/MySqlConnection.xml' path='docs/StateChange/*'/>
+ public event StateChangeEventHandler StateChange;
+#endif
+
/// <include file='docs/MySqlConnection.xml' path='docs/DefaultCtor/*'/>
public MySqlConnection()
{
@@ -425,6 +430,16 @@
SetState(ConnectionState.Closed);
}
+#if MONO
+
+ protected void OnStateChange (StateChangeEventArgs stateChangeArgs)
+ {
+ if (StateChange != null)
+ StateChange(this, stateChangeArgs);
+ }
+
+#endif
+
#region GetSchema Support
public override DataTable GetSchema()
Modified: trunk/mysqlclient/MySql.Data.2005.csproj
===================================================================
--- trunk/mysqlclient/MySql.Data.2005.csproj 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/MySql.Data.2005.csproj 2006-08-07 03:06:43 UTC (rev 298)
@@ -105,6 +105,7 @@
<Compile Include="common\Resources.cs" />
<Compile Include="common\SHA1.cs" />
<Compile Include="common\SharedMemoryStream.cs" />
+ <Compile Include="common\SocketStream.cs" />
<Compile Include="common\StreamCreator.cs" />
<Compile Include="common\Version.cs" />
<Compile Include="common\WinCE.cs" />
Modified: trunk/mysqlclient/MySqlConnectionStringBuilder.cs
===================================================================
--- trunk/mysqlclient/MySqlConnectionStringBuilder.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/MySqlConnectionStringBuilder.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -60,7 +60,7 @@
#region Server Properties
-#if !CF
+#if !CF && !MONO
[Category("Connection")]
[Description("Server to connect to")]
#endif
@@ -70,7 +70,7 @@
set { CheckNullAndSet("Server", value); server = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Connection")]
[Description("Database to use initially")]
#endif
@@ -80,7 +80,7 @@
set { CheckNullAndSet("Database", value); database = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Connection")]
[DisplayName("Connection Protocol")]
[Description("Protocol to use for connection to MySQL")]
@@ -92,8 +92,8 @@
set { base["Protocol"] = value; protocol = value; }
}
-#if !CF
- [Category("Connection")]
+#if !CF && !MONO
+ [Category("Connection")]
[DisplayName("Pipe Name")]
[Description("Name of pipe to use when connecting with named pipes (Win32 only)")]
#endif
@@ -103,8 +103,8 @@
set { CheckNullAndSet("Pipe Name", value); pipeName = value; }
}
-#if !CF
- [Category("Connection")]
+#if !CF && !MONO
+ [Category("Connection")]
[DisplayName("Use Compression")]
[Description("Should the connection ues compression")]
[DefaultValue(false)]
@@ -115,8 +115,8 @@
set { base["compress"] = value; compress = value; }
}
-#if !CF
- [Category("Connection")]
+#if !CF && !MONO
+ [Category("Connection")]
[DisplayName("Allow Batch")]
[Description("Allows execution of multiple SQL commands in a single statement")]
[DefaultValue(true)]
@@ -127,8 +127,8 @@
set { base["allow batch"] = value; allowBatch = value; }
}
-#if !CF
- [Category("Connection")]
+#if !CF && !MONO
+ [Category("Connection")]
[Description("Enables output of diagnostic messages")]
[DefaultValue(false)]
#endif
@@ -138,8 +138,8 @@
set { base["logging"] = value; logging = value; }
}
-#if !CF
- [Category("Connection")]
+#if !CF && !MONO
+ [Category("Connection")]
[DisplayName("Shared Memory Name")]
[Description("Name of the shared memory object to use")]
[DefaultValue("MYSQL")]
@@ -150,8 +150,8 @@
set { CheckNullAndSet("Shared Memory Name", value); sharedMemName = value; }
}
-#if !CF
- [Category("Connection")]
+#if !CF && !MONO
+ [Category("Connection")]
[DisplayName("Use Old Syntax")]
[Description("Allows the use of old style @ syntax for parameters")]
[DefaultValue(false)]
@@ -162,8 +162,8 @@
set { base["Old Syntax"] = value; oldSyntax = value; }
}
-#if !CF
- [Category("Connection")]
+#if !CF && !MONO
+ [Category("Connection")]
[DisplayName("Driver Type")]
[Description("Specifies the type of driver to use for this connection")]
[DefaultValue(MySqlDriverType.Native)]
@@ -180,7 +180,7 @@
set { CheckNullAndSet("Option File", value); optionFile = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Connection")]
[Description("Port to use for TCP/IP connections")]
[DefaultValue(3306)]
@@ -191,7 +191,7 @@
set { base["Port"] = value; port = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Connection")]
[DisplayName("Connect Timeout")]
[Description("The length of time (in seconds) to wait for a connection " +
@@ -208,36 +208,42 @@
#region Authentication Properties
+#if !CF && !MONO
[Category("Security")]
[DisplayName("User ID")]
[Description("Indicates the user ID to be used when connecting to the data
source.")]
+#endif
public string UserID
{
get { return this.userId; }
set { CheckNullAndSet("User Id", value); userId = value; }
}
+#if !CF && !MONO
[Category("Security")]
[Description("Indicates the password to be used when connecting to the data
source.")]
+#endif
public string Password
{
get { return this.password; }
set { CheckNullAndSet("Password", value); password = value; }
}
+#if !CF && !MONO
[Category("Security")]
[DisplayName("Persist Security Info")]
[Description("When false, security-sensitive information, such as the password, "
+
"is not returned as part of the connection if the connection is open or " +
"has ever been in an open state.")]
+#endif
public bool PersistSecurityInfo
{
get { return persistSI; }
set { base["Persist Security Info"] = value; persistSI = value; }
}
-#if !CF
- [Category("Authentication")]
+#if !CF && !MONO
+ [Category("Authentication")]
[Description("Should the connection use SSL. This currently has no effect.")]
[DefaultValue(false)]
#endif
@@ -251,8 +257,8 @@
#region Other Properties
-#if !CF
- [Category("Advanced")]
+#if !CF && !MONO
+ [Category("Advanced")]
[DisplayName("Allow Zero Datetime")]
[Description("Should zero datetimes be supported")]
[DefaultValue(false)]
@@ -263,8 +269,8 @@
set { base["Allow Zero DateTime"] = value; allowZeroDatetime = value; }
}
-#if !CF
- [Category("Advanced")]
+#if !CF && !MONO
+ [Category("Advanced")]
[DisplayName("Convert Zero Datetime")]
[Description("Should illegal datetime values be converted to DateTime.MinValue")]
[DefaultValue(false)]
@@ -275,8 +281,8 @@
set { base["Convert Zero DateTime"] = value; convertZeroDatetime = value; }
}
-#if !CF
- [Category("Advanced")]
+#if !CF && !MONO
+ [Category("Advanced")]
[Description("Character set this connection should use")]
#endif
public string CharacterSet
@@ -285,8 +291,8 @@
set { CheckNullAndSet("Character Set", value); charSet = value; }
}
-#if !CF
- [Category("Advanced")]
+#if !CF && !MONO
+ [Category("Advanced")]
[DisplayName("Use Usage Advisor")]
[Description("Logs inefficient database operations")]
[DefaultValue(false)]
@@ -297,8 +303,8 @@
set { base["Use Usage Advisor"] = value; useUsageAdvisor = value; }
}
-#if !CF
- [Category("Advanced")]
+#if !CF && !MONO
+ [Category("Advanced")]
[DisplayName("Procedure Cache Size")]
[Description("Indicates how many stored procedures can be cached at one time. " +
"A value of 0 effectively disables the procedure cache.")]
@@ -310,8 +316,8 @@
set { base["Procedure Cache Size"] = value; procCacheSize = value; }
}
-#if !CF
- [Category("Advanced")]
+#if !CF && !MONO
+ [Category("Advanced")]
[DisplayName("Use Performance Monitor")]
[Description("Indicates that performance counters should be updated during
execution.")]
[DefaultValue(false)]
@@ -326,7 +332,7 @@
#region Pooling Properties
-#if !CF
+#if !CF && !MONO
[Category("Pooling")]
[DisplayName("Load Balance Timeout")]
[Description("The minimum amount of time (in seconds) for this connection to " +
@@ -339,7 +345,7 @@
set { base["Connection Lifetime"] = value; connectionLifetime = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Pooling")]
[Description("When true, the connection object is drawn from the appropriate " +
"pool, or if necessary, is created and added to the appropriate pool.")]
@@ -351,7 +357,7 @@
set { base["Pooling"] = value; pooling = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Pooling")]
[DisplayName("Min Pool Size")]
[Description("The minimum number of connections allowed in the pool.")]
@@ -363,7 +369,7 @@
set { base["Minimum Pool Size"] = value; minPoolSize = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Pooling")]
[DisplayName("Max Pool Size")]
[Description("The maximum number of connections allowed in the pool.")]
@@ -375,7 +381,7 @@
set { base["Maximum Pool Size"] = value; maxPoolSize = value; }
}
-#if !CF
+#if !CF && !MONO
[Category("Pooling")]
[DisplayName("Connection Reset")]
[Description("When true, indicates the connection state is reset when " +
Modified: trunk/mysqlclient/NativeDriver.cs
===================================================================
--- trunk/mysqlclient/NativeDriver.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/NativeDriver.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -189,7 +189,6 @@
throw new MySqlException("Unable to connect to any of the specified MySQL hosts",
ex);
}
-
if (baseStream == null)
throw new MySqlException("Unable to connect to any of the specified MySQL hosts");
Modified: trunk/mysqlclient/common/SharedMemoryStream.cs
===================================================================
--- trunk/mysqlclient/common/SharedMemoryStream.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/common/SharedMemoryStream.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -70,7 +70,7 @@
AutoResetEvent connectRequest = new AutoResetEvent(false);
IntPtr handle = OpenEvent(EVENT_ALL_ACCESS, false,
memoryName + "_" + "CONNECT_REQUEST");
-#if NET20
+#if NET20 && !MONO
connectRequest.SafeWaitHandle = new SafeWaitHandle(handle, true);
#else
connectRequest.Handle = handle;
@@ -79,7 +79,7 @@
AutoResetEvent connectAnswer = new AutoResetEvent(false);
handle = OpenEvent(EVENT_ALL_ACCESS, false,
memoryName + "_" + "CONNECT_ANSWER");
-#if NET20
+#if NET20 && !MONO
connectAnswer.SafeWaitHandle = new SafeWaitHandle(handle, true);
#else
connectAnswer.Handle = handle;
@@ -110,7 +110,7 @@
serverWrote = new AutoResetEvent(false);
IntPtr handle = OpenEvent(EVENT_ALL_ACCESS, false,
dataMemoryName + "_SERVER_WROTE");
-#if NET20
+#if NET20 && !MONO
serverWrote.SafeWaitHandle = new SafeWaitHandle(handle, true);
#else
serverWrote.Handle = handle;
@@ -119,7 +119,7 @@
serverRead = new AutoResetEvent(false);
handle = OpenEvent(EVENT_ALL_ACCESS, false,
dataMemoryName + "_SERVER_READ");
-#if NET20
+#if NET20 && !MONO
serverRead.SafeWaitHandle = new SafeWaitHandle(handle, true);
#else
serverRead.Handle = handle;
@@ -128,7 +128,7 @@
clientWrote = new AutoResetEvent(false);
handle = OpenEvent(EVENT_ALL_ACCESS, false,
dataMemoryName + "_CLIENT_WROTE");
-#if NET20
+#if NET20 && !MONO
clientWrote.SafeWaitHandle = new SafeWaitHandle(handle, true);
#else
clientWrote.Handle = handle;
@@ -137,7 +137,7 @@
clientRead = new AutoResetEvent(false);
handle = OpenEvent(EVENT_ALL_ACCESS, false,
dataMemoryName + "_CLIENT_READ");
-#if NET20
+#if NET20 && !MONO
clientRead.SafeWaitHandle = new SafeWaitHandle(handle, true);
#else
clientRead.Handle = handle;
Modified: trunk/mysqlclient/common/StreamCreator.cs
===================================================================
--- trunk/mysqlclient/common/StreamCreator.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/common/StreamCreator.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -131,7 +131,49 @@
waitHandle.Set();
}
- private Stream CreateSocketStream( IPAddress ip, uint port, bool unix )
+ private Stream CreateSocketStream(IPAddress ip, uint port, bool unix)
+ {
+ SocketStream ss = null;
+ try
+ {
+ //
+ // Lets try to connect
+ EndPoint endPoint;
+
+ if (!Platform.IsWindows() && unix)
+ endPoint = CreateUnixEndPoint(hostList);
+ else
+ endPoint = new IPEndPoint(ip, (int)port);
+
+ ss = unix ?
+ new SocketStream(AddressFamily.Unix, SocketType.Stream,
ProtocolType.IP) :
+ new SocketStream(AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
+ ss.Connect(endPoint, (int)timeOut);
+ }
+ catch (ArgumentOutOfRangeException are)
+ {
+ Logger.LogException(are);
+ ss = null;
+ }
+ catch (SocketException se)
+ {
+ Logger.LogException(se);
+ ss = null;
+ }
+ catch (ObjectDisposedException ode)
+ {
+ Logger.LogException(ode);
+ ss = null;
+ }
+ catch (MySqlException me)
+ {
+ Logger.LogException(me);
+ ss = null;
+ }
+ return ss;
+ }
+
+/* private Stream CreateSocketStream( IPAddress ip, uint port, bool unix )
{
try
{
@@ -175,7 +217,7 @@
Logger.LogException(ode);
return null;
}
- }
+ }*/
}
}
Modified: trunk/mysqlclient/parameter.cs
===================================================================
--- trunk/mysqlclient/parameter.cs 2006-08-05 22:46:17 UTC (rev 297)
+++ trunk/mysqlclient/parameter.cs 2006-08-07 03:06:43 UTC (rev 298)
@@ -230,7 +230,11 @@
#if DESIGN
[Category("Data")]
#endif
- public byte Precision
+#if MONO
+ public override byte Precision
+#else
+ public byte Precision
+#endif
{
get { return precision; }
set { precision = value; }
@@ -242,7 +246,11 @@
#if DESIGN
[Category("Data")]
#endif
- public byte Scale
+#if MONO
+ public override byte Scale
+#else
+ public byte Scale
+#endif
{
get { return scale; }
set { scale = value; }
| Thread |
|---|
| • Connector/NET commit: r298 - in trunk: . TestSuite mysqlclient mysqlclient/common | rburnett | 7 Aug |