List:Commits« Previous MessageNext Message »
From:rburnett Date:May 18 2006 9:08pm
Subject:Connector/NET commit: r235 - in branches/1.0: . TestSuite mysqlclient mysqlclient/Types
View as plain text  
Modified:
   branches/1.0/CHANGES
   branches/1.0/MySQLClient.sln
   branches/1.0/MySql.Data.csproj
   branches/1.0/TestSuite/BaseTest.cs
   branches/1.0/TestSuite/MySql.Data.Tests.csproj
   branches/1.0/TestSuite/PreparedStatements.cs
   branches/1.0/mysqlclient/MysqlDefs.cs
   branches/1.0/mysqlclient/Types/MySqlValue.cs
   branches/1.0/mysqlclient/command.cs
   branches/1.0/mysqlclient/datareader.cs
   branches/1.0/mysqlclient/nativedriver.cs
   branches/1.0/mysqlclient/parameter.cs
   branches/1.0/mysqlclient/parameter_collection.cs
Log:
Bug #18570  	Unsigned tinyint (NET byte) incorrectly determined param type from param val

This bug was causes by two things.  (1) not correctly setting the mysqldbtype to ubyte and
(2) sending the wrong data type to the server for prepared statements

parameter.cs - Changed GetPSType() to send the code for Byte or'ed with 0x8000 (to make it
unsigned).  Also, fixed SetDbTYpe code to properly set the type to UByte for unsigned
tinyint values.
PreparedStatements.cs - Added test case for this bug

Modified: branches/1.0/CHANGES
===================================================================
--- branches/1.0/CHANGES	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/CHANGES	2006-05-18 19:08:04 UTC (rev 235)
@@ -3,6 +3,8 @@
     Bug #17749 There is no char type in MySqlDbType [fixed]
 	Bug #16788 Only byte arrays and strings can be serialized by MySqlBinary [fixed]
 	Bug #16645 FOUND_ROWS() Bug [can't repeat - added test case]
+    Bug #18570 Unsigned tinyint (NET byte) incorrectly determined param type from param
val	[fixed]
+    Bug #19261 Supplying Input Parameters [fixed]
 	
 x-xx-05 - Version 1.0.7
 

Modified: branches/1.0/MySQLClient.sln
===================================================================
--- branches/1.0/MySQLClient.sln	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/MySQLClient.sln	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,7 +1,6 @@
-Microsoft Visual Studio Solution File, Format Version 8.00
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySql.Data", "MySql.Data.csproj",
"{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}"
-	ProjectSection(ProjectDependencies) = postProject
-	EndProjectSection
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySql.Data.Tests",
"TestSuite\MySql.Data.Tests.csproj", "{92CB29DF-61DE-4277-8DC6-D3587C7311EE}"
 	ProjectSection(ProjectDependencies) = postProject
@@ -9,22 +8,21 @@
 	EndProjectSection
 EndProject
 Global
-	GlobalSection(SolutionConfiguration) = preSolution
-		Debug = Debug
-		Release = Release
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
 	EndGlobalSection
-	GlobalSection(ProjectConfiguration) = postSolution
-		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Debug.ActiveCfg = Debug|.NET
-		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Debug.Build.0 = Debug|.NET
-		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Release.ActiveCfg = Release|.NET
-		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Release.Build.0 = Release|.NET
-		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Debug.ActiveCfg = Debug|.NET
-		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Debug.Build.0 = Debug|.NET
-		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Release.ActiveCfg = Release|.NET
-		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Release.Build.0 = Release|.NET
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{92CB29DF-61DE-4277-8DC6-D3587C7311EE}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
 	EndGlobalSection
-	GlobalSection(ExtensibilityAddIns) = postSolution
-	EndGlobalSection
 EndGlobal

Modified: branches/1.0/MySql.Data.csproj
===================================================================
--- branches/1.0/MySql.Data.csproj	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/MySql.Data.csproj	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,450 +1,289 @@
-<VisualStudioProject>
-    <CSHARP
-        ProjectType = "Local"
-        ProductVersion = "7.10.3077"
-        SchemaVersion = "2.0"
-        ProjectGuid = "{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}"
-    >
-        <Build>
-            <Settings
-                ApplicationIcon = ""
-                AssemblyKeyContainerName = ""
-                AssemblyName = "MySql.Data"
-                AssemblyOriginatorKeyFile = ""
-                DefaultClientScript = "JScript"
-                DefaultHTMLPageLayout = "Grid"
-                DefaultTargetSchema = "IE50"
-                DelaySign = "false"
-                OutputType = "Library"
-                PreBuildEvent = ""
-                PostBuildEvent = ""
-                RootNamespace = "MySql.Data.MySqlClient"
-                RunPostBuildEvent = "OnBuildSuccess"
-                StartupObject = ""
-            >
-                <Config
-                    Name = "Debug"
-                    AllowUnsafeBlocks = "false"
-                    BaseAddress = "285212672"
-                    CheckForOverflowUnderflow = "false"
-                    ConfigurationOverrideFile = ""
-                    DefineConstants = "DEBUG;TRACE;WINDOWS"
-                    DocumentationFile = "doc.xml"
-                    DebugSymbols = "true"
-                    FileAlignment = "4096"
-                    IncrementalBuild = "true"
-                    NoStdLib = "false"
-                    NoWarn = ""
-                    Optimize = "false"
-                    OutputPath = "bin\net-1.1\Debug\"
-                    RegisterForComInterop = "false"
-                    RemoveIntegerChecks = "false"
-                    TreatWarningsAsErrors = "false"
-                    WarningLevel = "4"
-                />
-                <Config
-                    Name = "Release"
-                    AllowUnsafeBlocks = "false"
-                    BaseAddress = "285212672"
-                    CheckForOverflowUnderflow = "false"
-                    ConfigurationOverrideFile = ""
-                    DefineConstants = "TRACE;WINDOWS"
-                    DocumentationFile = "doc.xml"
-                    DebugSymbols = "false"
-                    FileAlignment = "4096"
-                    IncrementalBuild = "false"
-                    NoStdLib = "false"
-                    NoWarn = ""
-                    Optimize = "true"
-                    OutputPath = "bin\net-1.1\Release\"
-                    RegisterForComInterop = "false"
-                    RemoveIntegerChecks = "false"
-                    TreatWarningsAsErrors = "false"
-                    WarningLevel = "4"
-                />
-            </Settings>
-            <References>
-                <Reference
-                    Name = "System"
-                    AssemblyName = "System"
-                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.dll"
-                />
-                <Reference
-                    Name = "System.Data"
-                    AssemblyName = "System.Data"
-                    HintPath =
"C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.Data.dll"
-                />
-                <Reference
-                    Name = "System.XML"
-                    AssemblyName = "System.Xml"
-                    HintPath =
"C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\System.XML.dll"
-                />
-                <Reference
-                    Name = "System.Design"
-                    AssemblyName = "System.Design"
-                    HintPath =
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Design.dll"
-                />
-                <Reference
-                    Name = "System.Drawing"
-                    AssemblyName = "System.Drawing"
-                    HintPath =
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
-                />
-                <Reference
-                    Name = "ICSharpCode.SharpZipLib"
-                    AssemblyName = "ICSharpCode.SharpZipLib"
-                    HintPath = "ICSharpCode.SharpZipLib.dll"
-                    Private = "True"
-                />
-            </References>
-        </Build>
-        <Files>
-            <Include>
-                <File
-                    RelPath = "CHANGES"
-                    BuildAction = "None"
-                />
-                <File
-                    RelPath = "Client.build"
-                    BuildAction = "None"
-                />
-                <File
-                    RelPath = "README"
-                    BuildAction = "None"
-                />
-                <File
-                    RelPath = "Installer\main.wxs"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "Installer\ui.wxs"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\AssemblyInfo.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\CharSetMap.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\command.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\CommandBuilder.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\CommandResult.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\CompressedStream.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Connection.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\ConnectionString.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Crypt.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\dataadapter.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\datareader.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Driver.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Exception.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Field.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Logger.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\MysqlDefs.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\MySqlError.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\MySqlHelper.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\MySqlPool.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\MySqlPoolManager.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\NativeDriver.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\PacketReader.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\PacketWriter.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\parameter.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\parameter_collection.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\PreparedStatement.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\SharedMemoryStream.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\StoredProcedure.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Strings.resx"
-                    BuildAction = "EmbeddedResource"
-                />
-                <File
-                    RelPath = "MySqlClient\transaction.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\DBConnectionString.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\NamedPipeStream.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\NativeMethods.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\Platform.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\Resources.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\SocketStream.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\StreamCreator.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\Utility.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\common\Version.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlCommand.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlCommandBuilder.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlConnection.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlDataAdapter.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlDataReader.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlException.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlHelper.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlParameter.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlParameterCollection.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\docs\MySqlTransaction.xml"
-                    BuildAction = "Content"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlBinary.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlBit.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlByte.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlConversionException.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlDateTime.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlDecimal.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlDouble.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlInt16.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlInt32.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlInt64.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlSingle.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlString.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlTime.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlUByte.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlUInt16.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlUInt32.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlUInt64.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlClient\Types\MySqlValue.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-            </Include>
-        </Files>
-    </CSHARP>
-</VisualStudioProject>
-
+<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{5EAEFBC4-8389-4120-BAB3-9B27174F6F6F}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == ''
">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon>
+    </ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>MySql.Data</AssemblyName>
+    <AssemblyOriginatorKeyFile>
+    </AssemblyOriginatorKeyFile>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <RootNamespace>MySql.Data.MySqlClient</RootNamespace>
+    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+    <StartupObject>
+    </StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <OutputPath>bin\net-1.1\Debug\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
+    <DocumentationFile>doc.xml</DocumentationFile>
+    <DebugSymbols>true</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>false</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>full</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <OutputPath>bin\net-1.1\Release\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE;WINDOWS</DefineConstants>
+    <DocumentationFile>doc.xml</DocumentationFile>
+    <DebugSymbols>false</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>true</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>none</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="ICSharpCode.SharpZipLib">
+      <Name>ICSharpCode.SharpZipLib</Name>
+      <HintPath>ICSharpCode.SharpZipLib.dll</HintPath>
+      <Private>True</Private>
+    </Reference>
+    <Reference Include="System">
+      <Name>System</Name>
+    </Reference>
+    <Reference Include="System.Data">
+      <Name>System.Data</Name>
+    </Reference>
+    <Reference Include="System.Design">
+      <Name>System.Design</Name>
+    </Reference>
+    <Reference Include="System.Drawing">
+      <Name>System.Drawing</Name>
+    </Reference>
+    <Reference Include="System.Xml">
+      <Name>System.XML</Name>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="CHANGES" />
+    <None Include="Client.build" />
+    <None Include="README" />
+    <Content Include="Installer\main.wxs" />
+    <Content Include="Installer\ui.wxs" />
+    <Content Include="MySqlClient\docs\MySqlCommand.xml" />
+    <Content Include="MySqlClient\docs\MySqlCommandBuilder.xml" />
+    <Content Include="MySqlClient\docs\MySqlConnection.xml" />
+    <Content Include="MySqlClient\docs\MySqlDataAdapter.xml" />
+    <Content Include="MySqlClient\docs\MySqlDataReader.xml" />
+    <Content Include="MySqlClient\docs\MySqlException.xml" />
+    <Content Include="MySqlClient\docs\MySqlHelper.xml" />
+    <Content Include="MySqlClient\docs\MySqlParameter.xml" />
+    <Content Include="MySqlClient\docs\MySqlParameterCollection.xml" />
+    <Content Include="MySqlClient\docs\MySqlTransaction.xml" />
+    <Compile Include="MySqlClient\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\CharSetMap.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\command.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\CommandBuilder.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\CommandResult.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\DBConnectionString.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\NamedPipeStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\NativeMethods.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\Platform.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\Resources.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\SocketStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\StreamCreator.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\Utility.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\common\Version.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\CompressedStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Connection.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\ConnectionString.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Crypt.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\dataadapter.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\datareader.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Driver.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Exception.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Field.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Logger.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\MysqlDefs.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\MySqlError.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\MySqlHelper.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\MySqlPool.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\MySqlPoolManager.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\NativeDriver.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\PacketReader.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\PacketWriter.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\parameter.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\parameter_collection.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\PreparedStatement.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\SharedMemoryStream.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\StoredProcedure.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\transaction.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlBinary.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlBit.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlByte.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlConversionException.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlDateTime.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlDecimal.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlDouble.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlInt16.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlInt32.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlInt64.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlSingle.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlString.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlTime.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlUByte.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlUInt16.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlUInt32.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlUInt64.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlClient\Types\MySqlValue.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <EmbeddedResource Include="MySqlClient\Strings.resx" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

Modified: branches/1.0/TestSuite/BaseTest.cs
===================================================================
--- branches/1.0/TestSuite/BaseTest.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/TestSuite/BaseTest.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,21 +1,21 @@
-// Copyright (C) 2004-2005 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
+// Copyright (C) 2004-2005 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;

Modified: branches/1.0/TestSuite/MySql.Data.Tests.csproj
===================================================================
--- branches/1.0/TestSuite/MySql.Data.Tests.csproj	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/TestSuite/MySql.Data.Tests.csproj	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,220 +1,177 @@
-<VisualStudioProject>
-    <CSHARP
-        ProjectType = "Local"
-        ProductVersion = "7.10.3077"
-        SchemaVersion = "2.0"
-        ProjectGuid = "{92CB29DF-61DE-4277-8DC6-D3587C7311EE}"
-    >
-        <Build>
-            <Settings
-                ApplicationIcon = ""
-                AssemblyKeyContainerName = ""
-                AssemblyName = "MySql.Data.Tests"
-                AssemblyOriginatorKeyFile = ""
-                DefaultClientScript = "JScript"
-                DefaultHTMLPageLayout = "Grid"
-                DefaultTargetSchema = "IE50"
-                DelaySign = "false"
-                OutputType = "Library"
-                PreBuildEvent = ""
-                PostBuildEvent = ""
-                RootNamespace = "MySql.Data.MySqlClient.Tests"
-                RunPostBuildEvent = "OnBuildSuccess"
-                StartupObject = ""
-            >
-                <Config
-                    Name = "Debug"
-                    AllowUnsafeBlocks = "false"
-                    BaseAddress = "285212672"
-                    CheckForOverflowUnderflow = "false"
-                    ConfigurationOverrideFile = ""
-                    DefineConstants = "DEBUG;TRACE"
-                    DocumentationFile = ""
-                    DebugSymbols = "true"
-                    FileAlignment = "4096"
-                    IncrementalBuild = "false"
-                    NoStdLib = "false"
-                    NoWarn = ""
-                    Optimize = "false"
-                    OutputPath = "bin\Debug\"
-                    RegisterForComInterop = "false"
-                    RemoveIntegerChecks = "false"
-                    TreatWarningsAsErrors = "false"
-                    WarningLevel = "4"
-                />
-                <Config
-                    Name = "Release"
-                    AllowUnsafeBlocks = "false"
-                    BaseAddress = "285212672"
-                    CheckForOverflowUnderflow = "false"
-                    ConfigurationOverrideFile = ""
-                    DefineConstants = "TRACE"
-                    DocumentationFile = ""
-                    DebugSymbols = "false"
-                    FileAlignment = "4096"
-                    IncrementalBuild = "false"
-                    NoStdLib = "false"
-                    NoWarn = ""
-                    Optimize = "true"
-                    OutputPath = "bin\Release\"
-                    RegisterForComInterop = "false"
-                    RemoveIntegerChecks = "false"
-                    TreatWarningsAsErrors = "false"
-                    WarningLevel = "4"
-                />
-            </Settings>
-            <References>
-                <Reference
-                    Name = "System"
-                    AssemblyName = "System"
-                    HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
-                />
-                <Reference
-                    Name = "System.Data"
-                    AssemblyName = "System.Data"
-                    HintPath =
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
-                />
-                <Reference
-                    Name = "System.XML"
-                    AssemblyName = "System.Xml"
-                    HintPath =
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
-                />
-                <Reference
-                    Name = "MySQL.Data"
-                    AssemblyName = "MySql.Data"
-                    HintPath = "..\bin\net-1.1\Debug\MySQL.Data.dll"
-                />
-                <Reference
-                    Name = "nunit.framework"
-                    AssemblyName = "nunit.framework"
-                    HintPath = "..\..\..\..\..\Program Files (x86)\TestDriven.NET
2.0\NUnit\nunit.framework.dll"
-                />
-            </References>
-        </Build>
-        <Files>
-            <Include>
-                <File
-                    RelPath = "AssemblyInfo.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "BaseTest.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "BlobTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "CharacterSetTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "CommandBuilderTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "CommandTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "ConnectionTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "CultureTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "DataAdapterTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "DataReaderTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "DataTypeTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "DateTimeTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "EventTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "Exceptions.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "LanguageTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "MySqlHelperTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "ParameterTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "PoolingTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "PreparedStatements.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "StoredProcedure.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "StressTests.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "Syntax.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "Transactions.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-                <File
-                    RelPath = "Utils.cs"
-                    SubType = "Code"
-                    BuildAction = "Compile"
-                />
-            </Include>
-        </Files>
-    </CSHARP>
-</VisualStudioProject>
-
+<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <ProjectType>Local</ProjectType>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{92CB29DF-61DE-4277-8DC6-D3587C7311EE}</ProjectGuid>
+    <Configuration Condition=" '$(Configuration)' == ''
">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ApplicationIcon>
+    </ApplicationIcon>
+    <AssemblyKeyContainerName>
+    </AssemblyKeyContainerName>
+    <AssemblyName>MySql.Data.Tests</AssemblyName>
+    <AssemblyOriginatorKeyFile>
+    </AssemblyOriginatorKeyFile>
+    <DefaultClientScript>JScript</DefaultClientScript>
+    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
+    <DefaultTargetSchema>IE50</DefaultTargetSchema>
+    <DelaySign>false</DelaySign>
+    <OutputType>Library</OutputType>
+    <RootNamespace>MySql.Data.MySqlClient.Tests</RootNamespace>
+    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
+    <StartupObject>
+    </StartupObject>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <OutputPath>bin\Debug\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>true</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>false</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>full</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+    <UseVSHostingProcess>true</UseVSHostingProcess>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <OutputPath>bin\Release\</OutputPath>
+    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
+    <BaseAddress>285212672</BaseAddress>
+    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
+    <ConfigurationOverrideFile>
+    </ConfigurationOverrideFile>
+    <DefineConstants>TRACE</DefineConstants>
+    <DocumentationFile>
+    </DocumentationFile>
+    <DebugSymbols>false</DebugSymbols>
+    <FileAlignment>4096</FileAlignment>
+    <NoStdLib>false</NoStdLib>
+    <NoWarn>
+    </NoWarn>
+    <Optimize>true</Optimize>
+    <RegisterForComInterop>false</RegisterForComInterop>
+    <RemoveIntegerChecks>false</RemoveIntegerChecks>
+    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
+    <WarningLevel>4</WarningLevel>
+    <DebugType>none</DebugType>
+    <ErrorReport>prompt</ErrorReport>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="MySql.Data">
+      <Name>MySQL.Data</Name>
+      <HintPath>..\bin\net-1.1\Debug\MySQL.Data.dll</HintPath>
+    </Reference>
+    <Reference Include="nunit.framework">
+      <Name>nunit.framework</Name>
+      <HintPath>..\..\..\..\..\Program Files %28x86%29\TestDriven.NET
2.0\NUnit\nunit.framework.dll</HintPath>
+    </Reference>
+    <Reference Include="System">
+      <Name>System</Name>
+    </Reference>
+    <Reference Include="System.Data">
+      <Name>System.Data</Name>
+    </Reference>
+    <Reference Include="System.Xml">
+      <Name>System.XML</Name>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="BaseTest.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="BlobTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="CharacterSetTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="CommandBuilderTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="CommandTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ConnectionTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="CultureTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="DataAdapterTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="DataReaderTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="DataTypeTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="DateTimeTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="EventTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Exceptions.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="LanguageTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="MySqlHelperTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="ParameterTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="PoolingTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="PreparedStatements.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="StoredProcedure.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="StressTests.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Syntax.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Transactions.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Utils.cs">
+      <SubType>Code</SubType>
+    </Compile>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PreBuildEvent>
+    </PreBuildEvent>
+    <PostBuildEvent>
+    </PostBuildEvent>
+  </PropertyGroup>
+</Project>
\ No newline at end of file

Modified: branches/1.0/TestSuite/PreparedStatements.cs
===================================================================
--- branches/1.0/TestSuite/PreparedStatements.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/TestSuite/PreparedStatements.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -578,5 +578,45 @@
 			Assert.AreEqual(1, dt.Rows[0]["id"]);
 			Assert.AreEqual("short string", dt.Rows[0]["name"]);
 		}
+
+        /// <summary>
+        /// Bug #18570  	Unsigned tinyint (NET byte) incorrectly determined param type
from param val
+        /// </summary>
+        [Test]
+        [Category("4.1")]
+        public void UnsignedTinyInt()
+        {
+            execSQL("DROP TABLE IF EXISTS test");
+            execSQL("CREATE TABLE test(ID TINYINT UNSIGNED NOT NULL, " +
+	            "Name VARCHAR(50) NOT NULL,	PRIMARY KEY (ID), UNIQUE (ID), " +
+                "UNIQUE (Name))");
+            execSQL("INSERT INTO test VALUES ('127', 'name1')");
+            execSQL("INSERT INTO test VALUES ('128', 'name2')");
+            execSQL("INSERT INTO test VALUES ('255', 'name3')");
+
+            string sql = " SELECT count(*) FROM TEST WHERE ID = ?id";
+
+            MySqlCommand command = new MySqlCommand();
+            command.CommandText = sql;
+            command.CommandType = CommandType.Text;
+            command.Connection = (MySqlConnection)conn;
+            command.Prepare();
+
+            command.Parameters.Add("?id", (byte)127);
+            object count = command.ExecuteScalar();
+            Assert.AreEqual(1, count);
+
+            command.Parameters.Add("?id", (byte)128);
+            count = command.ExecuteScalar();
+            Assert.AreEqual(1, count);
+
+            command.Parameters.Add("?id", (byte)255);
+            count = command.ExecuteScalar();
+            Assert.AreEqual(1, count);
+
+            command.Parameters.Add("?id", "255");
+            count = command.ExecuteScalar();
+            Assert.AreEqual(1, count);
+        }
 	}
 }

Modified: branches/1.0/mysqlclient/MysqlDefs.cs
===================================================================
--- branches/1.0/mysqlclient/MysqlDefs.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/mysqlclient/MysqlDefs.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,158 +1,158 @@
-// Copyright (C) 2004-2005 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;
-
-namespace MySql.Data.MySqlClient
-{
-	/// <summary>
-	/// Summary description for ClientParam.
-	/// </summary>
-	[Flags()]
-	internal enum ClientFlags
-	{
-		LONG_PASSWORD		= 1,			// new more secure passwords
-		FOUND_ROWS			= 2,			// found instead of affected rows
-		LONG_FLAG			= 4,			// Get all column flags
-		CONNECT_WITH_DB		= 8,			// One can specify db on connect
-		NO_SCHEMA			= 16,			// Don't allow db.table.column
-		COMPRESS			= 32,			// Client can use compression protocol
-		ODBC				= 64,			// ODBC client
-		LOCAL_FILES			= 128,			// Can use LOAD DATA LOCAL
-		IGNORE_SPACE		= 256,			// Ignore spaces before '('
-		PROTOCOL_41			= 512,			// Support new 4.1 protocol
-		INTERACTIVE			= 1024,			// This is an interactive client
-		SSL					= 2048,			// Switch to SSL after handshake
-		IGNORE_SIGPIPE		= 4096,			// IGNORE sigpipes
-		TRANSACTIONS		= 8192,			// Client knows about transactions
-		RESERVED			= 16384,		// old 4.1 protocol flag
-		SECURE_CONNECTION	= 32768,		// new 4.1 authentication
-		MULTI_STATEMENTS	= 65536,		// Allow multi-stmt support
-		MULTI_RESULTS		= 131072		// Allow multiple resultsets
-	}
-	
-	[Flags()]
-	internal enum ServerStatusFlags
-	{
-		InTransaction = 1,						// Transaction has started
-		AutoCommitMode = 2,						// Server in auto_commit mode 
-		MoreResults = 4,						// More results on server
-		AnotherQuery = 8,						// Multi query - next query exists
-		BadIndex = 16,
-		NoIndex = 32
-	}
-
-
-	/// <summary>
-	/// DB Operations Code
-	/// </summary>
-	internal enum DBCmd : byte
-	{
-		SLEEP			=  0,
-		QUIT			=  1,
-		INIT_DB			=  2,
-		QUERY			=  3,
-		FIELD_LIST		=  4,
-		CREATE_DB		=  5,
-		DROP_DB			=  6,
-		RELOAD			=  7,
-		SHUTDOWN		=  8,
-		STATISTICS		=  9,
-		PROCESS_INFO	= 10,
-		CONNECT			= 11,
-		PROCESS_KILL	= 12,
-		DEBUG			= 13,
-		PING			= 14,
-		TIME			= 15,
-		DELAYED_INSERT	= 16,
-		CHANGE_USER		= 17,
-		BINLOG_DUMP		= 18,
-		TABLE_DUMP		= 19,
-		CONNECT_OUT		= 20,
-		REGISTER_SLAVE	= 21,
-		PREPARE			= 22,
-		EXECUTE			= 23,
-		LONG_DATA		= 24,
-		CLOSE_STMT		= 25,
-		RESET_STMT		= 26,
-		SET_OPTION		= 27
-	}
-
-	/// <summary>
-	/// Specifies MySQL specific data type of a field, property, for use in a <see
cref="MySqlParameter"/>.
-	/// </summary>
-	public enum MySqlDbType
-	{
-		/// <summary> <see cref="Decimal"/><para>A fixed precision and scale
numeric value between -1038 -1 and 10 38 -1.</para></summary>
-		Decimal		=   0,  
-		/// <summary> <see cref="Byte"/><para>The signed range is -128 to
127. The unsigned range is 0 to 255.</para></summary>
-		Byte		=   1,  
-		/// <summary><see cref="Int16"/><para>A 16-bit signed integer. The
signed range is -32768 to 32767. The unsigned range is 0 to
65535</para></summary>
-		Int16       =   2,
-		/// <summary>Specifies a 24 (3 byte) signed or unsigned value.</summary>
-		Int24       =   9,
-		/// <summary><see cref="Int32"/><para>A 32-bit signed
integer</para></summary>
-		Int32       =   3,
-		/// <summary><see cref="Int64"/><para>A 64-bit signed
integer.</para></summary>
-		Int64       =   8,
-		/// <summary><see cref="Single"/><para>A small (single-precision)
floating-point number. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and
1.175494351E-38 to 3.402823466E+38.</para></summary>
-		Float       =   4,
-		/// <summary><see cref="Double"/><para>A normal-size
(double-precision) floating-point number. Allowable values are -1.7976931348623157E+308
to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to
1.7976931348623157E+308.</para></summary>
-		Double      =   5,
-		/// <summary>A timestamp. The range is '1970-01-01 00:00:00' to sometime in the
year 2037</summary>
-		Timestamp   =   7,
-		///<summary>Date The supported range is '1000-01-01' to
'9999-12-31'.</summary>
-		Date        =  10,
-		/// <summary> Time <para>The range is '-838:59:59' to
'838:59:59'.</para></summary>
-		Time        =  11,
-		///<summary>DateTime The supported range is '1000-01-01 00:00:00' to '9999-12-31
23:59:59'.</summary>
-		Datetime    =  12,  
-		/// <summary>A year in 2- or 4-digit format (default is 4-digit). The allowable
values are 1901 to 2155, 0000 in the 4-digit year format, and 1970-2069 if you use the
2-digit format (70-69)</summary>
-		Year        =  13,
-		/// <summary><b>Obsolete</b>  Use Datetime or Date
type</summary>
-		Newdate     =  14,
-		/// <summary>A variable-length string containing 0 to 65535
characters</summary>
-		VarString = 15,
-		/// <summary>Bit-field data type</summary>
-		Bit = 16,
-		/// <summary>New Decimal</summary>
-		NewDecimal = 246,
-		/// <summary>An enumeration. A string object that can have only one value, chosen
from the list of values 'value1', 'value2', ..., NULL or the special "" error value. An
ENUM can have a maximum of 65535 distinct values</summary>
-		Enum        = 247,
-		/// <summary>A set. A string object that can have zero or more values, each of
which must be chosen from the list of values 'value1', 'value2', ... A SET can have a
maximum of 64 members.</summary>
-		Set         = 248,
-		/// <summary>A BLOB or TEXT column with a maximum length of 255 (2^8 - 1)
characters</summary>
-		TinyBlob    = 249,
-		/// <summary>A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1)
characters</summary>
-		MediumBlob  = 250,
-		/// <summary>A BLOB or TEXT column with a maximum length of 4294967295 or 4G
(2^32 - 1) characters</summary>
-		LongBlob    = 251,
-		/// <summary>A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1)
characters</summary>
-		Blob        = 252,
-		/// <summary>A variable-length string containing 0 to 255
characters</summary>
-		VarChar     = 253,
-		/// <summary><b>Obsolete</b>  Use VarChar type</summary>
-		Char        = 254,
-		/// <summary></summary>
-		Geometry	= 255,
+// Copyright (C) 2004-2005 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;
+
+namespace MySql.Data.MySqlClient
+{
+	/// <summary>
+	/// Summary description for ClientParam.
+	/// </summary>
+	[Flags()]
+	internal enum ClientFlags
+	{
+		LONG_PASSWORD		= 1,			// new more secure passwords
+		FOUND_ROWS			= 2,			// found instead of affected rows
+		LONG_FLAG			= 4,			// Get all column flags
+		CONNECT_WITH_DB		= 8,			// One can specify db on connect
+		NO_SCHEMA			= 16,			// Don't allow db.table.column
+		COMPRESS			= 32,			// Client can use compression protocol
+		ODBC				= 64,			// ODBC client
+		LOCAL_FILES			= 128,			// Can use LOAD DATA LOCAL
+		IGNORE_SPACE		= 256,			// Ignore spaces before '('
+		PROTOCOL_41			= 512,			// Support new 4.1 protocol
+		INTERACTIVE			= 1024,			// This is an interactive client
+		SSL					= 2048,			// Switch to SSL after handshake
+		IGNORE_SIGPIPE		= 4096,			// IGNORE sigpipes
+		TRANSACTIONS		= 8192,			// Client knows about transactions
+		RESERVED			= 16384,		// old 4.1 protocol flag
+		SECURE_CONNECTION	= 32768,		// new 4.1 authentication
+		MULTI_STATEMENTS	= 65536,		// Allow multi-stmt support
+		MULTI_RESULTS		= 131072		// Allow multiple resultsets
+	}
+	
+	[Flags()]
+	internal enum ServerStatusFlags
+	{
+		InTransaction = 1,						// Transaction has started
+		AutoCommitMode = 2,						// Server in auto_commit mode 
+		MoreResults = 4,						// More results on server
+		AnotherQuery = 8,						// Multi query - next query exists
+		BadIndex = 16,
+		NoIndex = 32
+	}
+
+
+	/// <summary>
+	/// DB Operations Code
+	/// </summary>
+	internal enum DBCmd : byte
+	{
+		SLEEP			=  0,
+		QUIT			=  1,
+		INIT_DB			=  2,
+		QUERY			=  3,
+		FIELD_LIST		=  4,
+		CREATE_DB		=  5,
+		DROP_DB			=  6,
+		RELOAD			=  7,
+		SHUTDOWN		=  8,
+		STATISTICS		=  9,
+		PROCESS_INFO	= 10,
+		CONNECT			= 11,
+		PROCESS_KILL	= 12,
+		DEBUG			= 13,
+		PING			= 14,
+		TIME			= 15,
+		DELAYED_INSERT	= 16,
+		CHANGE_USER		= 17,
+		BINLOG_DUMP		= 18,
+		TABLE_DUMP		= 19,
+		CONNECT_OUT		= 20,
+		REGISTER_SLAVE	= 21,
+		PREPARE			= 22,
+		EXECUTE			= 23,
+		LONG_DATA		= 24,
+		CLOSE_STMT		= 25,
+		RESET_STMT		= 26,
+		SET_OPTION		= 27
+	}
+
+	/// <summary>
+	/// Specifies MySQL specific data type of a field, property, for use in a <see
cref="MySqlParameter"/>.
+	/// </summary>
+	public enum MySqlDbType
+	{
+		/// <summary> <see cref="Decimal"/><para>A fixed precision and scale
numeric value between -1038 -1 and 10 38 -1.</para></summary>
+		Decimal		=   0,  
+		/// <summary> <see cref="Byte"/><para>The signed range is -128 to
127. The unsigned range is 0 to 255.</para></summary>
+		Byte		=   1,  
+		/// <summary><see cref="Int16"/><para>A 16-bit signed integer. The
signed range is -32768 to 32767. The unsigned range is 0 to
65535</para></summary>
+		Int16       =   2,
+		/// <summary>Specifies a 24 (3 byte) signed or unsigned value.</summary>
+		Int24       =   9,
+		/// <summary><see cref="Int32"/><para>A 32-bit signed
integer</para></summary>
+		Int32       =   3,
+		/// <summary><see cref="Int64"/><para>A 64-bit signed
integer.</para></summary>
+		Int64       =   8,
+		/// <summary><see cref="Single"/><para>A small (single-precision)
floating-point number. Allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and
1.175494351E-38 to 3.402823466E+38.</para></summary>
+		Float       =   4,
+		/// <summary><see cref="Double"/><para>A normal-size
(double-precision) floating-point number. Allowable values are -1.7976931348623157E+308
to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to
1.7976931348623157E+308.</para></summary>
+		Double      =   5,
+		/// <summary>A timestamp. The range is '1970-01-01 00:00:00' to sometime in the
year 2037</summary>
+		Timestamp   =   7,
+		///<summary>Date The supported range is '1000-01-01' to
'9999-12-31'.</summary>
+		Date        =  10,
+		/// <summary> Time <para>The range is '-838:59:59' to
'838:59:59'.</para></summary>
+		Time        =  11,
+		///<summary>DateTime The supported range is '1000-01-01 00:00:00' to '9999-12-31
23:59:59'.</summary>
+		Datetime    =  12,  
+		/// <summary>A year in 2- or 4-digit format (default is 4-digit). The allowable
values are 1901 to 2155, 0000 in the 4-digit year format, and 1970-2069 if you use the
2-digit format (70-69)</summary>
+		Year        =  13,
+		/// <summary><b>Obsolete</b>  Use Datetime or Date
type</summary>
+		Newdate     =  14,
+		/// <summary>A variable-length string containing 0 to 65535
characters</summary>
+		VarString = 15,
+		/// <summary>Bit-field data type</summary>
+		Bit = 16,
+		/// <summary>New Decimal</summary>
+		NewDecimal = 246,
+		/// <summary>An enumeration. A string object that can have only one value, chosen
from the list of values 'value1', 'value2', ..., NULL or the special "" error value. An
ENUM can have a maximum of 65535 distinct values</summary>
+		Enum        = 247,
+		/// <summary>A set. A string object that can have zero or more values, each of
which must be chosen from the list of values 'value1', 'value2', ... A SET can have a
maximum of 64 members.</summary>
+		Set         = 248,
+		/// <summary>A BLOB or TEXT column with a maximum length of 255 (2^8 - 1)
characters</summary>
+		TinyBlob    = 249,
+		/// <summary>A BLOB or TEXT column with a maximum length of 16777215 (2^24 - 1)
characters</summary>
+		MediumBlob  = 250,
+		/// <summary>A BLOB or TEXT column with a maximum length of 4294967295 or 4G
(2^32 - 1) characters</summary>
+		LongBlob    = 251,
+		/// <summary>A BLOB or TEXT column with a maximum length of 65535 (2^16 - 1)
characters</summary>
+		Blob        = 252,
+		/// <summary>A variable-length string containing 0 to 255
characters</summary>
+		VarChar     = 253,
+		/// <summary><b>Obsolete</b>  Use VarChar type</summary>
+		Char        = 254,
 		/// <summary></summary>
+		Geometry	= 255,
+		/// <summary></summary>
 		UByte		= 1024,
 		/// <summary></summary>
 		UInt16		= 1025,
@@ -162,33 +162,33 @@
 		UInt32		= 1027,
 		/// <summary></summary>
 		UInt64		= 1028
-	};
-
-
-	enum Field_Type : byte
-	{
-		DECIMAL					=0,
-		BYTE					=1,
-		SHORT					=2,
-		LONG					=3,
-		FLOAT					=4,
-		DOUBLE					=5,
-		NULL					=6,
-		TIMESTAMP				=7,
-		LONGLONG				=8,
-		INT24					=9,
-		DATE					=10,
-		TIME					=11,
-		DATETIME				=12,
-		YEAR					=13,
-		NEWDATE					=14,
-		ENUM					=247,
-		SET						=248,
-		TINY_BLOB				=249,
-		MEDIUM_BLOB				=250,
-		LONG_BLOB				=251,
-		BLOB					=252,
-		VAR_STRING				=253,
-		STRING					=254,
-	}
-}
+	};
+
+
+	enum Field_Type : byte
+	{
+		DECIMAL					=0,
+		BYTE					=1,
+		SHORT					=2,
+		LONG					=3,
+		FLOAT					=4,
+		DOUBLE					=5,
+		NULL					=6,
+		TIMESTAMP				=7,
+		LONGLONG				=8,
+		INT24					=9,
+		DATE					=10,
+		TIME					=11,
+		DATETIME				=12,
+		YEAR					=13,
+		NEWDATE					=14,
+		ENUM					=247,
+		SET						=248,
+		TINY_BLOB				=249,
+		MEDIUM_BLOB				=250,
+		LONG_BLOB				=251,
+		BLOB					=252,
+		VAR_STRING				=253,
+		STRING					=254,
+	}
+}

Modified: branches/1.0/mysqlclient/Types/MySqlValue.cs
===================================================================
--- branches/1.0/mysqlclient/Types/MySqlValue.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/mysqlclient/Types/MySqlValue.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,23 +1,23 @@
-// Copyright (C) 2004-2005 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 
-
+// Copyright (C) 2004-2005 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.Data;
 using System.Globalization;

Modified: branches/1.0/mysqlclient/command.cs
===================================================================
--- branches/1.0/mysqlclient/command.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/mysqlclient/command.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,662 +1,662 @@
-// Copyright (C) 2004-2005 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.Data;
-using System.ComponentModel;
-using System.IO;
-using System.Collections;
-using System.Text;
-using MySql.Data.Common;
-
-namespace MySql.Data.MySqlClient
-{
-	/// <include file='docs/mysqlcommand.xml' path='docs/ClassSummary/*'/>
-#if WINDOWS
-	[System.Drawing.ToolboxBitmap( typeof(MySqlCommand),
"MySqlClient.resources.command.bmp")]
-#endif
-	[System.ComponentModel.DesignerCategory("Code")]
-	public sealed class MySqlCommand : Component, IDbCommand, ICloneable
-	{
-		MySqlConnection				connection;
-		MySqlTransaction			curTransaction;
-		string						cmdText;
-		CommandType					cmdType;
-		long						updateCount;
-		UpdateRowSource				updatedRowSource;
-		MySqlParameterCollection	parameters;
-		private ArrayList			sqlBuffers;
-		private PreparedStatement	preparedStatement;
-		private ArrayList			parameterMap;
-		private StoredProcedure		storedProcedure;
-		private CommandResult		lastResult;
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ctor1/*'/>
-		public MySqlCommand()
-		{
-			cmdType = CommandType.Text;
-			parameterMap = new ArrayList();
-			parameters = new MySqlParameterCollection();
-			updatedRowSource = UpdateRowSource.Both;
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ctor2/*'/>
-		public MySqlCommand(string cmdText) : this()
-		{
-			CommandText = cmdText;
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ctor3/*'/>
-		public MySqlCommand(string cmdText, MySqlConnection connection) : this(cmdText)
-		{
-			Connection = connection;
-			if (connection != null)
-				parameters.ParameterMarker = connection.ParameterMarker;
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ctor4/*'/>
-		public MySqlCommand(string cmdText, MySqlConnection connection, 
-			MySqlTransaction transaction) : this(cmdText, connection)
-		{
-			curTransaction = transaction;
-		} 
-
-		#region Properties
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/CommandText/*'/>
-		[Category("Data")]
-		[Description("Command text to execute")]
-#if WINDOWS
-		[Editor("MySql.Data.Common.Design.SqlCommandTextEditor,MySqlClient.Design",
typeof(System.Drawing.Design.UITypeEditor))]
-#endif
-		public string CommandText
-		{
-			get { return cmdText; }
-			set { cmdText = value;  this.preparedStatement=null; }
-		}
-
-		internal int UpdateCount 
-		{
-			get { return (int)updateCount; }
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/CommandTimeout/*'/>
-		[Category("Misc")]
-		[Description("Time to wait for command to execute")]
-		public int CommandTimeout
-		{
-			// TODO: support this
-			get  { return 0; }
-			set  { if (value != 0) throw new NotSupportedException(); }
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/CommandType/*'/>
-		[Category("Data")]
-		public CommandType CommandType
-		{
-			get { return cmdType; }
-			set { cmdType = value; }
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/IsPrepared/*'/>
-		[Browsable(false)]
-		public bool IsPrepared 
-		{
-			get { return preparedStatement != null; }
-		}
-
+// Copyright (C) 2004-2005 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.Data;
+using System.ComponentModel;
+using System.IO;
+using System.Collections;
+using System.Text;
+using MySql.Data.Common;
+
+namespace MySql.Data.MySqlClient
+{
+	/// <include file='docs/mysqlcommand.xml' path='docs/ClassSummary/*'/>
+#if WINDOWS
+	[System.Drawing.ToolboxBitmap( typeof(MySqlCommand),
"MySqlClient.resources.command.bmp")]
+#endif
+	[System.ComponentModel.DesignerCategory("Code")]
+	public sealed class MySqlCommand : Component, IDbCommand, ICloneable
+	{
+		MySqlConnection				connection;
+		MySqlTransaction			curTransaction;
+		string						cmdText;
+		CommandType					cmdType;
+		long						updateCount;
+		UpdateRowSource				updatedRowSource;
+		MySqlParameterCollection	parameters;
+		private ArrayList			sqlBuffers;
+		private PreparedStatement	preparedStatement;
+		private ArrayList			parameterMap;
+		private StoredProcedure		storedProcedure;
+		private CommandResult		lastResult;
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ctor1/*'/>
+		public MySqlCommand()
+		{
+			cmdType = CommandType.Text;
+			parameterMap = new ArrayList();
+			parameters = new MySqlParameterCollection();
+			updatedRowSource = UpdateRowSource.Both;
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ctor2/*'/>
+		public MySqlCommand(string cmdText) : this()
+		{
+			CommandText = cmdText;
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ctor3/*'/>
+		public MySqlCommand(string cmdText, MySqlConnection connection) : this(cmdText)
+		{
+			Connection = connection;
+			if (connection != null)
+				parameters.ParameterMarker = connection.ParameterMarker;
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ctor4/*'/>
+		public MySqlCommand(string cmdText, MySqlConnection connection, 
+			MySqlTransaction transaction) : this(cmdText, connection)
+		{
+			curTransaction = transaction;
+		} 
+
+		#region Properties
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/CommandText/*'/>
+		[Category("Data")]
+		[Description("Command text to execute")]
+#if WINDOWS
+		[Editor("MySql.Data.Common.Design.SqlCommandTextEditor,MySqlClient.Design",
typeof(System.Drawing.Design.UITypeEditor))]
+#endif
+		public string CommandText
+		{
+			get { return cmdText; }
+			set { cmdText = value;  this.preparedStatement=null; }
+		}
+
+		internal int UpdateCount 
+		{
+			get { return (int)updateCount; }
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/CommandTimeout/*'/>
+		[Category("Misc")]
+		[Description("Time to wait for command to execute")]
+		public int CommandTimeout
+		{
+			// TODO: support this
+			get  { return 0; }
+			set  { if (value != 0) throw new NotSupportedException(); }
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/CommandType/*'/>
+		[Category("Data")]
+		public CommandType CommandType
+		{
+			get { return cmdType; }
+			set { cmdType = value; }
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/IsPrepared/*'/>
+		[Browsable(false)]
+		public bool IsPrepared 
+		{
+			get { return preparedStatement != null; }
+		}
+
 		IDbConnection IDbCommand.Connection 
-		{
-			get { return connection; }
-			set { Connection = (MySqlConnection)value; }
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/Connection/*'/>
-		[Category("Behavior")]
-		[Description("Connection used by the command")]
-		public MySqlConnection Connection
-		{
-			get { return connection;  }
-			set
-			{
-				/*
-				* The connection is associated with the transaction
-				* so set the transaction object to return a null reference if the connection 
-				* is reset.
-				*/
-				if (connection != value)
-					this.Transaction = null;
-
-				connection = (MySqlConnection)value;
-				if (connection != null)
-					parameters.ParameterMarker = connection.ParameterMarker;
-			}
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/Parameters/*'/>
-		[Category("Data")]
-		[Description("The parameters collection")]
-		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
-		public MySqlParameterCollection Parameters
-		{
-			get  { return parameters; }
-		}
-
-		IDataParameterCollection IDbCommand.Parameters
-		{
-			get  { return parameters; }
-		}
-
+		{
+			get { return connection; }
+			set { Connection = (MySqlConnection)value; }
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/Connection/*'/>
+		[Category("Behavior")]
+		[Description("Connection used by the command")]
+		public MySqlConnection Connection
+		{
+			get { return connection;  }
+			set
+			{
+				/*
+				* The connection is associated with the transaction
+				* so set the transaction object to return a null reference if the connection 
+				* is reset.
+				*/
+				if (connection != value)
+					this.Transaction = null;
+
+				connection = (MySqlConnection)value;
+				if (connection != null)
+					parameters.ParameterMarker = connection.ParameterMarker;
+			}
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/Parameters/*'/>
+		[Category("Data")]
+		[Description("The parameters collection")]
+		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+		public MySqlParameterCollection Parameters
+		{
+			get  { return parameters; }
+		}
+
+		IDataParameterCollection IDbCommand.Parameters
+		{
+			get  { return parameters; }
+		}
+
 		IDbTransaction IDbCommand.Transaction 
-		{
-			get { return Transaction; }
-			set { Transaction = (MySqlTransaction)value; }
-		}
-
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/Transaction/*'/>
-		[Browsable(false)]
-		public MySqlTransaction Transaction
-		{
-			get { return curTransaction; }
-			set { curTransaction = (MySqlTransaction)value; }
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/UpdatedRowSource/*'/>
-		[Category("Behavior")]
-		public UpdateRowSource UpdatedRowSource
-		{
-			get 
-			{ 
-				return updatedRowSource;  
-			}
-			set 
-			{ 
-				updatedRowSource = value; 
-			}
-		}
-		#endregion
-
-		#region Methods
-
-		/// <summary>
-		/// Attempts to cancel the execution of a MySqlCommand.  This operation is not
supported.
-		/// </summary>
-		/// <remarks>
-		/// Cancelling an executing command is currently not supported on any version of MySQL.
-		/// </remarks>
-		/// <exception cref="NotSupportedException">This operation is not
supported.</exception>
-		public void Cancel()
-		{
-			throw new NotSupportedException();
-		}
-
-		/// <summary>
-		/// Creates a new instance of a <see cref="MySqlParameter"/> object.
-		/// </summary>
-		/// <remarks>
-		/// This method is a strongly-typed version of <see
cref="IDbCommand.CreateParameter"/>.
-		/// </remarks>
-		/// <returns>A <see cref="MySqlParameter"/> object.</returns>
-		/// 
-		public MySqlParameter CreateParameter()
-		{
-			return new MySqlParameter();
-		}
-
-		IDbDataParameter IDbCommand.CreateParameter()
-		{
-			return this.CreateParameter();
-		}
-
-		/// <summary>
-		/// Executes all remaining command buffers
-		/// </summary>
-		internal void Consume()
-		{
-			CommandResult result = GetNextResultSet(null);
-			while (result != null)
-			{
-				result.Consume();
-				result = GetNextResultSet(null);
-			}
-
-			// if we were executing a stored procedure and we are out of sql buffers to execute, 
-			// then we need to perform some additional work to get our inout and out parameters
-			if (storedProcedure != null && sqlBuffers.Count == 0)
-				storedProcedure.UpdateParameters(Parameters);
-		}
-
-		/// <summary>
-		/// Executes command buffers until we hit the next resultset
-		/// </summary>
-		/// <returns>CommandResult containing the next resultset when hit
-		/// or null if no more resultsets were found</returns>
-		internal CommandResult GetNextResultSet(MySqlDataReader reader)
-		{
-			// if  we are supposed to return only a single resultset and our reader
-			// is calling us back again, then return null
-			if (reader != null && 
-				(reader.Behavior & CommandBehavior.SingleResult) != 0 &&
-				lastResult != null) return null;
-
-			// if the last result we returned has more results
-			if (lastResult != null && lastResult.ReadNextResult(false) )
-				return lastResult;
-			lastResult = null;
-
-			CommandResult result = null;
-
-			// if we haven't prepared a statement and don't have any sql buffers
-			// to execute, we are done
-			if (preparedStatement == null)
-			{
-				if (sqlBuffers == null || sqlBuffers.Count == 0)
-					return null;
-			}
-			else if (preparedStatement.ExecutionCount > 0)
-				return null;
-
-
-			// if we have a prepared statement, we execute it instead
-			if (preparedStatement != null)
-			{
-				result = preparedStatement.Execute( parameters );
-
+		{
+			get { return Transaction; }
+			set { Transaction = (MySqlTransaction)value; }
+		}
+
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/Transaction/*'/>
+		[Browsable(false)]
+		public MySqlTransaction Transaction
+		{
+			get { return curTransaction; }
+			set { curTransaction = (MySqlTransaction)value; }
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/UpdatedRowSource/*'/>
+		[Category("Behavior")]
+		public UpdateRowSource UpdatedRowSource
+		{
+			get 
+			{ 
+				return updatedRowSource;  
+			}
+			set 
+			{ 
+				updatedRowSource = value; 
+			}
+		}
+		#endregion
+
+		#region Methods
+
+		/// <summary>
+		/// Attempts to cancel the execution of a MySqlCommand.  This operation is not
supported.
+		/// </summary>
+		/// <remarks>
+		/// Cancelling an executing command is currently not supported on any version of MySQL.
+		/// </remarks>
+		/// <exception cref="NotSupportedException">This operation is not
supported.</exception>
+		public void Cancel()
+		{
+			throw new NotSupportedException();
+		}
+
+		/// <summary>
+		/// Creates a new instance of a <see cref="MySqlParameter"/> object.
+		/// </summary>
+		/// <remarks>
+		/// This method is a strongly-typed version of <see
cref="IDbCommand.CreateParameter"/>.
+		/// </remarks>
+		/// <returns>A <see cref="MySqlParameter"/> object.</returns>
+		/// 
+		public MySqlParameter CreateParameter()
+		{
+			return new MySqlParameter();
+		}
+
+		IDbDataParameter IDbCommand.CreateParameter()
+		{
+			return this.CreateParameter();
+		}
+
+		/// <summary>
+		/// Executes all remaining command buffers
+		/// </summary>
+		internal void Consume()
+		{
+			CommandResult result = GetNextResultSet(null);
+			while (result != null)
+			{
+				result.Consume();
+				result = GetNextResultSet(null);
+			}
+
+			// if we were executing a stored procedure and we are out of sql buffers to execute, 
+			// then we need to perform some additional work to get our inout and out parameters
+			if (storedProcedure != null && sqlBuffers.Count == 0)
+				storedProcedure.UpdateParameters(Parameters);
+		}
+
+		/// <summary>
+		/// Executes command buffers until we hit the next resultset
+		/// </summary>
+		/// <returns>CommandResult containing the next resultset when hit
+		/// or null if no more resultsets were found</returns>
+		internal CommandResult GetNextResultSet(MySqlDataReader reader)
+		{
+			// if  we are supposed to return only a single resultset and our reader
+			// is calling us back again, then return null
+			if (reader != null && 
+				(reader.Behavior & CommandBehavior.SingleResult) != 0 &&
+				lastResult != null) return null;
+
+			// if the last result we returned has more results
+			if (lastResult != null && lastResult.ReadNextResult(false) )
+				return lastResult;
+			lastResult = null;
+
+			CommandResult result = null;
+
+			// if we haven't prepared a statement and don't have any sql buffers
+			// to execute, we are done
+			if (preparedStatement == null)
+			{
+				if (sqlBuffers == null || sqlBuffers.Count == 0)
+					return null;
+			}
+			else if (preparedStatement.ExecutionCount > 0)
+				return null;
+
+
+			// if we have a prepared statement, we execute it instead
+			if (preparedStatement != null)
+			{
+				result = preparedStatement.Execute( parameters );
+
 				if (! result.IsResultSet) 
-				{
-					if (updateCount == -1) updateCount = 0;
-					updateCount += (long)result.AffectedRows;
-				}
-			}
-			else while (sqlBuffers.Count > 0)
-			{
-				MemoryStream sqlStream = (MemoryStream)sqlBuffers[0];
-
+				{
+					if (updateCount == -1) updateCount = 0;
+					updateCount += (long)result.AffectedRows;
+				}
+			}
+			else while (sqlBuffers.Count > 0)
+			{
+				MemoryStream sqlStream = (MemoryStream)sqlBuffers[0];
+
 				using (sqlStream) 
-				{
-					result = connection.driver.SendQuery( sqlStream.GetBuffer(), (int)sqlStream.Length,
false );
-					sqlBuffers.RemoveAt( 0 );
-				}
-	
-				if (result.AffectedRows != -1)
-				{
-					if (updateCount == -1) updateCount = 0;
-					updateCount += (long)result.AffectedRows;
-				}
-
-				// if this is a resultset, then we break out of our execution loop
-				if (result.IsResultSet)
-					break;
-			}
-
-			if (result.IsResultSet) 
-			{
-				lastResult = result;
-				return result;
-			}
-			return null;
-		}
-
-		/// <summary>
-		/// Check the connection to make sure
-		///		- it is open
-		///		- it is not currently being used by a reader
-		///		- and we have the right version of MySQL for the requested command type
-		/// </summary>
-		private void CheckState()
-		{
-			// There must be a valid and open connection.
-			if (connection == null || connection.State != ConnectionState.Open)
-				throw new InvalidOperationException(Resources.GetString("ConnectionMustBeOpen"));
-
-			// Data readers have to be closed first
-			if (connection.Reader != null)
-				throw new MySqlException(Resources.GetString("DataReaderOpen"));
-
-			if (CommandType == CommandType.StoredProcedure && !
connection.driver.Version.isAtLeast(5,0,0))
-				throw new MySqlException(Resources.GetString("SPNotSupported"));
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteNonQuery/*'/>
-		public int ExecuteNonQuery()
-		{
-			CheckState();
-
-			updateCount = 0;
-
-			if (preparedStatement == null)
-				sqlBuffers = PrepareSqlBuffers(CommandText);
-			else
-				preparedStatement.ExecutionCount = 0;
-
+				{
+					result = connection.driver.SendQuery( sqlStream.GetBuffer(), (int)sqlStream.Length,
false );
+					sqlBuffers.RemoveAt( 0 );
+				}
+	
+				if (result.AffectedRows != -1)
+				{
+					if (updateCount == -1) updateCount = 0;
+					updateCount += (long)result.AffectedRows;
+				}
+
+				// if this is a resultset, then we break out of our execution loop
+				if (result.IsResultSet)
+					break;
+			}
+
+			if (result.IsResultSet) 
+			{
+				lastResult = result;
+				return result;
+			}
+			return null;
+		}
+
+		/// <summary>
+		/// Check the connection to make sure
+		///		- it is open
+		///		- it is not currently being used by a reader
+		///		- and we have the right version of MySQL for the requested command type
+		/// </summary>
+		private void CheckState()
+		{
+			// There must be a valid and open connection.
+			if (connection == null || connection.State != ConnectionState.Open)
+				throw new InvalidOperationException(Resources.GetString("ConnectionMustBeOpen"));
+
+			// Data readers have to be closed first
+			if (connection.Reader != null)
+				throw new MySqlException(Resources.GetString("DataReaderOpen"));
+
+			if (CommandType == CommandType.StoredProcedure && !
connection.driver.Version.isAtLeast(5,0,0))
+				throw new MySqlException(Resources.GetString("SPNotSupported"));
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteNonQuery/*'/>
+		public int ExecuteNonQuery()
+		{
+			CheckState();
+
+			updateCount = 0;
+
+			if (preparedStatement == null)
+				sqlBuffers = PrepareSqlBuffers(CommandText);
+			else
+				preparedStatement.ExecutionCount = 0;
+
 			try 
-			{
-				Consume();
-			}
+			{
+				Consume();
+			}
 			catch (MySqlException ex) 
-			{
-				if (ex.IsFatal) connection.Terminate();
-				throw;
-			}
-
-			return (int)updateCount;
-		}
-
-		IDataReader IDbCommand.ExecuteReader ()
-		{
-			return ExecuteReader ();
-		}
-
-		IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
-		{
-			return ExecuteReader (behavior);
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteReader/*'/>
-		public MySqlDataReader ExecuteReader()
-		{
-			return ExecuteReader(CommandBehavior.Default);
-		}
-
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteReader1/*'/>
-		public MySqlDataReader ExecuteReader(CommandBehavior behavior)
-		{
-			CheckState();
-
-			string sql = TrimSemicolons(cmdText);
-
-			if (0 != (behavior & CommandBehavior.SchemaOnly))
-			{
-				sql = "SET SQL_SELECT_LIMIT=0;" + sql + ";SET sql_select_limit=-1";
-			}
-
-			if (0 != (behavior & CommandBehavior.SingleRow))
-			{
-				sql = "SET SQL_SELECT_LIMIT=1;" + sql + ";SET sql_select_limit=-1";
-			}
-
-			updateCount = -1;
-			MySqlDataReader reader = new MySqlDataReader(this, behavior);
-
-			// if we don't have a prepared statement, then prepare our sql for execution
-			if (preparedStatement == null)
-				sqlBuffers = PrepareSqlBuffers(sql);
-			else
-				preparedStatement.ExecutionCount = 0;
-
-			reader.NextResult();
-			connection.Reader = reader;
-			return reader;
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteScalar/*'/>
-		public object ExecuteScalar()
-		{
-			// ExecuteReader will check out state
-
-			updateCount = -1;
-
-			object val = null;
-			MySqlDataReader reader = ExecuteReader();
-			if (reader.Read())
-				val = reader.GetValue(0);
-			reader.Close();
-
-			return val;
-		}
-
-		/// <include file='docs/mysqlcommand.xml' path='docs/Prepare/*'/>
-		public void Prepare()
-		{
-			if (connection == null)
-				throw new InvalidOperationException(Resources.GetString("ConnectionNotSet"));
-			if (connection.State != ConnectionState.Open)
-				throw new InvalidOperationException(Resources.GetString("ConnectionNotOpen"));
-			if (! connection.driver.Version.isAtLeast( 4,1,0)) 
-				return;
-
-			// strip out names from parameter markers
-			string psSQL = CommandText;
-
-			if (CommandType == CommandType.StoredProcedure)
-			{
-				if (storedProcedure == null)
-					storedProcedure = new StoredProcedure(connection);
-				psSQL = storedProcedure.Prepare(this);
-			}
-			psSQL = PrepareCommandText(psSQL);
-
-			// ask our connection to send the prepare command
-			preparedStatement = connection.driver.Prepare(psSQL,
(string[])parameterMap.ToArray(typeof(string)));
-		}
-		#endregion
-
-
-		#region Private Methods
-
-		private string TrimSemicolons(string sql)
-		{
-			System.Text.StringBuilder sb = new System.Text.StringBuilder(sql);
-			int start = 0;
-			while (sb[start] == ';')
-				start++;
-
-			int end = sb.Length-1;
-			while (sb[end] == ';')
-				end--;
-			return sb.ToString(start, end-start+1);
-		}
-
-		/// <summary>
-		/// Serializes the given parameter to the given memory stream
-		/// </summary>
-		/// <param name="writer">PacketWriter to stream parameter data to</param>
-		/// <param name="parmName">Name of the parameter to serialize</param>
-		/// <remarks>
-		/// <para>This method is called by PrepareSqlBuffers to convert the given
-		/// parameter to bytes and write those bytes to the given memory stream.
-		/// </para>
-		/// </remarks>
-		/// <returns>True if the parameter was successfully serialized, false
otherwise.</returns>
-		private bool SerializeParameter( PacketWriter writer, string parmName )
-		{
-			int index = parameters.IndexOf(parmName);
-			if (index == -1)
-			{
-				// if we are using old syntax, we can't throw exceptions for parameters
-				// not defined.
-				if (connection.Settings.UseOldSyntax) return false;
-				throw new MySqlException("Parameter '" + parmName + "' must be defined");
-			}
-			MySqlParameter parameter = parameters[index];
-			parameter.Serialize( writer, false );
-			return true;
-		}
-
-
-		/// <summary>
-		/// Prepares the necessary byte buffers from the given CommandText
-		/// </summary>
-		/// <returns>Array of byte buffers, one for each SQL command</returns>
-		/// <remarks>
-		/// Converts the CommandText into an array of tokens 
-		/// using TokenizeSql and then into one or more byte buffers that can be
-		/// sent to the server.  If the server supports batching (and we  have enabled it),
-		/// then all commands result in a single byte array, otherwise a single buffer
-		/// is created for each SQL command (as separated by ';').
-		/// The SQL text is converted to bytes using the active encoding for the server.
-		/// </remarks>
-		private ArrayList PrepareSqlBuffers(string sql)
-		{
-			ArrayList buffers = new ArrayList();
-			PacketWriter writer = new PacketWriter();
-			writer.Encoding = connection.Encoding;
-			writer.Version = connection.driver.Version;
-
-			// if we are executing as a stored procedure, then we need to add the call
-			// keyword.
-			if (CommandType == CommandType.StoredProcedure)
-			{
-				if (storedProcedure == null)
-					storedProcedure = new StoredProcedure(connection);
-				sql = storedProcedure.Prepare( this );
-			}
-
-			// tokenize the SQL
-			sql = sql.TrimStart(';').TrimEnd(';');
-			ArrayList tokens = TokenizeSql( sql );
-
-			foreach (string token in tokens)
-			{
-				if (token.Trim().Length == 0) continue;
-				if (token == ";" && ! connection.driver.SupportsBatch)
-				{
-					MemoryStream ms = (MemoryStream)writer.Stream;
-					if (ms.Length > 0)
-						buffers.Add( ms );
-
-					writer = new PacketWriter();
-					writer.Encoding = connection.Encoding;
-					writer.Version = connection.driver.Version;
-					continue;
-				}
-				else if (token[0] == parameters.ParameterMarker) 
-				{
-					if (SerializeParameter( writer, token )) continue;
-				}
-
-				// our fall through case is to write the token to the byte stream
-				writer.WriteStringNoNull( token );
-			}
-
-			// capture any buffer that is left over
-			MemoryStream mStream = (MemoryStream)writer.Stream;
-			if (mStream.Length > 0)
-				buffers.Add( mStream );
-
-			return buffers;
-		}
-
-		/// <summary>
-		/// Prepares CommandText for use with the Prepare method
-		/// </summary>
-		/// <returns>Command text stripped of all paramter names</returns>
-		/// <remarks>
-		/// Takes the output of TokenizeSql and creates a single string of SQL
-		/// that only contains '?' markers for each parameter.  It also creates
-		/// the parameterMap array list that includes all the paramter names in the
-		/// order they appeared in the SQL
-		/// </remarks>
-		private string PrepareCommandText(string text)
-		{
-			StringBuilder	newSQL = new StringBuilder();
-
-			// tokenize the sql first
-			ArrayList tokens = TokenizeSql(text);
-			parameterMap.Clear();
-
-			foreach (string token in tokens)
-			{
-				if ( token[0] != parameters.ParameterMarker )
-					newSQL.Append( token );
-				else
-				{
-					parameterMap.Add( token );
-					newSQL.Append( parameters.ParameterMarker );
-				}
-			}
-
-			return newSQL.ToString();
-		}
-
-		/// <summary>
-		/// Breaks the given SQL up into 'tokens' that are easier to output
-		/// into another form (bytes, preparedText, etc).
-		/// </summary>
-		/// <param name="sql">SQL to be tokenized</param>
-		/// <returns>Array of tokens</returns>
-		/// <remarks>The SQL is tokenized at parameter markers ('?') and at 
-		/// (';') sql end markers if the server doesn't support batching.
-		/// </remarks>
-		private ArrayList TokenizeSql( string sql )
-		{
-			char			delim = Char.MinValue;
-			StringBuilder	sqlPart = new StringBuilder();
-			bool			escaped = false;
-			ArrayList		tokens = new ArrayList();
-
-			for (int i=0; i < sql.Length; i++)
-			{
-				char c = sql[i];
-				if (escaped)
-					escaped = !escaped;
-				else if (c == delim) 
-					delim = Char.MinValue;
-				else if (c == ';' && !escaped && delim == Char.MinValue &&
!connection.driver.SupportsBatch)
-				{
-					tokens.Add( sqlPart.ToString() );
-					tokens.Add( ";" );
-					sqlPart.Remove( 0, sqlPart.Length ); 
-					continue;
-				}
-				else if ((c == '\'' || c == '\"') & ! escaped & delim == Char.MinValue)
-					delim=c;
-				else if (c == '\\') 
-					escaped = ! escaped;
-				else if (c == parameters.ParameterMarker && delim == Char.MinValue &&
! escaped) 
-				{
-					tokens.Add( sqlPart.ToString() );
-					sqlPart.Remove( 0, sqlPart.Length ); 
-				}
-				else if (sqlPart.Length > 0 && sqlPart[0] == parameters.ParameterMarker
&& 
-					! Char.IsLetterOrDigit(c) && c != '_' && c != '.' && c !=
'$' 
-					&& c != '@')
-				{
-					tokens.Add( sqlPart.ToString() );
-					sqlPart.Remove( 0, sqlPart.Length ); 
-				}
-
-				sqlPart.Append(c);
-			}
-			tokens.Add( sqlPart.ToString() );
-			return tokens;
-		}
-		#endregion
-
-		#region ICloneable
-		/// <summary>
-		/// Creates a clone of this MySqlCommand object.  CommandText, Connection, and
Transaction properties
-		/// are included as well as the entire parameter list.
-		/// </summary>
-		/// <returns>The cloned MySqlCommand object</returns>
-		object ICloneable.Clone() 
-		{
-			MySqlCommand clone = new MySqlCommand(cmdText, connection, curTransaction);
-			foreach (MySqlParameter p in parameters) 
-			{
-				clone.Parameters.Add((p as ICloneable).Clone());
-			}
-			return clone;
-		}
-		#endregion
-	}
-}
+			{
+				if (ex.IsFatal) connection.Terminate();
+				throw;
+			}
+
+			return (int)updateCount;
+		}
+
+		IDataReader IDbCommand.ExecuteReader ()
+		{
+			return ExecuteReader ();
+		}
+
+		IDataReader IDbCommand.ExecuteReader (CommandBehavior behavior)
+		{
+			return ExecuteReader (behavior);
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteReader/*'/>
+		public MySqlDataReader ExecuteReader()
+		{
+			return ExecuteReader(CommandBehavior.Default);
+		}
+
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteReader1/*'/>
+		public MySqlDataReader ExecuteReader(CommandBehavior behavior)
+		{
+			CheckState();
+
+			string sql = TrimSemicolons(cmdText);
+
+			if (0 != (behavior & CommandBehavior.SchemaOnly))
+			{
+				sql = "SET SQL_SELECT_LIMIT=0;" + sql + ";SET sql_select_limit=-1";
+			}
+
+			if (0 != (behavior & CommandBehavior.SingleRow))
+			{
+				sql = "SET SQL_SELECT_LIMIT=1;" + sql + ";SET sql_select_limit=-1";
+			}
+
+			updateCount = -1;
+			MySqlDataReader reader = new MySqlDataReader(this, behavior);
+
+			// if we don't have a prepared statement, then prepare our sql for execution
+			if (preparedStatement == null)
+				sqlBuffers = PrepareSqlBuffers(sql);
+			else
+				preparedStatement.ExecutionCount = 0;
+
+			reader.NextResult();
+			connection.Reader = reader;
+			return reader;
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/ExecuteScalar/*'/>
+		public object ExecuteScalar()
+		{
+			// ExecuteReader will check out state
+
+			updateCount = -1;
+
+			object val = null;
+			MySqlDataReader reader = ExecuteReader();
+			if (reader.Read())
+				val = reader.GetValue(0);
+			reader.Close();
+
+			return val;
+		}
+
+		/// <include file='docs/mysqlcommand.xml' path='docs/Prepare/*'/>
+		public void Prepare()
+		{
+			if (connection == null)
+				throw new InvalidOperationException(Resources.GetString("ConnectionNotSet"));
+			if (connection.State != ConnectionState.Open)
+				throw new InvalidOperationException(Resources.GetString("ConnectionNotOpen"));
+			if (! connection.driver.Version.isAtLeast( 4,1,0)) 
+				return;
+
+			// strip out names from parameter markers
+			string psSQL = CommandText;
+
+			if (CommandType == CommandType.StoredProcedure)
+			{
+				if (storedProcedure == null)
+					storedProcedure = new StoredProcedure(connection);
+				psSQL = storedProcedure.Prepare(this);
+			}
+			psSQL = PrepareCommandText(psSQL);
+
+			// ask our connection to send the prepare command
+			preparedStatement = connection.driver.Prepare(psSQL,
(string[])parameterMap.ToArray(typeof(string)));
+		}
+		#endregion
+
+
+		#region Private Methods
+
+		private string TrimSemicolons(string sql)
+		{
+			System.Text.StringBuilder sb = new System.Text.StringBuilder(sql);
+			int start = 0;
+			while (sb[start] == ';')
+				start++;
+
+			int end = sb.Length-1;
+			while (sb[end] == ';')
+				end--;
+			return sb.ToString(start, end-start+1);
+		}
+
+		/// <summary>
+		/// Serializes the given parameter to the given memory stream
+		/// </summary>
+		/// <param name="writer">PacketWriter to stream parameter data to</param>
+		/// <param name="parmName">Name of the parameter to serialize</param>
+		/// <remarks>
+		/// <para>This method is called by PrepareSqlBuffers to convert the given
+		/// parameter to bytes and write those bytes to the given memory stream.
+		/// </para>
+		/// </remarks>
+		/// <returns>True if the parameter was successfully serialized, false
otherwise.</returns>
+		private bool SerializeParameter( PacketWriter writer, string parmName )
+		{
+			int index = parameters.IndexOf(parmName);
+			if (index == -1)
+			{
+				// if we are using old syntax, we can't throw exceptions for parameters
+				// not defined.
+				if (connection.Settings.UseOldSyntax) return false;
+				throw new MySqlException("Parameter '" + parmName + "' must be defined");
+			}
+			MySqlParameter parameter = parameters[index];
+			parameter.Serialize( writer, false );
+			return true;
+		}
+
+
+		/// <summary>
+		/// Prepares the necessary byte buffers from the given CommandText
+		/// </summary>
+		/// <returns>Array of byte buffers, one for each SQL command</returns>
+		/// <remarks>
+		/// Converts the CommandText into an array of tokens 
+		/// using TokenizeSql and then into one or more byte buffers that can be
+		/// sent to the server.  If the server supports batching (and we  have enabled it),
+		/// then all commands result in a single byte array, otherwise a single buffer
+		/// is created for each SQL command (as separated by ';').
+		/// The SQL text is converted to bytes using the active encoding for the server.
+		/// </remarks>
+		private ArrayList PrepareSqlBuffers(string sql)
+		{
+			ArrayList buffers = new ArrayList();
+			PacketWriter writer = new PacketWriter();
+			writer.Encoding = connection.Encoding;
+			writer.Version = connection.driver.Version;
+
+			// if we are executing as a stored procedure, then we need to add the call
+			// keyword.
+			if (CommandType == CommandType.StoredProcedure)
+			{
+				if (storedProcedure == null)
+					storedProcedure = new StoredProcedure(connection);
+				sql = storedProcedure.Prepare( this );
+			}
+
+			// tokenize the SQL
+			sql = sql.TrimStart(';').TrimEnd(';');
+			ArrayList tokens = TokenizeSql( sql );
+
+			foreach (string token in tokens)
+			{
+				if (token.Trim().Length == 0) continue;
+				if (token == ";" && ! connection.driver.SupportsBatch)
+				{
+					MemoryStream ms = (MemoryStream)writer.Stream;
+					if (ms.Length > 0)
+						buffers.Add( ms );
+
+					writer = new PacketWriter();
+					writer.Encoding = connection.Encoding;
+					writer.Version = connection.driver.Version;
+					continue;
+				}
+				else if (token[0] == parameters.ParameterMarker) 
+				{
+					if (SerializeParameter( writer, token )) continue;
+				}
+
+				// our fall through case is to write the token to the byte stream
+				writer.WriteStringNoNull( token );
+			}
+
+			// capture any buffer that is left over
+			MemoryStream mStream = (MemoryStream)writer.Stream;
+			if (mStream.Length > 0)
+				buffers.Add( mStream );
+
+			return buffers;
+		}
+
+		/// <summary>
+		/// Prepares CommandText for use with the Prepare method
+		/// </summary>
+		/// <returns>Command text stripped of all paramter names</returns>
+		/// <remarks>
+		/// Takes the output of TokenizeSql and creates a single string of SQL
+		/// that only contains '?' markers for each parameter.  It also creates
+		/// the parameterMap array list that includes all the paramter names in the
+		/// order they appeared in the SQL
+		/// </remarks>
+		private string PrepareCommandText(string text)
+		{
+			StringBuilder	newSQL = new StringBuilder();
+
+			// tokenize the sql first
+			ArrayList tokens = TokenizeSql(text);
+			parameterMap.Clear();
+
+			foreach (string token in tokens)
+			{
+				if ( token[0] != parameters.ParameterMarker )
+					newSQL.Append( token );
+				else
+				{
+					parameterMap.Add( token );
+					newSQL.Append( parameters.ParameterMarker );
+				}
+			}
+
+			return newSQL.ToString();
+		}
+
+		/// <summary>
+		/// Breaks the given SQL up into 'tokens' that are easier to output
+		/// into another form (bytes, preparedText, etc).
+		/// </summary>
+		/// <param name="sql">SQL to be tokenized</param>
+		/// <returns>Array of tokens</returns>
+		/// <remarks>The SQL is tokenized at parameter markers ('?') and at 
+		/// (';') sql end markers if the server doesn't support batching.
+		/// </remarks>
+		private ArrayList TokenizeSql( string sql )
+		{
+			char			delim = Char.MinValue;
+			StringBuilder	sqlPart = new StringBuilder();
+			bool			escaped = false;
+			ArrayList		tokens = new ArrayList();
+
+			for (int i=0; i < sql.Length; i++)
+			{
+				char c = sql[i];
+				if (escaped)
+					escaped = !escaped;
+				else if (c == delim) 
+					delim = Char.MinValue;
+				else if (c == ';' && !escaped && delim == Char.MinValue &&
!connection.driver.SupportsBatch)
+				{
+					tokens.Add( sqlPart.ToString() );
+					tokens.Add( ";" );
+					sqlPart.Remove( 0, sqlPart.Length ); 
+					continue;
+				}
+				else if ((c == '\'' || c == '\"') & ! escaped & delim == Char.MinValue)
+					delim=c;
+				else if (c == '\\') 
+					escaped = ! escaped;
+				else if (c == parameters.ParameterMarker && delim == Char.MinValue &&
! escaped) 
+				{
+					tokens.Add( sqlPart.ToString() );
+					sqlPart.Remove( 0, sqlPart.Length ); 
+				}
+				else if (sqlPart.Length > 0 && sqlPart[0] == parameters.ParameterMarker
&& 
+					! Char.IsLetterOrDigit(c) && c != '_' && c != '.' && c !=
'$' 
+					&& c != '@')
+				{
+					tokens.Add( sqlPart.ToString() );
+					sqlPart.Remove( 0, sqlPart.Length ); 
+				}
+
+				sqlPart.Append(c);
+			}
+			tokens.Add( sqlPart.ToString() );
+			return tokens;
+		}
+		#endregion
+
+		#region ICloneable
+		/// <summary>
+		/// Creates a clone of this MySqlCommand object.  CommandText, Connection, and
Transaction properties
+		/// are included as well as the entire parameter list.
+		/// </summary>
+		/// <returns>The cloned MySqlCommand object</returns>
+		object ICloneable.Clone() 
+		{
+			MySqlCommand clone = new MySqlCommand(cmdText, connection, curTransaction);
+			foreach (MySqlParameter p in parameters) 
+			{
+				clone.Parameters.Add((p as ICloneable).Clone());
+			}
+			return clone;
+		}
+		#endregion
+	}
+}

Modified: branches/1.0/mysqlclient/datareader.cs
===================================================================
--- branches/1.0/mysqlclient/datareader.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/mysqlclient/datareader.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,745 +1,745 @@
-// Copyright (C) 2004-2005 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.Data;
-using System.Collections;
-using MySql.Data.Types;
-
-namespace MySql.Data.MySqlClient
-{
-	/// <summary>
-	/// Provides a means of reading a forward-only stream of rows from a MySQL database.
This class cannot be inherited.
-	/// </summary>
-	/// <include file='docs/MySqlDataReader.xml' path='docs/ClassSummary/*'/>
-	public sealed class MySqlDataReader : MarshalByRefObject, IEnumerable, IDataReader,
IDisposable, IDataRecord
-	{
-		// The DataReader should always be open when returned to the user.
-		private bool			isOpen = true;
-
-		// Keep track of the results and position
-		// within the resultset (starts prior to first record).
-		private MySqlField[]	fields;
-		private CommandBehavior	commandBehavior;
-		private MySqlCommand	command;
-		private bool			canRead;
-		private bool			hasRows;
-		private CommandResult	currentResult;
-		private int				readCount;
-		private DataTable		schemaTable;
-
-		/* 
-		 * Keep track of the connection in order to implement the
-		 * CommandBehavior.CloseConnection flag. A null reference means
-		 * normal behavior (do not automatically close).
-		 */
-		private MySqlConnection connection;
-
-		/*
-		 * Because the user should not be able to directly create a 
-		 * DataReader object, the constructors are
-		 * marked as internal.
-		 */
-		internal MySqlDataReader(MySqlCommand cmd, CommandBehavior behavior)
-		{
-			this.command = cmd;
-			connection = (MySqlConnection)command.Connection;
-			commandBehavior = behavior;
-		}
-
-		/// <summary>
-		/// Gets a value indicating the depth of nesting for the current row.  This method is
not 
-		/// supported currently and always returns 0.
-		/// </summary>
-		public int Depth 
-		{
-			get { return 0;  }
-		}
-
-		internal CommandBehavior Behavior 
-		{
-			get { return commandBehavior; }
-		}
-
+// Copyright (C) 2004-2005 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.Data;
+using System.Collections;
+using MySql.Data.Types;
+
+namespace MySql.Data.MySqlClient
+{
+	/// <summary>
+	/// Provides a means of reading a forward-only stream of rows from a MySQL database.
This class cannot be inherited.
+	/// </summary>
+	/// <include file='docs/MySqlDataReader.xml' path='docs/ClassSummary/*'/>
+	public sealed class MySqlDataReader : MarshalByRefObject, IEnumerable, IDataReader,
IDisposable, IDataRecord
+	{
+		// The DataReader should always be open when returned to the user.
+		private bool			isOpen = true;
+
+		// Keep track of the results and position
+		// within the resultset (starts prior to first record).
+		private MySqlField[]	fields;
+		private CommandBehavior	commandBehavior;
+		private MySqlCommand	command;
+		private bool			canRead;
+		private bool			hasRows;
+		private CommandResult	currentResult;
+		private int				readCount;
+		private DataTable		schemaTable;
+
+		/* 
+		 * Keep track of the connection in order to implement the
+		 * CommandBehavior.CloseConnection flag. A null reference means
+		 * normal behavior (do not automatically close).
+		 */
+		private MySqlConnection connection;
+
+		/*
+		 * Because the user should not be able to directly create a 
+		 * DataReader object, the constructors are
+		 * marked as internal.
+		 */
+		internal MySqlDataReader(MySqlCommand cmd, CommandBehavior behavior)
+		{
+			this.command = cmd;
+			connection = (MySqlConnection)command.Connection;
+			commandBehavior = behavior;
+		}
+
+		/// <summary>
+		/// Gets a value indicating the depth of nesting for the current row.  This method is
not 
+		/// supported currently and always returns 0.
+		/// </summary>
+		public int Depth 
+		{
+			get { return 0;  }
+		}
+
+		internal CommandBehavior Behavior 
+		{
+			get { return commandBehavior; }
+		}
+
 		internal CommandResult CurrentResult 
-		{
-			get { return currentResult; }
-		}
-
-		/// <summary>
-		/// Gets a value indicating whether the data reader is closed.
-		/// </summary>
-		public bool IsClosed
-		{
-			get  { return ! isOpen; }
-		}
-
-		void IDisposable.Dispose() 
-		{
-			if (isOpen)
-				Close();
-		}
-
-		/// <summary>
-		/// Gets the number of rows changed, inserted, or deleted by execution of the SQL
statement.
-		/// </summary>
-		public int RecordsAffected 
-		{
-			// RecordsAffected returns the number of rows affected in batch
-			// statments from insert/delete/update statments.  This property
-			// is not completely accurate until .Close() has been called.
-			get { return command.UpdateCount; }
-		}
-
-		/// <summary>
-		/// Gets a value indicating whether the MySqlDataReader contains one or more rows.
-		/// </summary>
-		public bool HasRows
-		{
-			get { return hasRows; }
-		}
-
-		/// <summary>
-		/// Closes the MySqlDataReader object.
-		/// </summary>
-		public void Close()
-		{
-			if (! isOpen) return;
-
+		{
+			get { return currentResult; }
+		}
+
+		/// <summary>
+		/// Gets a value indicating whether the data reader is closed.
+		/// </summary>
+		public bool IsClosed
+		{
+			get  { return ! isOpen; }
+		}
+
+		void IDisposable.Dispose() 
+		{
+			if (isOpen)
+				Close();
+		}
+
+		/// <summary>
+		/// Gets the number of rows changed, inserted, or deleted by execution of the SQL
statement.
+		/// </summary>
+		public int RecordsAffected 
+		{
+			// RecordsAffected returns the number of rows affected in batch
+			// statments from insert/delete/update statments.  This property
+			// is not completely accurate until .Close() has been called.
+			get { return command.UpdateCount; }
+		}
+
+		/// <summary>
+		/// Gets a value indicating whether the MySqlDataReader contains one or more rows.
+		/// </summary>
+		public bool HasRows
+		{
+			get { return hasRows; }
+		}
+
+		/// <summary>
+		/// Closes the MySqlDataReader object.
+		/// </summary>
+		public void Close()
+		{
+			if (! isOpen) return;
+
 			try 
-			{
-				// finish any current command
-				if (currentResult != null)
-					currentResult.Consume();
-
-				connection.Reader = null;
-				command.Consume();
-
-				if (0 != (commandBehavior & CommandBehavior.CloseConnection))
-					connection.Close();
-			}
-			catch (MySqlException ex)
-			{
-				if (ex.IsFatal)
-				{
-					connection.Reader = null;
-					connection.Terminate();
-				}
-				throw;
-			}
+			{
+				// finish any current command
+				if (currentResult != null)
+					currentResult.Consume();
+
+				connection.Reader = null;
+				command.Consume();
+
+				if (0 != (commandBehavior & CommandBehavior.CloseConnection))
+					connection.Close();
+			}
+			catch (MySqlException ex)
+			{
+				if (ex.IsFatal)
+				{
+					connection.Reader = null;
+					connection.Terminate();
+				}
+				throw;
+			}
 			finally 
-			{
-				isOpen = false;
-			}
-		}
-
-
-
-
-		/// <summary>
-		/// Gets the number of columns in the current row.
-		/// </summary>
-		public int FieldCount
-		{
-			// Return the count of the number of columns, which in
-			// this case is the size of the column metadata
-			// array.
-			get 
-			{ 
-				if (fields != null)
-					return fields.Length;
-				return 0;
-			}
-		}
-
-		/// <summary>
-		/// Overloaded. Gets the value of a column in its native format.
-		/// In C#, this property is the indexer for the MySqlDataReader class.
-		/// </summary>
-		public object this [ int i ]
-		{
-			get { return GetValue(i); }
-		}
-
-		/// <summary>
-		/// Gets the value of a column in its native format.
-		///	[C#] In C#, this property is the indexer for the MySqlDataReader class.
-		/// </summary>
-		public object this [ String name ]
-		{
-			// Look up the ordinal and return 
-			// the value at that position.
-			get { return this[GetOrdinal(name)]; }
-		}
-
-		#region TypeSafe Accessors
-		/// <summary>
-		/// Gets the value of the specified column as a Boolean.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public bool GetBoolean(int i)
-		{
-			return Convert.ToBoolean(GetValue(i));
-		}
-
-		/// <summary>
-		/// Gets the value of the specified column as a byte.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public byte GetByte(int i)
-		{
-			MySqlValue v = GetFieldValue(i);
-			if (v is MySqlUByte)
-				return ((MySqlUByte)v).Value;
-			else
-				return (byte)((MySqlByte)v).Value;
-		}
-
-		/// <summary>
-		/// Reads a stream of bytes from the specified column offset into the buffer an array
starting at the given buffer offset.
-		/// </summary>
-		/// <param name="i">The zero-based column ordinal. </param>
-		/// <param name="dataIndex">The index within the field from which to begin the
read operation. </param>
-		/// <param name="buffer">The buffer into which to read the stream of bytes.
</param>
-		/// <param name="bufferIndex">The index for buffer to begin the read operation.
</param>
-		/// <param name="length">The maximum length to copy into the buffer.
</param>
-		/// <returns>The actual number of bytes read.</returns>
-		/// <include file='docs/MySqlDataReader.xml'
path='MyDocs/MyMembers[@name="GetBytes"]/*'/>
-		public long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
-		{
-			if (i >= fields.Length) 
-				throw new IndexOutOfRangeException();
-
-			MySqlValue val = GetFieldValue(i);
-
-			if (! (val is MySqlBinary))
-				throw new MySqlException("GetBytes can only be called on binary columns");
-
-			MySqlBinary binary = (MySqlBinary)val;
-			if (buffer == null) 
-				return (long)binary.Value.Length;
-
-			if (bufferIndex >= buffer.Length || bufferIndex < 0)
-				throw new IndexOutOfRangeException("Buffer index must be a valid index in buffer");
-			if (buffer.Length < (bufferIndex + length))
-				throw new ArgumentException("Buffer is not large enough to hold the requested data"
);
-			if (dataIndex < 0 || 
-				((ulong)dataIndex >= (ulong)binary.Value.Length &&
(ulong)binary.Value.Length > 0))
-				throw new IndexOutOfRangeException("Data index must be a valid index in the field" );
-
-			byte[] bytes = (byte[])binary.Value; 
-
-			// adjust the length so we don't run off the end
-			if ( (ulong)binary.Value.Length < (ulong)(dataIndex+length)) 
-			{
-				length = (int)((ulong)binary.Value.Length - (ulong)dataIndex);
-			}
-
-			Array.Copy( bytes, (int)dataIndex, buffer, (int)bufferIndex, (int)length );
-
-			return length;
-		}
-
-		/// <summary>
-		/// Gets the value of the specified column as a single character.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public char GetChar(int i)
-		{
-			string s = GetString(i);
-			return s[0];
-		}
-
-		/// <summary>
-		/// Reads a stream of characters from the specified column offset into the buffer as an
array starting at the given buffer offset.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <param name="fieldOffset"></param>
-		/// <param name="buffer"></param>
-		/// <param name="bufferoffset"></param>
-		/// <param name="length"></param>
-		/// <returns></returns>
-		public long GetChars(int i, long fieldOffset, char[] buffer, int bufferoffset, int
length)
-		{
-			if (i >= fields.Length) 
-				throw new IndexOutOfRangeException();
-
-			string valAsString = GetString(i);
-
-			if (buffer == null) return valAsString.Length;
-
-			if (bufferoffset >= buffer.Length || bufferoffset < 0)
-				throw new IndexOutOfRangeException("Buffer index must be a valid index in buffer");
-			if (buffer.Length < (bufferoffset + length))
-				throw new ArgumentException( "Buffer is not large enough to hold the requested data"
);
-			if (fieldOffset < 0 || fieldOffset >= valAsString.Length )
-				throw new IndexOutOfRangeException( "Field offset must be a valid index in the field"
);
-			
-			if (valAsString.Length < length)
-				length = valAsString.Length;
-			valAsString.CopyTo( (int)fieldOffset, buffer, bufferoffset, length );
-			return length;
-		}
-
-		/// <summary>
-		/// Gets the name of the source data type.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public String GetDataTypeName(int i)
-		{
-			if (! isOpen) throw new Exception("No current query in data reader");
-			if (i >= fields.Length) throw new IndexOutOfRangeException();
-
-			// return the name of the type used on the backend
-			return currentResult[i].GetMySqlTypeName();
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetMySqlDateTime/*'/>
-		public MySqlDateTime GetMySqlDateTime(int index)
-		{
-			return (MySqlDateTime)GetFieldValue(index);
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetDateTime/*'/>
-		public DateTime GetDateTime(int index)
-		{
-			MySqlValue val = GetFieldValue(index);
-			if (val is MySqlDateTime)
-			{
-				MySqlDateTime dt = (MySqlDateTime)val;
-				if (connection.Settings.ConvertZeroDateTime && !dt.IsValidDateTime)
-					return DateTime.MinValue;
-				else
-					return dt.GetDateTime();
-			}
-			else if (val is MySqlString)
-			{
-				MySqlDateTime d = new MySqlDateTime( MySqlDbType.Datetime );
-				d = d.ParseMySql( (val as MySqlString).Value, true );
-				return d.GetDateTime();
-			}
-			throw new NotSupportedException( "Unable to convert from type " +
val.GetType().ToString() + " to DateTime" );
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetDecimal/*'/>
-		public Decimal GetDecimal(int index)
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlDecimal)
-				return ((MySqlDecimal)v).Value;
-			return Convert.ToDecimal(v.ValueAsObject);
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetDouble/*'/>
-		public double GetDouble(int index)
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlDouble)
-				return ((MySqlDouble)v).Value;
-			return Convert.ToDouble(v.ValueAsObject);
-		}
-
-		/// <summary>
-		/// Gets the Type that is the data type of the object.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public Type GetFieldType(int i)
-		{
-			if (! isOpen) throw new Exception("No current query in data reader");
-			if (i >= fields.Length) throw new IndexOutOfRangeException();
-			
-			if (currentResult[i] is MySqlDateTime &&
!connection.Settings.AllowZeroDateTime)
-				return typeof(DateTime);
-			return currentResult[i].SystemType;
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetFloat/*'/>
-		public float GetFloat(int index)
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlFloat)
-				return ((MySqlFloat)v).Value;
-			return Convert.ToSingle(v.ValueAsObject);
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetGuid/*'/>
-		public Guid GetGuid(int index)
-		{
-			return new Guid( GetString(index) );
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetInt16/*'/>
-		public Int16 GetInt16(int index)
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlInt16)
-				return ((MySqlInt16)v).Value;
-			return Convert.ToInt16(v.ValueAsObject);
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetInt32/*'/>
-		public Int32 GetInt32(int index)
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlInt32)
-				return ((MySqlInt32)v).Value;
-			return Convert.ToInt32(v.ValueAsObject);
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetInt64/*'/>
-		public Int64 GetInt64(int index)
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlInt64)
-				return ((MySqlInt64)v).Value;
-			return Convert.ToInt64(v.ValueAsObject);
-		}
-
-		/// <summary>
-		/// Gets the name of the specified column.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public String GetName(int i)
-		{
-			return fields[i].ColumnName;
-		}
-
-		/// <summary>
-		/// Gets the column ordinal, given the name of the column.
-		/// </summary>
-		/// <param name="name"></param>
-		/// <returns></returns>
-		public int GetOrdinal(string name)
-		{
-			if (! isOpen)
-				throw new Exception("No current query in data reader");
-
-			name = name.ToLower(System.Globalization.CultureInfo.InvariantCulture);
-			for (int i=0; i < fields.Length; i ++) 
-			{
-				if (fields[i].ColumnName.ToLower(System.Globalization.CultureInfo.InvariantCulture)
== name)
-					return i;
-			}
-
-			// Throw an exception if the ordinal cannot be found.
-			throw new IndexOutOfRangeException("Could not find specified column in results");
-		}
-
-		/// <summary>
-		/// Returns a DataTable that describes the column metadata of the MySqlDataReader.
-		/// </summary>
-		/// <returns></returns>
-		public DataTable GetSchemaTable()
-		{
-			if (schemaTable != null) return schemaTable;
-
-			// Only Results from SQL SELECT Queries 
-			// get a DataTable for schema of the result
-			// otherwise, DataTable is null reference
-			if (fields.Length == 0) return null;
-
-			DataTable dataTableSchema = new DataTable ("SchemaTable");
-			
-			dataTableSchema.Columns.Add ("ColumnName", typeof (string));
-			dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
-			dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
-			dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
-			dataTableSchema.Columns.Add ("NumericScale", typeof (int));
-			dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
-			dataTableSchema.Columns.Add ("IsKey", typeof (bool));
-			DataColumn dc = dataTableSchema.Columns["IsKey"];
-			dc.AllowDBNull = true; // IsKey can have a DBNull
-			dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
-			dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
-			dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
-			dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
-			dataTableSchema.Columns.Add ("DataType", typeof(Type));
-			dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
-			dataTableSchema.Columns.Add ("ProviderType", typeof (int));
-			dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
-			dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
-			dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
-			dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
-			dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
-			dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
-			dataTableSchema.Columns.Add ("IsLong", typeof (bool));
-			dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
-
-			int ord = 1;
-			for (int i=0; i < fields.Length; i++)
-			{
-				MySqlField f = fields[i];
-
-				DataRow r = dataTableSchema.NewRow();
-				r["ColumnName"] = f.ColumnName;
-				r["ColumnOrdinal"] = ord++;
-				r["ColumnSize"] = f.ColumnLength;
-				int prec = f.Precision;
-				int pscale = f.Scale;
-				if (prec != -1)
-					r["NumericPrecision"] = (short)prec;
-				if (pscale != -1)
-					r["NumericScale"] = (short)pscale;
-				r["DataType"] = GetFieldType(i);
-				r["ProviderType"] = (int)f.ProviderType();
-				r["IsLong"] = f.IsBlob && f.ColumnLength > 255;
-				r["AllowDBNull"] = f.AllowsNull;
-				r["IsReadOnly"] = false;
-				r["IsRowVersion"] = false;
-				r["IsUnique"] = f.IsUnique || f.IsPrimaryKey;
-				r["IsKey"] = f.IsPrimaryKey;
-				r["IsAutoIncrement"] = f.IsAutoIncrement;
-				r["BaseSchemaName"] = f.DatabaseName;
-				r["BaseCatalogName"] = f.DatabaseName;
-				r["BaseTableName"] = f.RealTableName;
-				r["BaseColumnName"] = f.OriginalColumnName;
-
-				dataTableSchema.Rows.Add( r );
-			}
-
-			schemaTable = dataTableSchema;
-			return dataTableSchema;
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetString/*'/>
-		public String GetString(int index)
-		{
-			MySqlValue val = GetFieldValue(index);
-			MySqlString str = (val as MySqlString);
-			if (str != null) return str.Value;
-
-			if (val is MySqlBinary)
-				return (currentResult[index] as MySqlBinary).ToString( fields[index].Encoding );
-
-			return val.ToString();
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetTimeSpan/*'/>
-		public TimeSpan GetTimeSpan(int index)
-		{
-			MySqlTimeSpan ts = (MySqlTimeSpan)GetFieldValue(index);
-			return ts.Value;
-		}
-
-		/// <summary>
-		/// Gets the value of the specified column in its native format.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public object GetValue(int i)
-		{
-			if (! isOpen) throw new Exception("No current query in data reader");
-			if (i >= fields.Length) throw new IndexOutOfRangeException();
-
-			MySqlValue val = GetFieldValue(i);
-			if (val.IsNull) return DBNull.Value;
-
-			// if the column is a date/time, then we return a MySqlDateTime
-			// so .ToString() will print '0000-00-00' correctly
+			{
+				isOpen = false;
+			}
+		}
+
+
+
+
+		/// <summary>
+		/// Gets the number of columns in the current row.
+		/// </summary>
+		public int FieldCount
+		{
+			// Return the count of the number of columns, which in
+			// this case is the size of the column metadata
+			// array.
+			get 
+			{ 
+				if (fields != null)
+					return fields.Length;
+				return 0;
+			}
+		}
+
+		/// <summary>
+		/// Overloaded. Gets the value of a column in its native format.
+		/// In C#, this property is the indexer for the MySqlDataReader class.
+		/// </summary>
+		public object this [ int i ]
+		{
+			get { return GetValue(i); }
+		}
+
+		/// <summary>
+		/// Gets the value of a column in its native format.
+		///	[C#] In C#, this property is the indexer for the MySqlDataReader class.
+		/// </summary>
+		public object this [ String name ]
+		{
+			// Look up the ordinal and return 
+			// the value at that position.
+			get { return this[GetOrdinal(name)]; }
+		}
+
+		#region TypeSafe Accessors
+		/// <summary>
+		/// Gets the value of the specified column as a Boolean.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public bool GetBoolean(int i)
+		{
+			return Convert.ToBoolean(GetValue(i));
+		}
+
+		/// <summary>
+		/// Gets the value of the specified column as a byte.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public byte GetByte(int i)
+		{
+			MySqlValue v = GetFieldValue(i);
+			if (v is MySqlUByte)
+				return ((MySqlUByte)v).Value;
+			else
+				return (byte)((MySqlByte)v).Value;
+		}
+
+		/// <summary>
+		/// Reads a stream of bytes from the specified column offset into the buffer an array
starting at the given buffer offset.
+		/// </summary>
+		/// <param name="i">The zero-based column ordinal. </param>
+		/// <param name="dataIndex">The index within the field from which to begin the
read operation. </param>
+		/// <param name="buffer">The buffer into which to read the stream of bytes.
</param>
+		/// <param name="bufferIndex">The index for buffer to begin the read operation.
</param>
+		/// <param name="length">The maximum length to copy into the buffer.
</param>
+		/// <returns>The actual number of bytes read.</returns>
+		/// <include file='docs/MySqlDataReader.xml'
path='MyDocs/MyMembers[@name="GetBytes"]/*'/>
+		public long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
+		{
+			if (i >= fields.Length) 
+				throw new IndexOutOfRangeException();
+
+			MySqlValue val = GetFieldValue(i);
+
+			if (! (val is MySqlBinary))
+				throw new MySqlException("GetBytes can only be called on binary columns");
+
+			MySqlBinary binary = (MySqlBinary)val;
+			if (buffer == null) 
+				return (long)binary.Value.Length;
+
+			if (bufferIndex >= buffer.Length || bufferIndex < 0)
+				throw new IndexOutOfRangeException("Buffer index must be a valid index in buffer");
+			if (buffer.Length < (bufferIndex + length))
+				throw new ArgumentException("Buffer is not large enough to hold the requested data"
);
+			if (dataIndex < 0 || 
+				((ulong)dataIndex >= (ulong)binary.Value.Length &&
(ulong)binary.Value.Length > 0))
+				throw new IndexOutOfRangeException("Data index must be a valid index in the field" );
+
+			byte[] bytes = (byte[])binary.Value; 
+
+			// adjust the length so we don't run off the end
+			if ( (ulong)binary.Value.Length < (ulong)(dataIndex+length)) 
+			{
+				length = (int)((ulong)binary.Value.Length - (ulong)dataIndex);
+			}
+
+			Array.Copy( bytes, (int)dataIndex, buffer, (int)bufferIndex, (int)length );
+
+			return length;
+		}
+
+		/// <summary>
+		/// Gets the value of the specified column as a single character.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public char GetChar(int i)
+		{
+			string s = GetString(i);
+			return s[0];
+		}
+
+		/// <summary>
+		/// Reads a stream of characters from the specified column offset into the buffer as an
array starting at the given buffer offset.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <param name="fieldOffset"></param>
+		/// <param name="buffer"></param>
+		/// <param name="bufferoffset"></param>
+		/// <param name="length"></param>
+		/// <returns></returns>
+		public long GetChars(int i, long fieldOffset, char[] buffer, int bufferoffset, int
length)
+		{
+			if (i >= fields.Length) 
+				throw new IndexOutOfRangeException();
+
+			string valAsString = GetString(i);
+
+			if (buffer == null) return valAsString.Length;
+
+			if (bufferoffset >= buffer.Length || bufferoffset < 0)
+				throw new IndexOutOfRangeException("Buffer index must be a valid index in buffer");
+			if (buffer.Length < (bufferoffset + length))
+				throw new ArgumentException( "Buffer is not large enough to hold the requested data"
);
+			if (fieldOffset < 0 || fieldOffset >= valAsString.Length )
+				throw new IndexOutOfRangeException( "Field offset must be a valid index in the field"
);
+			
+			if (valAsString.Length < length)
+				length = valAsString.Length;
+			valAsString.CopyTo( (int)fieldOffset, buffer, bufferoffset, length );
+			return length;
+		}
+
+		/// <summary>
+		/// Gets the name of the source data type.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public String GetDataTypeName(int i)
+		{
+			if (! isOpen) throw new Exception("No current query in data reader");
+			if (i >= fields.Length) throw new IndexOutOfRangeException();
+
+			// return the name of the type used on the backend
+			return currentResult[i].GetMySqlTypeName();
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetMySqlDateTime/*'/>
+		public MySqlDateTime GetMySqlDateTime(int index)
+		{
+			return (MySqlDateTime)GetFieldValue(index);
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetDateTime/*'/>
+		public DateTime GetDateTime(int index)
+		{
+			MySqlValue val = GetFieldValue(index);
+			if (val is MySqlDateTime)
+			{
+				MySqlDateTime dt = (MySqlDateTime)val;
+				if (connection.Settings.ConvertZeroDateTime && !dt.IsValidDateTime)
+					return DateTime.MinValue;
+				else
+					return dt.GetDateTime();
+			}
+			else if (val is MySqlString)
+			{
+				MySqlDateTime d = new MySqlDateTime( MySqlDbType.Datetime );
+				d = d.ParseMySql( (val as MySqlString).Value, true );
+				return d.GetDateTime();
+			}
+			throw new NotSupportedException( "Unable to convert from type " +
val.GetType().ToString() + " to DateTime" );
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetDecimal/*'/>
+		public Decimal GetDecimal(int index)
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlDecimal)
+				return ((MySqlDecimal)v).Value;
+			return Convert.ToDecimal(v.ValueAsObject);
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetDouble/*'/>
+		public double GetDouble(int index)
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlDouble)
+				return ((MySqlDouble)v).Value;
+			return Convert.ToDouble(v.ValueAsObject);
+		}
+
+		/// <summary>
+		/// Gets the Type that is the data type of the object.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public Type GetFieldType(int i)
+		{
+			if (! isOpen) throw new Exception("No current query in data reader");
+			if (i >= fields.Length) throw new IndexOutOfRangeException();
+			
+			if (currentResult[i] is MySqlDateTime &&
!connection.Settings.AllowZeroDateTime)
+				return typeof(DateTime);
+			return currentResult[i].SystemType;
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetFloat/*'/>
+		public float GetFloat(int index)
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlFloat)
+				return ((MySqlFloat)v).Value;
+			return Convert.ToSingle(v.ValueAsObject);
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetGuid/*'/>
+		public Guid GetGuid(int index)
+		{
+			return new Guid( GetString(index) );
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetInt16/*'/>
+		public Int16 GetInt16(int index)
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlInt16)
+				return ((MySqlInt16)v).Value;
+			return Convert.ToInt16(v.ValueAsObject);
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetInt32/*'/>
+		public Int32 GetInt32(int index)
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlInt32)
+				return ((MySqlInt32)v).Value;
+			return Convert.ToInt32(v.ValueAsObject);
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetInt64/*'/>
+		public Int64 GetInt64(int index)
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlInt64)
+				return ((MySqlInt64)v).Value;
+			return Convert.ToInt64(v.ValueAsObject);
+		}
+
+		/// <summary>
+		/// Gets the name of the specified column.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public String GetName(int i)
+		{
+			return fields[i].ColumnName;
+		}
+
+		/// <summary>
+		/// Gets the column ordinal, given the name of the column.
+		/// </summary>
+		/// <param name="name"></param>
+		/// <returns></returns>
+		public int GetOrdinal(string name)
+		{
+			if (! isOpen)
+				throw new Exception("No current query in data reader");
+
+			name = name.ToLower(System.Globalization.CultureInfo.InvariantCulture);
+			for (int i=0; i < fields.Length; i ++) 
+			{
+				if (fields[i].ColumnName.ToLower(System.Globalization.CultureInfo.InvariantCulture)
== name)
+					return i;
+			}
+
+			// Throw an exception if the ordinal cannot be found.
+			throw new IndexOutOfRangeException("Could not find specified column in results");
+		}
+
+		/// <summary>
+		/// Returns a DataTable that describes the column metadata of the MySqlDataReader.
+		/// </summary>
+		/// <returns></returns>
+		public DataTable GetSchemaTable()
+		{
+			if (schemaTable != null) return schemaTable;
+
+			// Only Results from SQL SELECT Queries 
+			// get a DataTable for schema of the result
+			// otherwise, DataTable is null reference
+			if (fields.Length == 0) return null;
+
+			DataTable dataTableSchema = new DataTable ("SchemaTable");
+			
+			dataTableSchema.Columns.Add ("ColumnName", typeof (string));
+			dataTableSchema.Columns.Add ("ColumnOrdinal", typeof (int));
+			dataTableSchema.Columns.Add ("ColumnSize", typeof (int));
+			dataTableSchema.Columns.Add ("NumericPrecision", typeof (int));
+			dataTableSchema.Columns.Add ("NumericScale", typeof (int));
+			dataTableSchema.Columns.Add ("IsUnique", typeof (bool));
+			dataTableSchema.Columns.Add ("IsKey", typeof (bool));
+			DataColumn dc = dataTableSchema.Columns["IsKey"];
+			dc.AllowDBNull = true; // IsKey can have a DBNull
+			dataTableSchema.Columns.Add ("BaseCatalogName", typeof (string));
+			dataTableSchema.Columns.Add ("BaseColumnName", typeof (string));
+			dataTableSchema.Columns.Add ("BaseSchemaName", typeof (string));
+			dataTableSchema.Columns.Add ("BaseTableName", typeof (string));
+			dataTableSchema.Columns.Add ("DataType", typeof(Type));
+			dataTableSchema.Columns.Add ("AllowDBNull", typeof (bool));
+			dataTableSchema.Columns.Add ("ProviderType", typeof (int));
+			dataTableSchema.Columns.Add ("IsAliased", typeof (bool));
+			dataTableSchema.Columns.Add ("IsExpression", typeof (bool));
+			dataTableSchema.Columns.Add ("IsIdentity", typeof (bool));
+			dataTableSchema.Columns.Add ("IsAutoIncrement", typeof (bool));
+			dataTableSchema.Columns.Add ("IsRowVersion", typeof (bool));
+			dataTableSchema.Columns.Add ("IsHidden", typeof (bool));
+			dataTableSchema.Columns.Add ("IsLong", typeof (bool));
+			dataTableSchema.Columns.Add ("IsReadOnly", typeof (bool));
+
+			int ord = 1;
+			for (int i=0; i < fields.Length; i++)
+			{
+				MySqlField f = fields[i];
+
+				DataRow r = dataTableSchema.NewRow();
+				r["ColumnName"] = f.ColumnName;
+				r["ColumnOrdinal"] = ord++;
+				r["ColumnSize"] = f.ColumnLength;
+				int prec = f.Precision;
+				int pscale = f.Scale;
+				if (prec != -1)
+					r["NumericPrecision"] = (short)prec;
+				if (pscale != -1)
+					r["NumericScale"] = (short)pscale;
+				r["DataType"] = GetFieldType(i);
+				r["ProviderType"] = (int)f.ProviderType();
+				r["IsLong"] = f.IsBlob && f.ColumnLength > 255;
+				r["AllowDBNull"] = f.AllowsNull;
+				r["IsReadOnly"] = false;
+				r["IsRowVersion"] = false;
+				r["IsUnique"] = f.IsUnique || f.IsPrimaryKey;
+				r["IsKey"] = f.IsPrimaryKey;
+				r["IsAutoIncrement"] = f.IsAutoIncrement;
+				r["BaseSchemaName"] = f.DatabaseName;
+				r["BaseCatalogName"] = f.DatabaseName;
+				r["BaseTableName"] = f.RealTableName;
+				r["BaseColumnName"] = f.OriginalColumnName;
+
+				dataTableSchema.Rows.Add( r );
+			}
+
+			schemaTable = dataTableSchema;
+			return dataTableSchema;
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetString/*'/>
+		public String GetString(int index)
+		{
+			MySqlValue val = GetFieldValue(index);
+			MySqlString str = (val as MySqlString);
+			if (str != null) return str.Value;
+
+			if (val is MySqlBinary)
+				return (currentResult[index] as MySqlBinary).ToString( fields[index].Encoding );
+
+			return val.ToString();
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetTimeSpan/*'/>
+		public TimeSpan GetTimeSpan(int index)
+		{
+			MySqlTimeSpan ts = (MySqlTimeSpan)GetFieldValue(index);
+			return ts.Value;
+		}
+
+		/// <summary>
+		/// Gets the value of the specified column in its native format.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public object GetValue(int i)
+		{
+			if (! isOpen) throw new Exception("No current query in data reader");
+			if (i >= fields.Length) throw new IndexOutOfRangeException();
+
+			MySqlValue val = GetFieldValue(i);
+			if (val.IsNull) return DBNull.Value;
+
+			// if the column is a date/time, then we return a MySqlDateTime
+			// so .ToString() will print '0000-00-00' correctly
 			if (val is MySqlDateTime) 
-			{
-				MySqlDateTime dt = (MySqlDateTime)val;
-				if (! dt.IsValidDateTime && connection.Settings.ConvertZeroDateTime)
-					return DateTime.MinValue;
-				else if (connection.Settings.AllowZeroDateTime) 
-					return val;
-				else
-					return dt.GetDateTime();
-			}
-
-			return val.ValueAsObject;
-		}
-
-		/// <summary>
-		/// Gets all attribute columns in the collection for the current row.
-		/// </summary>
-		/// <param name="values"></param>
-		/// <returns></returns>
-		public int GetValues(object[] values)
-		{
-			if (values == null) return 0;
-			int numCols = Math.Min( values.Length, fields.Length );
-			for (int i=0; i < numCols; i ++) 
-				values[i] = GetValue(i);
-
-			return numCols;
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetUInt16/*'/>
-		public UInt16 GetUInt16( int index )
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlUInt16)
-				return ((MySqlUInt16)v).Value;
-			return Convert.ToUInt16(v.ValueAsObject);
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetUInt32/*'/>
-		public UInt32 GetUInt32( int index )
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlUInt32)
-				return ((MySqlUInt32)v).Value;
-			return Convert.ToUInt32(v.ValueAsObject);
-		}
-
-		/// <include file='docs/MySqlDataReader.xml' path='docs/GetUInt64/*'/>
-		public UInt64 GetUInt64( int index )
-		{
-			MySqlValue v = GetFieldValue(index);
-			if (v is MySqlUInt64)
-				return ((MySqlUInt64)v).Value;
-			return Convert.ToUInt64(v.ValueAsObject);
-		}
-
-
-		#endregion
-
-		IDataReader IDataRecord.GetData(int i)
-		{
-			throw new NotSupportedException("GetData not supported.");
-		}
-
-		/// <summary>
-		/// Gets a value indicating whether the column contains non-existent or missing values.
-		/// </summary>
-		/// <param name="i"></param>
-		/// <returns></returns>
-		public bool IsDBNull(int i)
-		{
-			return DBNull.Value == GetValue(i);
-		}
-
-		/// <summary>
-		/// Advances the data reader to the next result, when reading the results of batch SQL
statements.
-		/// </summary>
-		/// <returns></returns>
-		public bool NextResult()
-		{
-			if (! isOpen)
-				throw new MySqlException("Invalid attempt to NextResult when reader is closed.");
-
-			// clear any rows that have not been read from the last rowset
+			{
+				MySqlDateTime dt = (MySqlDateTime)val;
+				if (! dt.IsValidDateTime && connection.Settings.ConvertZeroDateTime)
+					return DateTime.MinValue;
+				else if (connection.Settings.AllowZeroDateTime) 
+					return val;
+				else
+					return dt.GetDateTime();
+			}
+
+			return val.ValueAsObject;
+		}
+
+		/// <summary>
+		/// Gets all attribute columns in the collection for the current row.
+		/// </summary>
+		/// <param name="values"></param>
+		/// <returns></returns>
+		public int GetValues(object[] values)
+		{
+			if (values == null) return 0;
+			int numCols = Math.Min( values.Length, fields.Length );
+			for (int i=0; i < numCols; i ++) 
+				values[i] = GetValue(i);
+
+			return numCols;
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetUInt16/*'/>
+		public UInt16 GetUInt16( int index )
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlUInt16)
+				return ((MySqlUInt16)v).Value;
+			return Convert.ToUInt16(v.ValueAsObject);
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetUInt32/*'/>
+		public UInt32 GetUInt32( int index )
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlUInt32)
+				return ((MySqlUInt32)v).Value;
+			return Convert.ToUInt32(v.ValueAsObject);
+		}
+
+		/// <include file='docs/MySqlDataReader.xml' path='docs/GetUInt64/*'/>
+		public UInt64 GetUInt64( int index )
+		{
+			MySqlValue v = GetFieldValue(index);
+			if (v is MySqlUInt64)
+				return ((MySqlUInt64)v).Value;
+			return Convert.ToUInt64(v.ValueAsObject);
+		}
+
+
+		#endregion
+
+		IDataReader IDataRecord.GetData(int i)
+		{
+			throw new NotSupportedException("GetData not supported.");
+		}
+
+		/// <summary>
+		/// Gets a value indicating whether the column contains non-existent or missing values.
+		/// </summary>
+		/// <param name="i"></param>
+		/// <returns></returns>
+		public bool IsDBNull(int i)
+		{
+			return DBNull.Value == GetValue(i);
+		}
+
+		/// <summary>
+		/// Advances the data reader to the next result, when reading the results of batch SQL
statements.
+		/// </summary>
+		/// <returns></returns>
+		public bool NextResult()
+		{
+			if (! isOpen)
+				throw new MySqlException("Invalid attempt to NextResult when reader is closed.");
+
+			// clear any rows that have not been read from the last rowset
 			if (currentResult != null) 
-				currentResult.Consume();
-
-			// tell our command to continue execution of the SQL batch until it its
-			// another resultset
+				currentResult.Consume();
+
+			// tell our command to continue execution of the SQL batch until it its
+			// another resultset
 			try 
-			{
-				CommandResult nextResult = command.GetNextResultSet(this);
-				if (nextResult != null)
-					currentResult = nextResult;
+			{
+				CommandResult nextResult = command.GetNextResultSet(this);
+				if (nextResult != null)
+					currentResult = nextResult;
 				else 
-				{
-					// if there was no more resultsets, then signal done
-					canRead = false;
-					return false;
-				}
-				readCount = 0;
-
-				schemaTable = null;
-
-				// When executing query statements, the result byte that is returned
-				// from MySql is the column count.  That is why we reference the LastResult
-				// property here to dimension our field array
-				connection.SetState( ConnectionState.Fetching );
-
-				// load in our field defs and set our internal variables so we know
-				// what we can do (canRead, hasRows)
-				canRead = hasRows = currentResult.Load();
-				fields = currentResult.Fields;
-				return true;
-			}
+				{
+					// if there was no more resultsets, then signal done
+					canRead = false;
+					return false;
+				}
+				readCount = 0;
+
+				schemaTable = null;
+
+				// When executing query statements, the result byte that is returned
+				// from MySql is the column count.  That is why we reference the LastResult
+				// property here to dimension our field array
+				connection.SetState( ConnectionState.Fetching );
+
+				// load in our field defs and set our internal variables so we know
+				// what we can do (canRead, hasRows)
+				canRead = hasRows = currentResult.Load();
+				fields = currentResult.Fields;
+				return true;
+			}
 			catch (Exception ex) 
-			{
-				if (ex is MySqlException && !(ex as MySqlException).IsFatal)
-					connection.SetState( ConnectionState.Open );
-				else
-					connection.Terminate();
-				throw;
-			}
+			{
+				if (ex is MySqlException && !(ex as MySqlException).IsFatal)
+					connection.SetState( ConnectionState.Open );
+				else
+					connection.Terminate();
+				throw;
+			}
 			finally 
-			{
-				if (connection.State != ConnectionState.Closed && connection.State !=
ConnectionState.Open)
-					connection.SetState( ConnectionState.Open );
-			}
-		}
-
-		/// <summary>
-		/// Advances the MySqlDataReader to the next record.
-		/// </summary>
-		/// <returns></returns>
-		public bool Read()
-		{
-			if (! isOpen)
-				throw new MySqlException("Invalid attempt to Read when reader is closed.");
-
-			if (! canRead) return false;
-			readCount ++;
-
-			connection.SetState( ConnectionState.Fetching );
-
-			try 
-			{
+			{
+				if (connection.State != ConnectionState.Closed && connection.State !=
ConnectionState.Open)
+					connection.SetState( ConnectionState.Open );
+			}
+		}
+
+		/// <summary>
+		/// Advances the MySqlDataReader to the next record.
+		/// </summary>
+		/// <returns></returns>
+		public bool Read()
+		{
+			if (! isOpen)
+				throw new MySqlException("Invalid attempt to Read when reader is closed.");
+
+			if (! canRead) return false;
+			readCount ++;
+
+			connection.SetState( ConnectionState.Fetching );
+
+			try 
+			{
 				try 
-				{
-					if ( (Behavior & CommandBehavior.SequentialAccess) != 0)
-						canRead = currentResult.ReadDataRow( false );
-					else
-						canRead = currentResult.ReadDataRow( true );
-					if ( ! canRead) return false;
-				}
+				{
+					if ( (Behavior & CommandBehavior.SequentialAccess) != 0)
+						canRead = currentResult.ReadDataRow( false );
+					else
+						canRead = currentResult.ReadDataRow( true );
+					if ( ! canRead) return false;
+				}
 				catch (MySqlException ex) 
-				{
-					if (ex.IsFatal) 
-						connection.Terminate();
-					throw;
-				}
-
-				// if we are in SingleRow mode, then set canRead to false so we'll
-				// fail next time.
-				if (Behavior == CommandBehavior.SingleRow)
-					canRead = false;
-			}
-			catch (Exception ex)
-			{
-				System.Diagnostics.Trace.WriteLine("MySql error: " + ex.Message);
-				throw;
-			}
-			finally 
-			{
-				connection.SetState( ConnectionState.Open );
-			}
-			return true;
-		}
-
-
+				{
+					if (ex.IsFatal) 
+						connection.Terminate();
+					throw;
+				}
+
+				// if we are in SingleRow mode, then set canRead to false so we'll
+				// fail next time.
+				if (Behavior == CommandBehavior.SingleRow)
+					canRead = false;
+			}
+			catch (Exception ex)
+			{
+				System.Diagnostics.Trace.WriteLine("MySql error: " + ex.Message);
+				throw;
+			}
+			finally 
+			{
+				connection.SetState( ConnectionState.Open );
+			}
+			return true;
+		}
+
+
 		private MySqlValue GetFieldValue(int index) 
-		{
+		{
 			if (index < 0 || index >= fields.Length) 
 				throw new ArgumentException( "You have specified an invalid column ordinal." );
 
@@ -751,23 +751,23 @@
 
 				return val;
 			}
-			catch (MySqlException ex)
-			{
-				if (ex.IsFatal)
-				{
-					connection.Reader = null;
-					connection.Terminate();
-				}
-				throw;
-			}
-		}
-
-
-		#region IEnumerator
-		IEnumerator	IEnumerable.GetEnumerator()
-		{
-			return new System.Data.Common.DbEnumerator(this);
-		}
-		#endregion
-	}
-}
+			catch (MySqlException ex)
+			{
+				if (ex.IsFatal)
+				{
+					connection.Reader = null;
+					connection.Terminate();
+				}
+				throw;
+			}
+		}
+
+
+		#region IEnumerator
+		IEnumerator	IEnumerable.GetEnumerator()
+		{
+			return new System.Data.Common.DbEnumerator(this);
+		}
+		#endregion
+	}
+}

Modified: branches/1.0/mysqlclient/nativedriver.cs
===================================================================
--- branches/1.0/mysqlclient/nativedriver.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/mysqlclient/nativedriver.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,489 +1,489 @@
-// Copyright (C) 2004-2005 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.Net;
-using System.Net.Sockets;
-using System.IO;
-using ICSharpCode.SharpZipLib.Zip.Compression;
-using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
-using System.Security.Cryptography;
-using MySql.Data.Common;
-using System.Collections;
-using System.Text;
-using MySql.Data.Types;
-
-namespace MySql.Data.MySqlClient
-{
-	/// <summary>
-	/// Summary description for Driver.
-	/// </summary>
-	internal class NativeDriver : Driver
-	{
-		public    int					MaxSinglePacket = 255 * 255 * 255;
-		protected byte					packetSeq;
-
-		protected int					protocol;
-		protected String				encryptionSeed;
-		protected ClientFlags			connectionFlags;
-
-		protected PacketReader			reader;
-		protected PacketWriter			writer;
-		private   BitArray				nullMap;
-
-		public NativeDriver(MySqlConnectionString settings) : base(settings)
-		{
-			packetSeq = 0;
-			isOpen = false;
-			maxPacketSize = 1047552;
-		}
-
-		public ClientFlags Flags
-		{
-			get { return connectionFlags; }
-		}
-
-		public byte SequenceByte 
-		{
-			set { packetSeq = value; }
-			get { return packetSeq; }
-		}
-
-		/// <summary>
-		/// Returns true if this connection can handle batch SQL natively
-		/// This means MySQL 4.1.1 or later.
-		/// </summary>
-		public override bool SupportsBatch 
-		{
-			get 
-			{ 
-				if ((Flags & ClientFlags.MULTI_STATEMENTS) != 0)
-				{
-					if (version.isAtLeast(4, 1, 0) && ! version.isAtLeast(4, 1, 10))
-					{
-						if (serverProps["query_cache_type"].Equals("ON") &&
-							!serverProps["query_cache_size"].Equals("0")) return false;
-					}
-					return true;
-				}
-				return false;
-			}
-		}
-
-		private void ExecuteCommand( DBCmd cmd, byte[] bytes, int length ) 
-		{
-			SequenceByte = 0;
-			int len = 1;
-			if (bytes != null)
-				len += length;
-			writer.StartPacket( len );
-			writer.WriteByte( (byte)cmd );
-			if (bytes != null)
-				writer.Write( bytes, 0, length );
-			writer.Flush();
-		}
-
-		/// <summary>
-		/// Sets the current database for the this connection
-		/// </summary>
-		/// <param name="dbName"></param>
-		public override void SetDatabase( string dbName )
-		{
-			byte[] dbNameBytes = Encoding.GetBytes( dbName );
-			ExecuteCommand( DBCmd.INIT_DB, dbNameBytes, dbNameBytes.Length );
-			if (! reader.ReadOk())
-				throw new MySqlException( "Failure setting database <" + dbName + ">" );
-		}
-
-		public string GetString( byte[] stringBuffer )
-		{
-			if (stringBuffer == null) return String.Empty;
-			return encoding.GetString( stringBuffer );
-		}
-
-		public byte[] GetBytes( string s )
-		{
-			return encoding.GetBytes( s );
-		}
-
-		public override void Open()
-		{
-			base.Open();
-
-			// connect to one of our specified hosts
-			Stream stream;
-			try 
-			{
-				if (Settings.Protocol == ConnectionProtocol.SharedMemory)
-				{
-					SharedMemoryStream str = new SharedMemoryStream( Settings.SharedMemoryName );
-					str.Open( Settings.ConnectionTimeout );
-					stream = str;
-				}
-				else 
-				{
-					string pipeName = Settings.PipeName;
-					if (Settings.Protocol != ConnectionProtocol.NamedPipe)
-						pipeName = null;
-					StreamCreator sc = new StreamCreator( Settings.Server, Settings.Port, pipeName );
-					stream = sc.GetStream( Settings.ConnectionTimeout );
-				}
-			}
-			catch (Exception ex)
-			{
-				throw new MySqlException("Unable to connect to any of the specified MySQL hosts",
ex);
-			}
-
-
-			if (stream == null) 
-				throw new MySqlException("Unable to connect to any of the specified MySQL hosts");
-
-			reader = new PacketReader( new BufferedStream(stream), this );
-			writer = new PacketWriter( new BufferedStream(stream), this );
-			writer.Encoding = encoding;
-
-			// read off the welcome packet and parse out it's values
-			reader.OpenPacket();
-			protocol = reader.ReadByte();
-			string versionString = reader.ReadString();
-			version = DBVersion.Parse( versionString );
-			threadId = (int)reader.ReadInteger(4);
-			encryptionSeed = reader.ReadString();
-
-			// starting with 4.0.8, maxSinglePacket should be 0xffffff
-			if ( version.isAtLeast(4,0,8))
-				MaxSinglePacket = (256*256*256)-1;
-
-			// read in Server capabilities if they are provided
-			serverCaps = 0;
-			if (reader.HasMoreData)
-				serverCaps = (ClientFlags)reader.ReadInteger(2);
-
-			// based on our settings, set our connection flags
-			SetConnectionFlags();
-
-			writer.StartPacket(0);
-			writer.WriteInteger( (int)connectionFlags, version.isAtLeast(4,1,0) ? 4 : 2 );
-			writer.WriteInteger( MaxSinglePacket, version.isAtLeast(4,1,0) ? 4 : 3 );
-
-			// 4.1.1 included some new server status info
-			if ( version.isAtLeast(4,1,1))
-			{
-				/* New protocol with 16 bytes to describe server characteristics */
-				serverLanguage = reader.ReadInteger(1);
-				serverStatus = (ServerStatusFlags)reader.ReadInteger(2);
-				reader.Skip( 13 );
-
-				string seedPart2 = reader.ReadString();
-				encryptionSeed += seedPart2;
-
-				writer.WriteByte( 8 );
-				writer.Write( new byte[23], 0, 23 );
-			}
-
-			Authenticate();
-
-			// if we are using compression, then we use our CompressedStream class
-			// to hide the ugliness of managing the compression
-			if ((connectionFlags & ClientFlags.COMPRESS) != 0)
-			{
-				//stream = new CompressedStream( stream, MaxSinglePacket );
-				writer = new PacketWriter( new CompressedStream( new BufferedStream( stream ) ), this
 );
-				writer.Encoding = encoding;
-				reader = new PacketReader( new CompressedStream( new BufferedStream( stream ) ), this
);
-			}
-
-			isOpen = true;
-		}
-
-		/// <summary>
-		/// Return the appropriate set of connection flags for our
-		/// server capabilities and our user requested options.
-		/// </summary>
-		private void SetConnectionFlags()
-		{
-			ClientFlags flags = ClientFlags.FOUND_ROWS;
-
-			if ( version.isAtLeast(4,1,1) )
-			{
-				flags |= ClientFlags.PROTOCOL_41;
-				// Need this to get server status values
-				flags |= ClientFlags.TRANSACTIONS;
-
-				// user allows/disallows batch statements
-				if (connectionString.AllowBatch)
-					flags |= ClientFlags.MULTI_STATEMENTS;
-
-				// We always allow multiple result sets
-				flags |= ClientFlags.MULTI_RESULTS;
-			}
-			else if ( version.isAtLeast( 4, 1, 0 ) )
-				flags |= ClientFlags.RESERVED;
-			
-			// if the server allows it, tell it that we want long column info
-			if ((serverCaps & ClientFlags.LONG_FLAG) != 0)
-				flags |= ClientFlags.LONG_FLAG;
-
-			// if the server supports it and it was requested, then turn on compression
-			if ((serverCaps & ClientFlags.COMPRESS) != 0 &&
connectionString.UseCompression)
-				flags |= ClientFlags.COMPRESS;
-
-			if ( protocol > 9 )
-				flags |= ClientFlags.LONG_PASSWORD; // for long passwords
-			else 
-				flags &= ~ClientFlags.LONG_PASSWORD;
-
-			// allow load data local infile
-			flags |= ClientFlags.LOCAL_FILES;
-
-			// if the server allows it and a database was specified, then indicate
-			// that we will connect with a database name
-			if ((serverCaps & ClientFlags.CONNECT_WITH_DB) != 0 && 
-				connectionString.Database != null && connectionString.Database.Length > 0)
-				flags |= ClientFlags.CONNECT_WITH_DB;
-
-			// if the server is requesting a secure connection, then we oblige
-			if ((serverCaps & ClientFlags.SECURE_CONNECTION) != 0)
-				flags |= ClientFlags.SECURE_CONNECTION;
-
-			connectionFlags = flags;
-		}
-
-
-		/// <summary>Perform an authentication against a 4.1.1 server</summary>
-		private void Authenticate411()
-		{
-			if ( (connectionFlags & ClientFlags.SECURE_CONNECTION) == 0)
-				AuthenticateOld();
-
-			writer.Write( Crypt.Get411Password( connectionString.Password, this.encryptionSeed ));
-			if ( (connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 &&
connectionString.Database != null)
-				writer.WriteString( connectionString.Database );
-			writer.Flush();
-			reader.OpenPacket();
-
-			// this result means the server wants us to send the password using
-			// old encryption
-			if (reader.IsLastPacket)
-			{
-				writer.StartPacket(0);
-				writer.WriteString( Crypt.EncryptPassword( 
-					connectionString.Password, this.encryptionSeed.Substring(0,8), true ) );
-				writer.Flush();
-				reader.ReadOk();
-			}
-		}
-
-		private void AuthenticateOld()
-		{
-			writer.WriteString( Crypt.EncryptPassword( 
-				connectionString.Password, encryptionSeed, protocol > 9));
-			if ( (connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 &&
connectionString.Database != null)
-				writer.WriteString( connectionString.Database );
-			writer.Flush();
-			reader.ReadOk();
-		}
-
-		public void Authenticate()
-		{
-			// write the user id to the auth packet
-			writer.WriteString( connectionString.UserId ); 
-
-			if ( version.isAtLeast(4,1,1) )
-				Authenticate411();
-			else
-				AuthenticateOld();
-		}
-
-		public override void Reset()
-		{
-			SequenceByte = 0;
-			writer.StartPacket(0);
-			writer.WriteByte( (byte)DBCmd.CHANGE_USER );
-			Authenticate();
-		}
-
-		public override CommandResult SendQuery( byte[] bytes, int length, bool consume ) 
-		{
-			if (Settings.Logging)
-				Logger.LogCommand( DBCmd.QUERY, encoding.GetString( bytes, 0, length ) );
-
-			ExecuteCommand( DBCmd.QUERY, bytes, length );
-
-			CommandResult rs = new CommandResult( this, false );
-			return rs;
-		}
-
-		public override void Close() 
-		{
-			if (isOpen)
-			{
-				ExecuteCommand(DBCmd.QUIT, null, 0);
-
-				writer.Stream.Close();
-				reader.Stream.Close();
-			}
-
-			base.Close();
-		}
-
-
-		public override bool Ping() 
-		{
-			try 
-			{
-				// if we are processing a command, we can't send a command since MySQL doesn't 
-				// support interleaved commands
-				//if (processing) return true;
-
-				ExecuteCommand(DBCmd.PING, null, 0); 
-				return reader.ReadOk();
-			}
-			catch (Exception) 
-			{
-				isOpen = false;
-				// exceptions here can be very common so we don't log
-				return false;
-			}
-		}
-
-		public override long ReadResult( ref long affectedRows, ref long lastInsertId )
-		{
-			reader.OpenPacket();
-
-			long cols = reader.GetFieldLength();
+// Copyright (C) 2004-2005 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.Net;
+using System.Net.Sockets;
+using System.IO;
+using ICSharpCode.SharpZipLib.Zip.Compression;
+using ICSharpCode.SharpZipLib.Zip.Compression.Streams;
+using System.Security.Cryptography;
+using MySql.Data.Common;
+using System.Collections;
+using System.Text;
+using MySql.Data.Types;
+
+namespace MySql.Data.MySqlClient
+{
+	/// <summary>
+	/// Summary description for Driver.
+	/// </summary>
+	internal class NativeDriver : Driver
+	{
+		public    int					MaxSinglePacket = 255 * 255 * 255;
+		protected byte					packetSeq;
+
+		protected int					protocol;
+		protected String				encryptionSeed;
+		protected ClientFlags			connectionFlags;
+
+		protected PacketReader			reader;
+		protected PacketWriter			writer;
+		private   BitArray				nullMap;
+
+		public NativeDriver(MySqlConnectionString settings) : base(settings)
+		{
+			packetSeq = 0;
+			isOpen = false;
+			maxPacketSize = 1047552;
+		}
+
+		public ClientFlags Flags
+		{
+			get { return connectionFlags; }
+		}
+
+		public byte SequenceByte 
+		{
+			set { packetSeq = value; }
+			get { return packetSeq; }
+		}
+
+		/// <summary>
+		/// Returns true if this connection can handle batch SQL natively
+		/// This means MySQL 4.1.1 or later.
+		/// </summary>
+		public override bool SupportsBatch 
+		{
+			get 
+			{ 
+				if ((Flags & ClientFlags.MULTI_STATEMENTS) != 0)
+				{
+					if (version.isAtLeast(4, 1, 0) && ! version.isAtLeast(4, 1, 10))
+					{
+						if (serverProps["query_cache_type"].Equals("ON") &&
+							!serverProps["query_cache_size"].Equals("0")) return false;
+					}
+					return true;
+				}
+				return false;
+			}
+		}
+
+		private void ExecuteCommand( DBCmd cmd, byte[] bytes, int length ) 
+		{
+			SequenceByte = 0;
+			int len = 1;
+			if (bytes != null)
+				len += length;
+			writer.StartPacket( len );
+			writer.WriteByte( (byte)cmd );
+			if (bytes != null)
+				writer.Write( bytes, 0, length );
+			writer.Flush();
+		}
+
+		/// <summary>
+		/// Sets the current database for the this connection
+		/// </summary>
+		/// <param name="dbName"></param>
+		public override void SetDatabase( string dbName )
+		{
+			byte[] dbNameBytes = Encoding.GetBytes( dbName );
+			ExecuteCommand( DBCmd.INIT_DB, dbNameBytes, dbNameBytes.Length );
+			if (! reader.ReadOk())
+				throw new MySqlException( "Failure setting database <" + dbName + ">" );
+		}
+
+		public string GetString( byte[] stringBuffer )
+		{
+			if (stringBuffer == null) return String.Empty;
+			return encoding.GetString( stringBuffer );
+		}
+
+		public byte[] GetBytes( string s )
+		{
+			return encoding.GetBytes( s );
+		}
+
+		public override void Open()
+		{
+			base.Open();
+
+			// connect to one of our specified hosts
+			Stream stream;
+			try 
+			{
+				if (Settings.Protocol == ConnectionProtocol.SharedMemory)
+				{
+					SharedMemoryStream str = new SharedMemoryStream( Settings.SharedMemoryName );
+					str.Open( Settings.ConnectionTimeout );
+					stream = str;
+				}
+				else 
+				{
+					string pipeName = Settings.PipeName;
+					if (Settings.Protocol != ConnectionProtocol.NamedPipe)
+						pipeName = null;
+					StreamCreator sc = new StreamCreator( Settings.Server, Settings.Port, pipeName );
+					stream = sc.GetStream( Settings.ConnectionTimeout );
+				}
+			}
+			catch (Exception ex)
+			{
+				throw new MySqlException("Unable to connect to any of the specified MySQL hosts",
ex);
+			}
+
+
+			if (stream == null) 
+				throw new MySqlException("Unable to connect to any of the specified MySQL hosts");
+
+			reader = new PacketReader( new BufferedStream(stream), this );
+			writer = new PacketWriter( new BufferedStream(stream), this );
+			writer.Encoding = encoding;
+
+			// read off the welcome packet and parse out it's values
+			reader.OpenPacket();
+			protocol = reader.ReadByte();
+			string versionString = reader.ReadString();
+			version = DBVersion.Parse( versionString );
+			threadId = (int)reader.ReadInteger(4);
+			encryptionSeed = reader.ReadString();
+
+			// starting with 4.0.8, maxSinglePacket should be 0xffffff
+			if ( version.isAtLeast(4,0,8))
+				MaxSinglePacket = (256*256*256)-1;
+
+			// read in Server capabilities if they are provided
+			serverCaps = 0;
+			if (reader.HasMoreData)
+				serverCaps = (ClientFlags)reader.ReadInteger(2);
+
+			// based on our settings, set our connection flags
+			SetConnectionFlags();
+
+			writer.StartPacket(0);
+			writer.WriteInteger( (int)connectionFlags, version.isAtLeast(4,1,0) ? 4 : 2 );
+			writer.WriteInteger( MaxSinglePacket, version.isAtLeast(4,1,0) ? 4 : 3 );
+
+			// 4.1.1 included some new server status info
+			if ( version.isAtLeast(4,1,1))
+			{
+				/* New protocol with 16 bytes to describe server characteristics */
+				serverLanguage = reader.ReadInteger(1);
+				serverStatus = (ServerStatusFlags)reader.ReadInteger(2);
+				reader.Skip( 13 );
+
+				string seedPart2 = reader.ReadString();
+				encryptionSeed += seedPart2;
+
+				writer.WriteByte( 8 );
+				writer.Write( new byte[23], 0, 23 );
+			}
+
+			Authenticate();
+
+			// if we are using compression, then we use our CompressedStream class
+			// to hide the ugliness of managing the compression
+			if ((connectionFlags & ClientFlags.COMPRESS) != 0)
+			{
+				//stream = new CompressedStream( stream, MaxSinglePacket );
+				writer = new PacketWriter( new CompressedStream( new BufferedStream( stream ) ), this
 );
+				writer.Encoding = encoding;
+				reader = new PacketReader( new CompressedStream( new BufferedStream( stream ) ), this
);
+			}
+
+			isOpen = true;
+		}
+
+		/// <summary>
+		/// Return the appropriate set of connection flags for our
+		/// server capabilities and our user requested options.
+		/// </summary>
+		private void SetConnectionFlags()
+		{
+			ClientFlags flags = ClientFlags.FOUND_ROWS;
+
+			if ( version.isAtLeast(4,1,1) )
+			{
+				flags |= ClientFlags.PROTOCOL_41;
+				// Need this to get server status values
+				flags |= ClientFlags.TRANSACTIONS;
+
+				// user allows/disallows batch statements
+				if (connectionString.AllowBatch)
+					flags |= ClientFlags.MULTI_STATEMENTS;
+
+				// We always allow multiple result sets
+				flags |= ClientFlags.MULTI_RESULTS;
+			}
+			else if ( version.isAtLeast( 4, 1, 0 ) )
+				flags |= ClientFlags.RESERVED;
+			
+			// if the server allows it, tell it that we want long column info
+			if ((serverCaps & ClientFlags.LONG_FLAG) != 0)
+				flags |= ClientFlags.LONG_FLAG;
+
+			// if the server supports it and it was requested, then turn on compression
+			if ((serverCaps & ClientFlags.COMPRESS) != 0 &&
connectionString.UseCompression)
+				flags |= ClientFlags.COMPRESS;
+
+			if ( protocol > 9 )
+				flags |= ClientFlags.LONG_PASSWORD; // for long passwords
+			else 
+				flags &= ~ClientFlags.LONG_PASSWORD;
+
+			// allow load data local infile
+			flags |= ClientFlags.LOCAL_FILES;
+
+			// if the server allows it and a database was specified, then indicate
+			// that we will connect with a database name
+			if ((serverCaps & ClientFlags.CONNECT_WITH_DB) != 0 && 
+				connectionString.Database != null && connectionString.Database.Length > 0)
+				flags |= ClientFlags.CONNECT_WITH_DB;
+
+			// if the server is requesting a secure connection, then we oblige
+			if ((serverCaps & ClientFlags.SECURE_CONNECTION) != 0)
+				flags |= ClientFlags.SECURE_CONNECTION;
+
+			connectionFlags = flags;
+		}
+
+
+		/// <summary>Perform an authentication against a 4.1.1 server</summary>
+		private void Authenticate411()
+		{
+			if ( (connectionFlags & ClientFlags.SECURE_CONNECTION) == 0)
+				AuthenticateOld();
+
+			writer.Write( Crypt.Get411Password( connectionString.Password, this.encryptionSeed ));
+			if ( (connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 &&
connectionString.Database != null)
+				writer.WriteString( connectionString.Database );
+			writer.Flush();
+			reader.OpenPacket();
+
+			// this result means the server wants us to send the password using
+			// old encryption
+			if (reader.IsLastPacket)
+			{
+				writer.StartPacket(0);
+				writer.WriteString( Crypt.EncryptPassword( 
+					connectionString.Password, this.encryptionSeed.Substring(0,8), true ) );
+				writer.Flush();
+				reader.ReadOk();
+			}
+		}
+
+		private void AuthenticateOld()
+		{
+			writer.WriteString( Crypt.EncryptPassword( 
+				connectionString.Password, encryptionSeed, protocol > 9));
+			if ( (connectionFlags & ClientFlags.CONNECT_WITH_DB) != 0 &&
connectionString.Database != null)
+				writer.WriteString( connectionString.Database );
+			writer.Flush();
+			reader.ReadOk();
+		}
+
+		public void Authenticate()
+		{
+			// write the user id to the auth packet
+			writer.WriteString( connectionString.UserId ); 
+
+			if ( version.isAtLeast(4,1,1) )
+				Authenticate411();
+			else
+				AuthenticateOld();
+		}
+
+		public override void Reset()
+		{
+			SequenceByte = 0;
+			writer.StartPacket(0);
+			writer.WriteByte( (byte)DBCmd.CHANGE_USER );
+			Authenticate();
+		}
+
+		public override CommandResult SendQuery( byte[] bytes, int length, bool consume ) 
+		{
+			if (Settings.Logging)
+				Logger.LogCommand( DBCmd.QUERY, encoding.GetString( bytes, 0, length ) );
+
+			ExecuteCommand( DBCmd.QUERY, bytes, length );
+
+			CommandResult rs = new CommandResult( this, false );
+			return rs;
+		}
+
+		public override void Close() 
+		{
+			if (isOpen)
+			{
+				ExecuteCommand(DBCmd.QUIT, null, 0);
+
+				writer.Stream.Close();
+				reader.Stream.Close();
+			}
+
+			base.Close();
+		}
+
+
+		public override bool Ping() 
+		{
+			try 
+			{
+				// if we are processing a command, we can't send a command since MySQL doesn't 
+				// support interleaved commands
+				//if (processing) return true;
+
+				ExecuteCommand(DBCmd.PING, null, 0); 
+				return reader.ReadOk();
+			}
+			catch (Exception) 
+			{
+				isOpen = false;
+				// exceptions here can be very common so we don't log
+				return false;
+			}
+		}
+
+		public override long ReadResult( ref long affectedRows, ref long lastInsertId )
+		{
+			reader.OpenPacket();
+
+			long cols = reader.GetFieldLength();
 			if (cols > 0) 
-			{
-				affectedRows = -1;
-				return cols;
-			}
-
-			if (-1 == cols)
-			{
-				string filename = reader.ReadString();
-				SendFileToServer( filename );
-				reader.OpenPacket();
-				cols = reader.GetFieldLength();
-			}
-
-			affectedRows = (long)reader.GetFieldLength();
-			lastInsertId = (long)reader.GetFieldLength();
-			if ( version.isAtLeast(4,1,0) ) 
-			{
-				serverStatus = (ServerStatusFlags)reader.ReadInteger(2);
-				hasWarnings = reader.ReadInteger(2) != 0;
-				if (reader.HasMoreData) 
-				{
-					reader.ReadLenString();  //TODO: server message
-				}
-			}
-			return 0;
-		}
-
-		/// <summary>
-		/// Sends the specified file to the server. 
-		/// This supports the LOAD DATA LOCAL INFILE
-		/// </summary>
-		/// <param name="filename"></param>
-		private void SendFileToServer( string filename )
-		{
-			byte[]		buffer = new byte[4092];
-			FileStream	fs = null;
-
-
-			try 
-			{
-				fs = new FileStream( filename, FileMode.Open );
-				writer.StartPacket( fs.Length );
-
-				long len = fs.Length;
-				while (len > 0) 
-				{
-					int count = fs.Read( buffer, 0, 4092 );
-					writer.Write( buffer, 0, count );
-					len -= count;
-				}
-				writer.Flush();
-				writer.Buffering = false;
-
-				// write the terminating packet
-				writer.WriteInteger( 0, 3 );
-				writer.WriteByte( this.SequenceByte ++ );
-				writer.Flush();
-			}
-			catch (Exception ex)
-			{
-				throw new MySqlException("Error during LOAD DATA LOCAL INFILE", ex);
-			}
-			finally 
-			{
-				fs.Close();
-			}
-		}
-
-		public override bool OpenDataRow(int fieldCount, bool isBinary) 
-		{
-			reader.OpenPacket();
-
-			if (reader.IsLastPacket) 
-			{
-				ReadEOF( false );
-				return false;
-			}
-
-			// if we are binary, then we need to load in our null bitmap
-			nullMap = null;
+			{
+				affectedRows = -1;
+				return cols;
+			}
+
+			if (-1 == cols)
+			{
+				string filename = reader.ReadString();
+				SendFileToServer( filename );
+				reader.OpenPacket();
+				cols = reader.GetFieldLength();
+			}
+
+			affectedRows = (long)reader.GetFieldLength();
+			lastInsertId = (long)reader.GetFieldLength();
+			if ( version.isAtLeast(4,1,0) ) 
+			{
+				serverStatus = (ServerStatusFlags)reader.ReadInteger(2);
+				hasWarnings = reader.ReadInteger(2) != 0;
+				if (reader.HasMoreData) 
+				{
+					reader.ReadLenString();  //TODO: server message
+				}
+			}
+			return 0;
+		}
+
+		/// <summary>
+		/// Sends the specified file to the server. 
+		/// This supports the LOAD DATA LOCAL INFILE
+		/// </summary>
+		/// <param name="filename"></param>
+		private void SendFileToServer( string filename )
+		{
+			byte[]		buffer = new byte[4092];
+			FileStream	fs = null;
+
+
+			try 
+			{
+				fs = new FileStream( filename, FileMode.Open );
+				writer.StartPacket( fs.Length );
+
+				long len = fs.Length;
+				while (len > 0) 
+				{
+					int count = fs.Read( buffer, 0, 4092 );
+					writer.Write( buffer, 0, count );
+					len -= count;
+				}
+				writer.Flush();
+				writer.Buffering = false;
+
+				// write the terminating packet
+				writer.WriteInteger( 0, 3 );
+				writer.WriteByte( this.SequenceByte ++ );
+				writer.Flush();
+			}
+			catch (Exception ex)
+			{
+				throw new MySqlException("Error during LOAD DATA LOCAL INFILE", ex);
+			}
+			finally 
+			{
+				fs.Close();
+			}
+		}
+
+		public override bool OpenDataRow(int fieldCount, bool isBinary) 
+		{
+			reader.OpenPacket();
+
+			if (reader.IsLastPacket) 
+			{
+				ReadEOF( false );
+				return false;
+			}
+
+			// if we are binary, then we need to load in our null bitmap
+			nullMap = null;
 			if (isBinary) 
-				ReadNullMap( fieldCount );
-
-			return true;
-		}
-
-		private void ReadNullMap( int fieldCount ) 
-		{
-			// if we are binary, then we need to load in our null bitmap
-			nullMap = null;
-			byte[] nullMapBytes = new byte[ (fieldCount+9)/8 ];
-			reader.ReadByte();
-			reader.Read( ref nullMapBytes, 0, nullMapBytes.Length );
-			nullMap = new BitArray( nullMapBytes );
-		}
-
-		public override MySqlValue ReadFieldValue( int index, MySqlField field, MySqlValue
valObject ) 
-		{
-			long length = -1;
-
+				ReadNullMap( fieldCount );
+
+			return true;
+		}
+
+		private void ReadNullMap( int fieldCount ) 
+		{
+			// if we are binary, then we need to load in our null bitmap
+			nullMap = null;
+			byte[] nullMapBytes = new byte[ (fieldCount+9)/8 ];
+			reader.ReadByte();
+			reader.Read( ref nullMapBytes, 0, nullMapBytes.Length );
+			nullMap = new BitArray( nullMapBytes );
+		}
+
+		public override MySqlValue ReadFieldValue( int index, MySqlField field, MySqlValue
valObject ) 
+		{
+			long length = -1;
+
 			if (nullMap != null) 
-				valObject.IsNull = nullMap [index+2];
-			else
-			{
-				length = reader.GetFieldLength();
-				valObject.IsNull = length == -1;
-			}
-
-			if (valObject.IsNull) return valObject;
-
-			reader.Encoding = field.Encoding;
-			return valObject.ReadValue( reader, length );
-		}
-
+				valObject.IsNull = nullMap [index+2];
+			else
+			{
+				length = reader.GetFieldLength();
+				valObject.IsNull = length == -1;
+			}
+
+			if (valObject.IsNull) return valObject;
+
+			reader.Encoding = field.Encoding;
+			return valObject.ReadValue( reader, length );
+		}
+
 		public override void SkipField(MySqlValue valObject)
 		{
 			long length = -1;
@@ -497,7 +497,7 @@
 			else
 				valObject.Skip( reader );				
 		}
-
+
 		public override void ReadFieldMetadata( int count, ref MySqlField[] fields )
 		{
 			fields = new MySqlField[count];
@@ -508,113 +508,113 @@
 			}
 			ReadEOF(true);
 		}
-
-
-		private MySqlField GetFieldMetaData() 
-		{
-			MySqlField field = null;
-
-			if ( version.isAtLeast(4,1,0) )
-				field = GetFieldMetaData41();
+
+
+		private MySqlField GetFieldMetaData() 
+		{
+			MySqlField field = null;
+
+			if ( version.isAtLeast(4,1,0) )
+				field = GetFieldMetaData41();
 			else 
-			{
-				reader.OpenPacket();
-				field = new MySqlField( this.Version );
-
-				field.Encoding = encoding;
-				field.TableName = field.RealTableName = reader.ReadLenString();
-				field.ColumnName = reader.ReadLenString();
-				field.ColumnLength = reader.ReadNBytes();
-				MySqlDbType type = (MySqlDbType)reader.ReadNBytes();
-				reader.ReadByte();
-				if ((Flags & ClientFlags.LONG_FLAG) != 0)
-					field.Flags = (ColumnFlags)reader.ReadInteger(2);
-				else 
-					field.Flags = (ColumnFlags)reader.ReadByte();
-
-				// we delay this because setting the type causes the internal type object to be
created
-				field.Type = type;
-
-				field.Scale = (byte)reader.ReadByte();
-				if ( !version.isAtLeast(3,23,15) && version.isAtLeast(3,23,0))
-					field.Scale++;
-			}
-
-			return field;
-		}
-
-		private MySqlField GetFieldMetaData41() 
-		{
-			MySqlField field = new MySqlField( this.Version );
-
-			reader.OpenPacket();
-			field.Encoding = encoding;
-			field.CatalogName = reader.ReadLenString();
-			field.DatabaseName = reader.ReadLenString();
-			field.TableName = reader.ReadLenString();
-			field.RealTableName = reader.ReadLenString();
-			field.ColumnName = reader.ReadLenString();
-			field.OriginalColumnName = reader.ReadLenString();
-			reader.ReadByte();
-			field.CharactetSetIndex = reader.ReadInteger(2);
-			field.ColumnLength = reader.ReadInteger(4);
-			field.Type = (MySqlDbType)reader.ReadByte();
-			if ((Flags & ClientFlags.LONG_FLAG) != 0)
-				field.Flags = (ColumnFlags)reader.ReadInteger(2);
-			else 
-				field.Flags = (ColumnFlags)reader.ReadByte();
-
-			field.Scale = (byte)reader.ReadByte();
-
-			if (charSets != null)
-				field.Encoding = CharSetMap.GetEncoding( this.version,
(string)charSets[field.CharactetSetIndex] );
-
-			return field;
-		}
-
-
-		public override CommandResult ExecuteStatement( byte[] bytes )
-		{
-			ExecuteCommand( DBCmd.EXECUTE, bytes, bytes.Length );
-
-			return new CommandResult( this, true );
-		}
-
+			{
+				reader.OpenPacket();
+				field = new MySqlField( this.Version );
+
+				field.Encoding = encoding;
+				field.TableName = field.RealTableName = reader.ReadLenString();
+				field.ColumnName = reader.ReadLenString();
+				field.ColumnLength = reader.ReadNBytes();
+				MySqlDbType type = (MySqlDbType)reader.ReadNBytes();
+				reader.ReadByte();
+				if ((Flags & ClientFlags.LONG_FLAG) != 0)
+					field.Flags = (ColumnFlags)reader.ReadInteger(2);
+				else 
+					field.Flags = (ColumnFlags)reader.ReadByte();
+
+				// we delay this because setting the type causes the internal type object to be
created
+				field.Type = type;
+
+				field.Scale = (byte)reader.ReadByte();
+				if ( !version.isAtLeast(3,23,15) && version.isAtLeast(3,23,0))
+					field.Scale++;
+			}
+
+			return field;
+		}
+
+		private MySqlField GetFieldMetaData41() 
+		{
+			MySqlField field = new MySqlField( this.Version );
+
+			reader.OpenPacket();
+			field.Encoding = encoding;
+			field.CatalogName = reader.ReadLenString();
+			field.DatabaseName = reader.ReadLenString();
+			field.TableName = reader.ReadLenString();
+			field.RealTableName = reader.ReadLenString();
+			field.ColumnName = reader.ReadLenString();
+			field.OriginalColumnName = reader.ReadLenString();
+			reader.ReadByte();
+			field.CharactetSetIndex = reader.ReadInteger(2);
+			field.ColumnLength = reader.ReadInteger(4);
+			field.Type = (MySqlDbType)reader.ReadByte();
+			if ((Flags & ClientFlags.LONG_FLAG) != 0)
+				field.Flags = (ColumnFlags)reader.ReadInteger(2);
+			else 
+				field.Flags = (ColumnFlags)reader.ReadByte();
+
+			field.Scale = (byte)reader.ReadByte();
+
+			if (charSets != null)
+				field.Encoding = CharSetMap.GetEncoding( this.version,
(string)charSets[field.CharactetSetIndex] );
+
+			return field;
+		}
+
+
+		public override CommandResult ExecuteStatement( byte[] bytes )
+		{
+			ExecuteCommand( DBCmd.EXECUTE, bytes, bytes.Length );
+
+			return new CommandResult( this, true );
+		}
+
 		private void ReadEOF( bool readPacket ) 
-		{
-			if (readPacket)
-				reader.OpenPacket();
-
-			if (! reader.IsLastPacket)
-				throw new MySqlException( "Expected end of data packet" );
-
-			reader.ReadByte();  // read off the 254
-
-			if (reader.HasMoreData && version.isAtLeast(4,1,0)) 
-			{
-				int warningCount = reader.ReadInteger(2);
-				hasWarnings = warningCount != 0;
-				serverStatus = (ServerStatusFlags)reader.ReadInteger(2);
-			}
-
-		}
-
-		public override PreparedStatement Prepare( string sql, string[] parmNames ) 
-		{
-			byte[] bytes = encoding.GetBytes( sql );
-
-			ExecuteCommand( DBCmd.PREPARE, bytes, bytes.Length );
-
-			reader.OpenPacket();
-
-			int marker = reader.ReadByte();
-			if (marker != 0)
-				throw new MySqlException("Expected prepared statement marker");
-
-			int statementId = reader.ReadInteger(4);
-			int numCols = reader.ReadInteger(2);
-			int numParams = reader.ReadInteger(2);
-
+		{
+			if (readPacket)
+				reader.OpenPacket();
+
+			if (! reader.IsLastPacket)
+				throw new MySqlException( "Expected end of data packet" );
+
+			reader.ReadByte();  // read off the 254
+
+			if (reader.HasMoreData && version.isAtLeast(4,1,0)) 
+			{
+				int warningCount = reader.ReadInteger(2);
+				hasWarnings = warningCount != 0;
+				serverStatus = (ServerStatusFlags)reader.ReadInteger(2);
+			}
+
+		}
+
+		public override PreparedStatement Prepare( string sql, string[] parmNames ) 
+		{
+			byte[] bytes = encoding.GetBytes( sql );
+
+			ExecuteCommand( DBCmd.PREPARE, bytes, bytes.Length );
+
+			reader.OpenPacket();
+
+			int marker = reader.ReadByte();
+			if (marker != 0)
+				throw new MySqlException("Expected prepared statement marker");
+
+			int statementId = reader.ReadInteger(4);
+			int numCols = reader.ReadInteger(2);
+			int numParams = reader.ReadInteger(2);
+
 			MySqlField[] parameters = new MySqlField[ numParams ];
 
 			if (numParams > 0)
@@ -640,9 +640,9 @@
 
 				ReadEOF( true );
 			}
-
-			return new PreparedStatement( this, statementId, parameters );
-		}
-
-	}
-}
+
+			return new PreparedStatement( this, statementId, parameters );
+		}
+
+	}
+}

Modified: branches/1.0/mysqlclient/parameter.cs
===================================================================
--- branches/1.0/mysqlclient/parameter.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/mysqlclient/parameter.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,373 +1,375 @@
-// Copyright (C) 2004-2005 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.Data;
-using System.Text;
-using System.ComponentModel;
-using System.ComponentModel.Design.Serialization;
-using System.Reflection;
-using MySql.Data.Types;
-
-namespace MySql.Data.MySqlClient
-{
-	/// <summary>
-	/// Represents a parameter to a <see cref="MySqlCommand"/>, and optionally, its
mapping to <see cref="DataSet"/> columns. This class cannot be inherited.
-	/// </summary>
-	[TypeConverter(typeof(MySqlParameter.MySqlParameterConverter))]
-	public sealed class MySqlParameter : MarshalByRefObject, IDataParameter,
IDbDataParameter, ICloneable
-	{
-		private object				paramValue;
-		private MySqlValue			valueObject;
-		private ParameterDirection	direction = ParameterDirection.Input;
-		private bool				isNullable  = false;
-		private string				paramName;
-		private string				sourceColumn;
-		private DataRowVersion		sourceVersion = DataRowVersion.Current;
-		private int					size;
-		private byte				precision;
-		private bool				isUnsigned;
-		private byte				scale;
-		private MySqlDbType			mySqlDbType;
-		private DbType				dbType;
-		private bool				inferType;
-
-		#region Constructors
-
-		/// <summary>
-		/// Initializes a new instance of the MySqlParameter class.
-		/// </summary>
-		public MySqlParameter()
-		{
-			inferType = true;
-		}
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name and a value of the new MySqlParameter.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter to map. </param>
-		/// <param name="value">An <see cref="Object"/> that is the value of the
<see cref="MySqlParameter"/>. </param>
-		public MySqlParameter(string parameterName, object value) : this ()
-		{
-			ParameterName = parameterName;
-			Value = value;
-		}
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name and the data type.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter to map. </param>
-		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
-		public MySqlParameter( string parameterName, MySqlDbType dbType) : this (parameterName,
null)
-		{
-			MySqlDbType = dbType;
-		}
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name, the <see cref="MySqlDbType"/>, and the size.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter to map. </param>
-		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
-		/// <param name="size">The length of the parameter. </param>
-		public MySqlParameter( string parameterName, MySqlDbType dbType, int size ) : this (
parameterName, dbType )
-		{
-			this.size = size;
-		}
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name, the <see cref="MySqlDbType"/>, the size, and the source column name.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter to map. </param>
-		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
-		/// <param name="size">The length of the parameter. </param>
-		/// <param name="sourceColumn">The name of the source column. </param>
-		public MySqlParameter( string parameterName, MySqlDbType dbType, int size, string
sourceColumn ) : 
-			this ( parameterName, dbType )
-		{
-			this.size = size;
-			this.direction = ParameterDirection.Input;
-			this.sourceColumn = sourceColumn;
-			this.sourceVersion = DataRowVersion.Current;
-		}
-
-		internal MySqlParameter(string name, MySqlDbType type, ParameterDirection dir, string
col, 
-			DataRowVersion ver, object val) : this (name, type)
-		{
-			if (direction != ParameterDirection.Input)
-				throw new ArgumentException("Only input parameters are supported by MySql");
-			direction = dir;
-			sourceColumn = col;
-			sourceVersion = ver;
-			Value = val;
-		}
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name, the type of the parameter, the size of the parameter, a <see
cref="ParameterDirection"/>, the precision of the parameter, the scale of the
parameter, the source column, a <see cref="DataRowVersion"/> to use, and the value
of the parameter.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter to map. </param>
-		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
-		/// <param name="size">The length of the parameter. </param>
-		/// <param name="direction">One of the <see cref="ParameterDirection"/>
values. </param>
-		/// <param name="isNullable">true if the value of the field can be null,
otherwise false. </param>
-		/// <param name="precision">The total number of digits to the left and right of
the decimal point to which <see cref="MySqlParameter.Value"/> is
resolved.</param>
-		/// <param name="scale">The total number of decimal places to which <see
cref="MySqlParameter.Value"/> is resolved. </param>
-		/// <param name="sourceColumn">The name of the source column. </param>
-		/// <param name="sourceVersion">One of the <see cref="DataRowVersion"/>
values. </param>
-		/// <param name="value">An <see cref="Object"/> that is the value of the
<see cref="MySqlParameter"/>. </param>
-		/// <exception cref="ArgumentException"/>
-		public MySqlParameter( string parameterName, MySqlDbType dbType, int size,
ParameterDirection direction,
-			bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion
sourceVersion,
-			object value) : this (parameterName, dbType, size, sourceColumn)
-		{
-			if (direction != ParameterDirection.Input)
-				throw new ArgumentException("Only input parameters are supported by MySql");
-
-			this.direction = direction;
-			this.sourceVersion = sourceVersion;
-			Value = value;
-		}
-		#endregion
-
-		#region Properties
-
-		/// <summary>
-		/// Gets or sets the <see cref="DbType"/> of the parameter.
-		/// </summary>
-		public DbType DbType 
-		{
-			get { return dbType; }
-			set 
-			{ 
-				SetDbType( value ); 
-				inferType = false;
-			}
-		}
-
-		/// <summary>
-		/// Gets or sets a value indicating whether the parameter is input-only, output-only,
bidirectional, or a stored procedure return value parameter.
-		/// As of MySql version 4.1 and earlier, input-only is the only valid choice.
-		/// </summary>
-		[Category("Data")]
-		public ParameterDirection Direction 
-		{
-			get { return direction; }
-			set { direction = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets a value indicating whether the parameter accepts null values.
-		/// </summary>
-		[Browsable(false)]
-		public Boolean IsNullable 
-		{
-			get { return isNullable; }
-			set { isNullable = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets the MySqlDbType of the parameter.
-		/// </summary>
-		[Category("Data")]
-		public MySqlDbType MySqlDbType 
-		{
-			get { return mySqlDbType; }
-			set 
-			{ 
-				SetMySqlDbType( value ); 
-				inferType = false;
-			}
-		}
-
-		/// <summary>
-		/// Gets or sets the name of the MySqlParameter.
-		/// </summary>
-		[Category("Misc")]
-		public String ParameterName 
-		{
-			get { return paramName; }
-			set { paramName = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets the maximum number of digits used to represent the <see
cref="Value"/> property.
-		/// </summary>
-		[Category("Data")]
-		public byte Precision 
-		{
-			get { return precision; }
-			set { precision = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets the number of decimal places to which <see cref="Value"/> is
resolved.
-		/// </summary>
-		[Category("Data")]
-		public byte Scale 
-		{
-			get { return scale; }
-			set { scale = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets the maximum size, in bytes, of the data within the column.
-		/// </summary>
-		[Category("Data")]
-		public int Size 
-		{
-			get { return size; }
-			set { size = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets the name of the source column that is mapped to the <see
cref="DataSet"/> and used for loading or returning the <see cref="Value"/>.
-		/// </summary>
-		[Category("Data")]
-		public String SourceColumn 
-		{
-			get { return sourceColumn; }
-			set { sourceColumn = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets the <see cref="DataRowVersion"/> to use when loading <see
cref="Value"/>.
-		/// </summary>
-		[Category("Data")]
-		public DataRowVersion SourceVersion 
-		{
-			get { return sourceVersion; }
-			set { sourceVersion = value; }
-		}
-
-		/// <summary>
-		/// Gets or sets the value of the parameter.
-		/// </summary>
-		[TypeConverter(typeof(StringConverter))]
-		[Category("Data")]
-		public object Value 
-		{
-			get	{ return paramValue; }
-			set	
-			{ 
-				paramValue = value; 
-				if (value is Byte[])
-					size = (value as Byte[]).Length;
-				else if (value is String)
-					size = (value as string).Length;
-				if (inferType)
-					SetTypeFromValue();
-			}
-		}
-
-		#endregion
-
-		/// <summary>
-		/// Overridden. Gets a string containing the <see cref="ParameterName"/>.
-		/// </summary>
-		/// <returns></returns>
-		public override string ToString() 
-		{
-			return paramName;
-		}
-
+// Copyright (C) 2004-2005 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.Data;
+using System.Text;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Reflection;
+using MySql.Data.Types;
+
+namespace MySql.Data.MySqlClient
+{
+	/// <summary>
+	/// Represents a parameter to a <see cref="MySqlCommand"/>, and optionally, its
mapping to <see cref="DataSet"/> columns. This class cannot be inherited.
+	/// </summary>
+	[TypeConverter(typeof(MySqlParameter.MySqlParameterConverter))]
+	public sealed class MySqlParameter : MarshalByRefObject, IDataParameter,
IDbDataParameter, ICloneable
+	{
+		private object				paramValue;
+		private MySqlValue			valueObject;
+		private ParameterDirection	direction = ParameterDirection.Input;
+		private bool				isNullable  = false;
+		private string				paramName;
+		private string				sourceColumn;
+		private DataRowVersion		sourceVersion = DataRowVersion.Current;
+		private int					size;
+		private byte				precision;
+		private bool				isUnsigned;
+		private byte				scale;
+		private MySqlDbType			mySqlDbType;
+		private DbType				dbType;
+		private bool				inferType;
+
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the MySqlParameter class.
+		/// </summary>
+		public MySqlParameter()
+		{
+			inferType = true;
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name and a value of the new MySqlParameter.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter to map. </param>
+		/// <param name="value">An <see cref="Object"/> that is the value of the
<see cref="MySqlParameter"/>. </param>
+		public MySqlParameter(string parameterName, object value) : this ()
+		{
+			ParameterName = parameterName;
+			Value = value;
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name and the data type.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter to map. </param>
+		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
+		public MySqlParameter( string parameterName, MySqlDbType dbType) : this (parameterName,
null)
+		{
+			MySqlDbType = dbType;
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name, the <see cref="MySqlDbType"/>, and the size.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter to map. </param>
+		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
+		/// <param name="size">The length of the parameter. </param>
+		public MySqlParameter( string parameterName, MySqlDbType dbType, int size ) : this (
parameterName, dbType )
+		{
+			this.size = size;
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name, the <see cref="MySqlDbType"/>, the size, and the source column name.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter to map. </param>
+		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
+		/// <param name="size">The length of the parameter. </param>
+		/// <param name="sourceColumn">The name of the source column. </param>
+		public MySqlParameter( string parameterName, MySqlDbType dbType, int size, string
sourceColumn ) : 
+			this ( parameterName, dbType )
+		{
+			this.size = size;
+			this.direction = ParameterDirection.Input;
+			this.sourceColumn = sourceColumn;
+			this.sourceVersion = DataRowVersion.Current;
+		}
+
+		internal MySqlParameter(string name, MySqlDbType type, ParameterDirection dir, string
col, 
+			DataRowVersion ver, object val) : this (name, type)
+		{
+			if (direction != ParameterDirection.Input)
+				throw new ArgumentException("Only input parameters are supported by MySql");
+			direction = dir;
+			sourceColumn = col;
+			sourceVersion = ver;
+			Value = val;
+		}
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="MySqlParameter"/> class with the
parameter name, the type of the parameter, the size of the parameter, a <see
cref="ParameterDirection"/>, the precision of the parameter, the scale of the
parameter, the source column, a <see cref="DataRowVersion"/> to use, and the value
of the parameter.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter to map. </param>
+		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
+		/// <param name="size">The length of the parameter. </param>
+		/// <param name="direction">One of the <see cref="ParameterDirection"/>
values. </param>
+		/// <param name="isNullable">true if the value of the field can be null,
otherwise false. </param>
+		/// <param name="precision">The total number of digits to the left and right of
the decimal point to which <see cref="MySqlParameter.Value"/> is
resolved.</param>
+		/// <param name="scale">The total number of decimal places to which <see
cref="MySqlParameter.Value"/> is resolved. </param>
+		/// <param name="sourceColumn">The name of the source column. </param>
+		/// <param name="sourceVersion">One of the <see cref="DataRowVersion"/>
values. </param>
+		/// <param name="value">An <see cref="Object"/> that is the value of the
<see cref="MySqlParameter"/>. </param>
+		/// <exception cref="ArgumentException"/>
+		public MySqlParameter( string parameterName, MySqlDbType dbType, int size,
ParameterDirection direction,
+			bool isNullable, byte precision, byte scale, string sourceColumn, DataRowVersion
sourceVersion,
+			object value) : this (parameterName, dbType, size, sourceColumn)
+		{
+			if (direction != ParameterDirection.Input)
+				throw new ArgumentException("Only input parameters are supported by MySql");
+
+			this.direction = direction;
+			this.sourceVersion = sourceVersion;
+			Value = value;
+		}
+		#endregion
+
+		#region Properties
+
+		/// <summary>
+		/// Gets or sets the <see cref="DbType"/> of the parameter.
+		/// </summary>
+		public DbType DbType 
+		{
+			get { return dbType; }
+			set 
+			{ 
+				SetDbType( value ); 
+				inferType = false;
+			}
+		}
+
+		/// <summary>
+		/// Gets or sets a value indicating whether the parameter is input-only, output-only,
bidirectional, or a stored procedure return value parameter.
+		/// As of MySql version 4.1 and earlier, input-only is the only valid choice.
+		/// </summary>
+		[Category("Data")]
+		public ParameterDirection Direction 
+		{
+			get { return direction; }
+			set { direction = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets a value indicating whether the parameter accepts null values.
+		/// </summary>
+		[Browsable(false)]
+		public Boolean IsNullable 
+		{
+			get { return isNullable; }
+			set { isNullable = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the MySqlDbType of the parameter.
+		/// </summary>
+		[Category("Data")]
+		public MySqlDbType MySqlDbType 
+		{
+			get { return mySqlDbType; }
+			set 
+			{ 
+				SetMySqlDbType( value ); 
+				inferType = false;
+			}
+		}
+
+		/// <summary>
+		/// Gets or sets the name of the MySqlParameter.
+		/// </summary>
+		[Category("Misc")]
+		public String ParameterName 
+		{
+			get { return paramName; }
+			set { paramName = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the maximum number of digits used to represent the <see
cref="Value"/> property.
+		/// </summary>
+		[Category("Data")]
+		public byte Precision 
+		{
+			get { return precision; }
+			set { precision = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the number of decimal places to which <see cref="Value"/> is
resolved.
+		/// </summary>
+		[Category("Data")]
+		public byte Scale 
+		{
+			get { return scale; }
+			set { scale = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the maximum size, in bytes, of the data within the column.
+		/// </summary>
+		[Category("Data")]
+		public int Size 
+		{
+			get { return size; }
+			set { size = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the name of the source column that is mapped to the <see
cref="DataSet"/> and used for loading or returning the <see cref="Value"/>.
+		/// </summary>
+		[Category("Data")]
+		public String SourceColumn 
+		{
+			get { return sourceColumn; }
+			set { sourceColumn = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the <see cref="DataRowVersion"/> to use when loading <see
cref="Value"/>.
+		/// </summary>
+		[Category("Data")]
+		public DataRowVersion SourceVersion 
+		{
+			get { return sourceVersion; }
+			set { sourceVersion = value; }
+		}
+
+		/// <summary>
+		/// Gets or sets the value of the parameter.
+		/// </summary>
+		[TypeConverter(typeof(StringConverter))]
+		[Category("Data")]
+		public object Value 
+		{
+			get	{ return paramValue; }
+			set	
+			{ 
+				paramValue = value; 
+				if (value is Byte[])
+					size = (value as Byte[]).Length;
+				else if (value is String)
+					size = (value as string).Length;
+				if (inferType)
+					SetTypeFromValue();
+			}
+		}
+
+		#endregion
+
+		/// <summary>
+		/// Overridden. Gets a string containing the <see cref="ParameterName"/>.
+		/// </summary>
+		/// <returns></returns>
+		public override string ToString() 
+		{
+			return paramName;
+		}
+
 		internal MySqlValue GetValueObject() 
-		{
+		{
 			if (valueObject == null)
 			{
-				valueObject = MySqlValue.GetMySqlValue( mySqlDbType, true );
-
-				MySqlDecimal dec = (valueObject as MySqlDecimal);
+				valueObject = MySqlValue.GetMySqlValue( mySqlDbType, true );
+
+				MySqlDecimal dec = (valueObject as MySqlDecimal);
 				if (dec != null) 
-				{
-					dec.Precision = precision;
-					dec.Scale = scale;
-				}
-			}
-			return valueObject;
-		}
-
-		internal int GetPSType()
-		{
-			if (this.mySqlDbType == MySqlDbType.Bit)
-				return (int)MySqlDbType.Int64 | 0x8000;
-			else
-				return (int)this.mySqlDbType;
-		}
-
-		internal void Serialize( PacketWriter writer, bool binary ) 
-		{
-			GetValueObject();
-
-			if (!binary && (paramValue == null || paramValue == DBNull.Value))
-				writer.WriteStringNoNull("NULL");
-			else
-				valueObject.Serialize( writer, binary, paramValue, size );
-		}
-
+				{
+					dec.Precision = precision;
+					dec.Scale = scale;
+				}
+			}
+			return valueObject;
+		}
+
+		internal int GetPSType()
+		{
+            if (this.mySqlDbType == MySqlDbType.Bit)
+                return (int)MySqlDbType.Int64 | 0x8000;
+            else if (this.mySqlDbType == MySqlDbType.UByte)
+                return (int)MySqlDbType.Byte | 0x8000;
+            else
+				return (int)this.mySqlDbType;
+		}
+
+		internal void Serialize( PacketWriter writer, bool binary ) 
+		{
+			GetValueObject();
+
+			if (!binary && (paramValue == null || paramValue == DBNull.Value))
+				writer.WriteStringNoNull("NULL");
+			else
+				valueObject.Serialize( writer, binary, paramValue, size );
+		}
+
 		private void SetMySqlDbType( MySqlDbType mySqlDbType ) 
-		{
-			if (this.mySqlDbType != mySqlDbType)
-				valueObject = null;
-			this.mySqlDbType = mySqlDbType;
+		{
+			if (this.mySqlDbType != mySqlDbType)
+				valueObject = null;
+			this.mySqlDbType = mySqlDbType;
 			switch (mySqlDbType) 
 			{
-				case MySqlDbType.Decimal: dbType = DbType.Decimal; break;
-				case MySqlDbType.UByte: dbType = DbType.Byte; break;
-				case MySqlDbType.Byte: dbType = DbType.SByte; break;
-				case MySqlDbType.UInt16: dbType = DbType.UInt16; break;
-				case MySqlDbType.Int16: dbType = DbType.Int16; break;
-				case MySqlDbType.UInt24:
-				case MySqlDbType.UInt32: dbType = DbType.UInt32; break;
-				case MySqlDbType.Int24: 
-				case MySqlDbType.Int32: dbType = DbType.Int32; break;
-				case MySqlDbType.UInt64: dbType = DbType.UInt64; break;
-				case MySqlDbType.Int64: dbType = DbType.Int64; break;
-				case MySqlDbType.Bit : dbType = DbType.UInt64; break;
-				case MySqlDbType.Float: dbType = DbType.Single; break;
-				case MySqlDbType.Double: dbType = DbType.Double; break;
-
-				case MySqlDbType.Timestamp:
-				case MySqlDbType.Datetime: dbType = DbType.DateTime; break;
-
-				case MySqlDbType.Date:
-				case MySqlDbType.Newdate:
-				case MySqlDbType.Year: dbType = DbType.Date; break;
-				
-				case MySqlDbType.Time: dbType = DbType.Time; break;
-				
-				case MySqlDbType.Enum:
-				case MySqlDbType.Set:
-				case MySqlDbType.VarChar: dbType = DbType.String;  break;
-
-				case MySqlDbType.TinyBlob:
-				case MySqlDbType.MediumBlob:
-				case MySqlDbType.LongBlob:
-				case MySqlDbType.Blob: dbType = DbType.Object; break;
-
-				case MySqlDbType.Char: dbType = DbType.StringFixedLength; break;
+				case MySqlDbType.Decimal: dbType = DbType.Decimal; break;
+				case MySqlDbType.UByte: dbType = DbType.Byte; break;
+				case MySqlDbType.Byte: dbType = DbType.SByte; break;
+				case MySqlDbType.UInt16: dbType = DbType.UInt16; break;
+				case MySqlDbType.Int16: dbType = DbType.Int16; break;
+				case MySqlDbType.UInt24:
+				case MySqlDbType.UInt32: dbType = DbType.UInt32; break;
+				case MySqlDbType.Int24: 
+				case MySqlDbType.Int32: dbType = DbType.Int32; break;
+				case MySqlDbType.UInt64: dbType = DbType.UInt64; break;
+				case MySqlDbType.Int64: dbType = DbType.Int64; break;
+				case MySqlDbType.Bit : dbType = DbType.UInt64; break;
+				case MySqlDbType.Float: dbType = DbType.Single; break;
+				case MySqlDbType.Double: dbType = DbType.Double; break;
+
+				case MySqlDbType.Timestamp:
+				case MySqlDbType.Datetime: dbType = DbType.DateTime; break;
+
+				case MySqlDbType.Date:
+				case MySqlDbType.Newdate:
+				case MySqlDbType.Year: dbType = DbType.Date; break;
+				
+				case MySqlDbType.Time: dbType = DbType.Time; break;
+				
+				case MySqlDbType.Enum:
+				case MySqlDbType.Set:
+				case MySqlDbType.VarChar: dbType = DbType.String;  break;
+
+				case MySqlDbType.TinyBlob:
+				case MySqlDbType.MediumBlob:
+				case MySqlDbType.LongBlob:
+				case MySqlDbType.Blob: dbType = DbType.Object; break;
+
+				case MySqlDbType.Char: dbType = DbType.StringFixedLength; break;
 			}
-		}
-
-
+		}
+
+
 		private void SetDbType( DbType dbType ) 
-		{
-			this.dbType = dbType;
+		{
+			this.dbType = dbType;
 			switch (dbType) 
 			{
 				case DbType.Guid:
@@ -378,9 +380,9 @@
 				case DbType.StringFixedLength: mySqlDbType = MySqlDbType.Char; break;
 
 				case DbType.Boolean:
-				case DbType.Byte: 
+				case DbType.Byte:
 				case DbType.SByte:
-					mySqlDbType = MySqlDbType.Byte; 
+					mySqlDbType = dbType == DbType.Byte ? MySqlDbType.UByte : MySqlDbType.Byte; 
 					isUnsigned = dbType == DbType.Byte;
 					break;
 
@@ -406,22 +408,22 @@
 				default: 
 					mySqlDbType = MySqlDbType.Blob; break;
 			}
-		}
-
-
+		}
+
+
 		private void SetTypeFromValue() 
-		{
-			if (paramValue == null) return;
-
-			if (paramValue is Guid) SetDbType( DbType.String );
-			else if (paramValue is TimeSpan) SetDbType( DbType.Time );
-			else if (paramValue is bool) SetDbType( DbType.Byte );
+		{
+			if (paramValue == null) return;
+
+			if (paramValue is Guid) SetDbType( DbType.String );
+			else if (paramValue is TimeSpan) SetDbType( DbType.Time );
+			else if (paramValue is bool) SetDbType( DbType.Byte );
 			else 
-			{
-
-				TypeCode tc = Type.GetTypeCode( paramValue.GetType() );
+			{
+
+				TypeCode tc = Type.GetTypeCode( paramValue.GetType() );
 				switch (tc) 
-				{
+				{
 					case TypeCode.SByte: SetDbType( DbType.SByte ); break;
 					case TypeCode.Byte: SetDbType( DbType.Byte ); break;
 					case TypeCode.Int16: SetDbType( DbType.Int16 ); break;
@@ -437,51 +439,51 @@
 					case TypeCode.Decimal: SetDbType( DbType.Decimal); break;
 					case TypeCode.Object: 
 					default: SetDbType( DbType.Object ); break;
-				}
-			}
-		}
-
-
-		#region ICloneable
-		object System.ICloneable.Clone() 
-		{
-			MySqlParameter clone = new MySqlParameter( paramName, mySqlDbType, direction,
-				sourceColumn, sourceVersion, paramValue );
-			return clone;
-		}
-		#endregion
-
-		internal class MySqlParameterConverter : TypeConverter
-		{
-			public override bool CanConvertTo(ITypeDescriptorContext context, Type
destinationType)
-			{
-				if (destinationType == typeof(InstanceDescriptor))
-				{
-					return true;
-				}
-
-				// Always call the base to see if it can perform the conversion.
-				return base.CanConvertTo(context, destinationType);
-			}
-
-			public override object ConvertTo(ITypeDescriptorContext context, 
-				System.Globalization.CultureInfo culture, object value, Type destinationType)
-			{
-				if (destinationType == typeof(InstanceDescriptor))
-				{
-					ConstructorInfo ci = typeof(MySqlParameter).GetConstructor(
-						new Type[]{typeof(string), typeof(MySqlDbType), typeof(int),
typeof(ParameterDirection),
-									  typeof(bool), typeof(byte), typeof(byte), typeof(string),
typeof(DataRowVersion),
-									  typeof(object)});
-					MySqlParameter p = (MySqlParameter) value;
-					return new InstanceDescriptor(ci,new object[]{ 
-																	 p.ParameterName, p.DbType, p.Size, p.Direction, p.IsNullable,
p.Precision,
-																	 p.Scale, p.SourceColumn, p.SourceVersion, p.Value});
-				}
-
-				// Always call base, even if you can't convert.
-				return base.ConvertTo(context, culture, value, destinationType);
-			}
-		}
-	}
-}
+				}
+			}
+		}
+
+
+		#region ICloneable
+		object System.ICloneable.Clone() 
+		{
+			MySqlParameter clone = new MySqlParameter( paramName, mySqlDbType, direction,
+				sourceColumn, sourceVersion, paramValue );
+			return clone;
+		}
+		#endregion
+
+		internal class MySqlParameterConverter : TypeConverter
+		{
+			public override bool CanConvertTo(ITypeDescriptorContext context, Type
destinationType)
+			{
+				if (destinationType == typeof(InstanceDescriptor))
+				{
+					return true;
+				}
+
+				// Always call the base to see if it can perform the conversion.
+				return base.CanConvertTo(context, destinationType);
+			}
+
+			public override object ConvertTo(ITypeDescriptorContext context, 
+				System.Globalization.CultureInfo culture, object value, Type destinationType)
+			{
+				if (destinationType == typeof(InstanceDescriptor))
+				{
+					ConstructorInfo ci = typeof(MySqlParameter).GetConstructor(
+						new Type[]{typeof(string), typeof(MySqlDbType), typeof(int),
typeof(ParameterDirection),
+									  typeof(bool), typeof(byte), typeof(byte), typeof(string),
typeof(DataRowVersion),
+									  typeof(object)});
+					MySqlParameter p = (MySqlParameter) value;
+					return new InstanceDescriptor(ci,new object[]{ 
+																	 p.ParameterName, p.DbType, p.Size, p.Direction, p.IsNullable,
p.Precision,
+																	 p.Scale, p.SourceColumn, p.SourceVersion, p.Value});
+				}
+
+				// Always call base, even if you can't convert.
+				return base.ConvertTo(context, culture, value, destinationType);
+			}
+		}
+	}
+}

Modified: branches/1.0/mysqlclient/parameter_collection.cs
===================================================================
--- branches/1.0/mysqlclient/parameter_collection.cs	2006-05-18 17:41:34 UTC (rev 234)
+++ branches/1.0/mysqlclient/parameter_collection.cs	2006-05-18 19:08:04 UTC (rev 235)
@@ -1,350 +1,350 @@
-// Copyright (C) 2004-2005 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.Data;
-using System.Collections;
-using System.ComponentModel;
-
-namespace MySql.Data.MySqlClient
-{
-	/// <summary>
-	/// Represents a collection of parameters relevant to a <see cref="MySqlCommand"/>
as well as their respective mappings to columns in a <see cref="DataSet"/>. This
class cannot be inherited.
-	/// </summary>
-	/// <include file='docs/MySqlParameterCollection.xml'
path='MyDocs/MyMembers[@name="Class"]/*'/>
-	[Editor("MySql.Data.MySqlClient.Design.DBParametersEditor,MySql.Design",
typeof(System.Drawing.Design.UITypeEditor))]
-	[ListBindable(true)]
-	public sealed class MySqlParameterCollection : MarshalByRefObject,
IDataParameterCollection, 
-		IList, ICollection, IEnumerable
-	{
-		private ArrayList	_parms = new ArrayList();
-		private char		paramMarker = '?';
-
-		internal char ParameterMarker 
-		{
-			get { return paramMarker; }
-			set { paramMarker = value; }
-		}
-
-		private int InternalIndexOf(string name)
-		{
-			int index = IndexOf(name);
-			if (index != -1) return index;
-			throw new MySqlException("A MySqlParameter with ParameterName '" + name + 
-				"' is not contained by this MySqlParameterCollection.");
-		}
-
-		#region ICollection support
-
-		/// <summary>
-		/// Gets the number of MySqlParameter objects in the collection.
-		/// </summary>
-		public int Count 
-		{
-			get { return _parms.Count; }
-		}
-
-		/// <summary>
-		/// Copies MySqlParameter objects from the MySqlParameterCollection to the specified
array.
-		/// </summary>
-		/// <param name="array"></param>
-		/// <param name="index"></param>
-		public void CopyTo( Array array, int index ) 
-		{
-			_parms.CopyTo(array, index);
-		}
-
-		bool ICollection.IsSynchronized
-		{
-			get { return _parms.IsSynchronized; }
-		}
-
-		object ICollection.SyncRoot
-		{
-			get { return _parms.SyncRoot; }
-		}
-		#endregion
-
-		#region IList
-
-		/// <summary>
-		/// Removes all items from the collection.
-		/// </summary>
-		public void Clear()
-		{
-			_parms.Clear();
-		}
-
-		/// <summary>
-		/// Gets a value indicating whether a MySqlParameter exists in the collection.
-		/// </summary>
-		/// <param name="value">The value of the <see cref="MySqlParameter"/>
object to find. </param>
-		/// <returns>true if the collection contains the <see
cref="MySqlParameter"/> object; otherwise, false.</returns>
-		/// <overloads>Gets a value indicating whether a <see
cref="MySqlParameter"/> exists in the collection.</overloads>
-		public bool Contains(object value)
-		{
-			return _parms.Contains(value);
-		}
-
-		/// <summary>
-		/// Gets the location of a <see cref="MySqlParameter"/> in the collection.
-		/// </summary>
-		/// <param name="value">The <see cref="MySqlParameter"/> object to locate.
</param>
-		/// <returns>The zero-based location of the <see cref="MySqlParameter"/> in
the collection.</returns>
-		/// <overloads>Gets the location of a <see cref="MySqlParameter"/> in the
collection.</overloads>
-		public int IndexOf(object value)
-		{
-			return _parms.IndexOf(value);
-		}
-
-		/// <summary>
-		/// Inserts a MySqlParameter into the collection at the specified index.
-		/// </summary>
-		/// <param name="index"></param>
-		/// <param name="value"></param>
-		public void Insert(int index, object value)
-		{
-			_parms.Insert( index, value );
-		}
-
-		bool IList.IsFixedSize
-		{
-			get { return _parms.IsFixedSize; }
-		}
-
-		bool IList.IsReadOnly
-		{
-			get { return _parms.IsReadOnly; }
-		}
-
-		/// <summary>
-		/// Removes the specified MySqlParameter from the collection.
-		/// </summary>
-		/// <param name="value"></param>
-		public void Remove( object value )
-		{
-			_parms.Remove( value );
-		}
-
-		/// <summary>
-		/// Removes the specified <see cref="MySqlParameter"/> from the collection using
a specific index.
-		/// </summary>
-		/// <param name="index">The zero-based index of the parameter. </param>
-		/// <overloads>Removes the specified <see cref="MySqlParameter"/> from the
collection.</overloads>
-		public void RemoveAt( int index )
-		{
-			_parms.RemoveAt( index );
-		}
-
-		object IList.this[int index] 
-		{
-			get { return this[index]; }
-			set 
-			{ 
-				if (! (value is MySqlParameter)) throw new MySqlException("Only MySqlParameter
objects may be stored");
-				this[index] = (MySqlParameter)value; 
-			}
-		}
-
-		/// <summary>
-		/// Adds the specified <see cref="MySqlParameter"/> object to the <see
cref="MySqlParameterCollection"/>.
-		/// </summary>
-		/// <param name="value">The <see cref="MySqlParameter"/> to add to the
collection.</param>
-		/// <returns>The index of the new <see cref="MySqlParameter"/>
object.</returns>
-		public int Add( object value )
-		{
-			if (! (value is MySqlParameter)) 
-				throw new MySqlException("Only MySqlParameter objects may be stored");
-
-			MySqlParameter p = (MySqlParameter)value;
-
-			if (p.ParameterName == null || p.ParameterName == String.Empty)
-				throw new MySqlException("Parameters must be named");
-
-			return _parms.Add(value);
-		}
-
-		#endregion
-
-		#region IDataParameterCollection
-
-		/// <summary>
-		/// Gets a value indicating whether a <see cref="MySqlParameter"/> with the
specified parameter name exists in the collection.
-		/// </summary>
-		/// <param name="name">The name of the <see cref="MySqlParameter"/> object
to find.</param>
-		/// <returns>true if the collection contains the parameter; otherwise,
false.</returns>
-		public bool Contains(string name)
-		{
-			return IndexOf(name) != -1;
-		}
-
-		/// <summary>
-		/// Gets the location of the <see cref="MySqlParameter"/> in the collection with
a specific parameter name.
-		/// </summary>
-		/// <param name="parameterName">The name of the <see
cref="MySqlParameter"/> object to retrieve. </param>
-		/// <returns>The zero-based location of the <see cref="MySqlParameter"/> in
the collection.</returns>
-		public int IndexOf(string parameterName)
-		{
-			if (parameterName[0] == paramMarker)
-				parameterName = parameterName.Substring(1, parameterName.Length-1);
-			parameterName = parameterName.ToLower();
-			for (int x=0; x < _parms.Count; x++) 
-			{
-				MySqlParameter p = (MySqlParameter)_parms[x];
-				string listName = p.ParameterName;
-				if (listName[0] == paramMarker)
-					listName = listName.Substring(1, listName.Length-1);
-				if (listName.ToLower() == parameterName) return x;
-			}
-			return -1;
-		}
-
-		/// <summary>
-		/// Removes the specified <see cref="MySqlParameter"/> from the collection using
the parameter name.
-		/// </summary>
-		/// <param name="name">The name of the <see cref="MySqlParameter"/> object
to retrieve. </param>
-		public void RemoveAt(string name)
-		{
-			_parms.RemoveAt(InternalIndexOf(name));
-		}
-
-		object IDataParameterCollection.this[string name]
-		{
-			get { return this[name]; }
-			set 
-			{ 
-				if (! (value is MySqlParameter)) throw new MySqlException("Only MySqlParameter
objects may be stored");
-				this[name] = (MySqlParameter)value;
-			}
-		}
-		#endregion
-
-		#region IEnumerable
-		IEnumerator IEnumerable.GetEnumerator()
-		{
-			return ((IEnumerable)_parms).GetEnumerator();
-		}
-		#endregion
-
-		#region Public Methods
-
-		/// <summary>
-		/// Gets the <see cref="MySqlParameter"/> at the specified index.
-		/// </summary>
-		/// <overloads>Gets the <see cref="MySqlParameter"/> with a specified
attribute.
-		/// [C#] In C#, this property is the indexer for the <see
cref="MySqlParameterCollection"/> class.
-		/// </overloads>
-		public MySqlParameter this[int index]
-		{
-			get { return (MySqlParameter)_parms[index]; }
-			set { _parms[index] = value; }
-		}
-
-		/// <summary>
-		/// Gets the <see cref="MySqlParameter"/> with the specified name.
-		/// </summary>
-		public MySqlParameter this[string name]
-		{
-			get { return (MySqlParameter)_parms[ InternalIndexOf( name ) ]; }
-			set { _parms[ InternalIndexOf( name ) ] = value; }
-		}
-
-		/// <summary>
-		/// Adds the specified <see cref="MySqlParameter"/> object to the <see
cref="MySqlParameterCollection"/>.
-		/// </summary>
-		/// <param name="value">The <see cref="MySqlParameter"/> to add to the
collection.</param>
-		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
-		public MySqlParameter Add(MySqlParameter value)
-		{
+// Copyright (C) 2004-2005 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.Data;
+using System.Collections;
+using System.ComponentModel;
+
+namespace MySql.Data.MySqlClient
+{
+	/// <summary>
+	/// Represents a collection of parameters relevant to a <see cref="MySqlCommand"/>
as well as their respective mappings to columns in a <see cref="DataSet"/>. This
class cannot be inherited.
+	/// </summary>
+	/// <include file='docs/MySqlParameterCollection.xml'
path='MyDocs/MyMembers[@name="Class"]/*'/>
+	[Editor("MySql.Data.MySqlClient.Design.DBParametersEditor,MySql.Design",
typeof(System.Drawing.Design.UITypeEditor))]
+	[ListBindable(true)]
+	public sealed class MySqlParameterCollection : MarshalByRefObject,
IDataParameterCollection, 
+		IList, ICollection, IEnumerable
+	{
+		private ArrayList	_parms = new ArrayList();
+		private char		paramMarker = '?';
+
+		internal char ParameterMarker 
+		{
+			get { return paramMarker; }
+			set { paramMarker = value; }
+		}
+
+		private int InternalIndexOf(string name)
+		{
+			int index = IndexOf(name);
+			if (index != -1) return index;
+			throw new MySqlException("A MySqlParameter with ParameterName '" + name + 
+				"' is not contained by this MySqlParameterCollection.");
+		}
+
+		#region ICollection support
+
+		/// <summary>
+		/// Gets the number of MySqlParameter objects in the collection.
+		/// </summary>
+		public int Count 
+		{
+			get { return _parms.Count; }
+		}
+
+		/// <summary>
+		/// Copies MySqlParameter objects from the MySqlParameterCollection to the specified
array.
+		/// </summary>
+		/// <param name="array"></param>
+		/// <param name="index"></param>
+		public void CopyTo( Array array, int index ) 
+		{
+			_parms.CopyTo(array, index);
+		}
+
+		bool ICollection.IsSynchronized
+		{
+			get { return _parms.IsSynchronized; }
+		}
+
+		object ICollection.SyncRoot
+		{
+			get { return _parms.SyncRoot; }
+		}
+		#endregion
+
+		#region IList
+
+		/// <summary>
+		/// Removes all items from the collection.
+		/// </summary>
+		public void Clear()
+		{
+			_parms.Clear();
+		}
+
+		/// <summary>
+		/// Gets a value indicating whether a MySqlParameter exists in the collection.
+		/// </summary>
+		/// <param name="value">The value of the <see cref="MySqlParameter"/>
object to find. </param>
+		/// <returns>true if the collection contains the <see
cref="MySqlParameter"/> object; otherwise, false.</returns>
+		/// <overloads>Gets a value indicating whether a <see
cref="MySqlParameter"/> exists in the collection.</overloads>
+		public bool Contains(object value)
+		{
+			return _parms.Contains(value);
+		}
+
+		/// <summary>
+		/// Gets the location of a <see cref="MySqlParameter"/> in the collection.
+		/// </summary>
+		/// <param name="value">The <see cref="MySqlParameter"/> object to locate.
</param>
+		/// <returns>The zero-based location of the <see cref="MySqlParameter"/> in
the collection.</returns>
+		/// <overloads>Gets the location of a <see cref="MySqlParameter"/> in the
collection.</overloads>
+		public int IndexOf(object value)
+		{
+			return _parms.IndexOf(value);
+		}
+
+		/// <summary>
+		/// Inserts a MySqlParameter into the collection at the specified index.
+		/// </summary>
+		/// <param name="index"></param>
+		/// <param name="value"></param>
+		public void Insert(int index, object value)
+		{
+			_parms.Insert( index, value );
+		}
+
+		bool IList.IsFixedSize
+		{
+			get { return _parms.IsFixedSize; }
+		}
+
+		bool IList.IsReadOnly
+		{
+			get { return _parms.IsReadOnly; }
+		}
+
+		/// <summary>
+		/// Removes the specified MySqlParameter from the collection.
+		/// </summary>
+		/// <param name="value"></param>
+		public void Remove( object value )
+		{
+			_parms.Remove( value );
+		}
+
+		/// <summary>
+		/// Removes the specified <see cref="MySqlParameter"/> from the collection using
a specific index.
+		/// </summary>
+		/// <param name="index">The zero-based index of the parameter. </param>
+		/// <overloads>Removes the specified <see cref="MySqlParameter"/> from the
collection.</overloads>
+		public void RemoveAt( int index )
+		{
+			_parms.RemoveAt( index );
+		}
+
+		object IList.this[int index] 
+		{
+			get { return this[index]; }
+			set 
+			{ 
+				if (! (value is MySqlParameter)) throw new MySqlException("Only MySqlParameter
objects may be stored");
+				this[index] = (MySqlParameter)value; 
+			}
+		}
+
+		/// <summary>
+		/// Adds the specified <see cref="MySqlParameter"/> object to the <see
cref="MySqlParameterCollection"/>.
+		/// </summary>
+		/// <param name="value">The <see cref="MySqlParameter"/> to add to the
collection.</param>
+		/// <returns>The index of the new <see cref="MySqlParameter"/>
object.</returns>
+		public int Add( object value )
+		{
+			if (! (value is MySqlParameter)) 
+				throw new MySqlException("Only MySqlParameter objects may be stored");
+
+			MySqlParameter p = (MySqlParameter)value;
+
+			if (p.ParameterName == null || p.ParameterName == String.Empty)
+				throw new MySqlException("Parameters must be named");
+
+			return _parms.Add(value);
+		}
+
+		#endregion
+
+		#region IDataParameterCollection
+
+		/// <summary>
+		/// Gets a value indicating whether a <see cref="MySqlParameter"/> with the
specified parameter name exists in the collection.
+		/// </summary>
+		/// <param name="name">The name of the <see cref="MySqlParameter"/> object
to find.</param>
+		/// <returns>true if the collection contains the parameter; otherwise,
false.</returns>
+		public bool Contains(string name)
+		{
+			return IndexOf(name) != -1;
+		}
+
+		/// <summary>
+		/// Gets the location of the <see cref="MySqlParameter"/> in the collection with
a specific parameter name.
+		/// </summary>
+		/// <param name="parameterName">The name of the <see
cref="MySqlParameter"/> object to retrieve. </param>
+		/// <returns>The zero-based location of the <see cref="MySqlParameter"/> in
the collection.</returns>
+		public int IndexOf(string parameterName)
+		{
+			if (parameterName[0] == paramMarker)
+				parameterName = parameterName.Substring(1, parameterName.Length-1);
+			parameterName = parameterName.ToLower();
+			for (int x=0; x < _parms.Count; x++) 
+			{
+				MySqlParameter p = (MySqlParameter)_parms[x];
+				string listName = p.ParameterName;
+				if (listName[0] == paramMarker)
+					listName = listName.Substring(1, listName.Length-1);
+				if (listName.ToLower() == parameterName) return x;
+			}
+			return -1;
+		}
+
+		/// <summary>
+		/// Removes the specified <see cref="MySqlParameter"/> from the collection using
the parameter name.
+		/// </summary>
+		/// <param name="name">The name of the <see cref="MySqlParameter"/> object
to retrieve. </param>
+		public void RemoveAt(string name)
+		{
+			_parms.RemoveAt(InternalIndexOf(name));
+		}
+
+		object IDataParameterCollection.this[string name]
+		{
+			get { return this[name]; }
+			set 
+			{ 
+				if (! (value is MySqlParameter)) throw new MySqlException("Only MySqlParameter
objects may be stored");
+				this[name] = (MySqlParameter)value;
+			}
+		}
+		#endregion
+
+		#region IEnumerable
+		IEnumerator IEnumerable.GetEnumerator()
+		{
+			return ((IEnumerable)_parms).GetEnumerator();
+		}
+		#endregion
+
+		#region Public Methods
+
+		/// <summary>
+		/// Gets the <see cref="MySqlParameter"/> at the specified index.
+		/// </summary>
+		/// <overloads>Gets the <see cref="MySqlParameter"/> with a specified
attribute.
+		/// [C#] In C#, this property is the indexer for the <see
cref="MySqlParameterCollection"/> class.
+		/// </overloads>
+		public MySqlParameter this[int index]
+		{
+			get { return (MySqlParameter)_parms[index]; }
+			set { _parms[index] = value; }
+		}
+
+		/// <summary>
+		/// Gets the <see cref="MySqlParameter"/> with the specified name.
+		/// </summary>
+		public MySqlParameter this[string name]
+		{
+			get { return (MySqlParameter)_parms[ InternalIndexOf( name ) ]; }
+			set { _parms[ InternalIndexOf( name ) ] = value; }
+		}
+
+		/// <summary>
+		/// Adds the specified <see cref="MySqlParameter"/> object to the <see
cref="MySqlParameterCollection"/>.
+		/// </summary>
+		/// <param name="value">The <see cref="MySqlParameter"/> to add to the
collection.</param>
+		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
+		public MySqlParameter Add(MySqlParameter value)
+		{
 			if (value == null) 
 				throw new ArgumentException("The MySqlParameterCollection only accepts non-null
MySqlParameter type objects.", "value");
-
-			string inComingName = value.ParameterName.ToLower();
-			if (inComingName[0] == paramMarker)
-				inComingName = inComingName.Substring(1, inComingName.Length-1);
-
-			for (int i=0; i < _parms.Count; i++)
-			{
-				MySqlParameter p = (MySqlParameter)_parms[i];
-				string name = p.ParameterName.ToLower();
-				if (name[0] == paramMarker)
-					name = name.Substring(1, name.Length-1);
-				if (name == inComingName)
-				{
-					_parms[i] = value;
-					return value;
-				}
-			}
-
-			_parms.Add(value);
-			return value;
-		}
-
-		/// <summary>
-		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> given the specified parameter name and value.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter.</param>
-		/// <param name="value">The <see cref="MySqlParameter.Value"/> of the
<see cref="MySqlParameter"/> to add to the collection.</param>
-		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
-		public MySqlParameter Add( string parameterName, object value )
-		{
-			return Add( new MySqlParameter( parameterName, value ) );
-		}
-
-		/// <summary>
-		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> given the parameter name and the data type.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter.</param>
-		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
-		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
-		public MySqlParameter Add(string parameterName, MySqlDbType dbType)
-		{
-			return Add(new MySqlParameter(parameterName, dbType));
-		}
-
-		/// <summary>
-		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> with the parameter name, the data type, and the
column length.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter.</param>
-		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
-		/// <param name="size">The length of the column.</param>
-		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
-		public MySqlParameter Add(string parameterName, MySqlDbType dbType, int size)
-		{
-			return Add(new MySqlParameter(parameterName, dbType, size ));
-		}
-
-		/// <summary>
-		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> with the parameter name, the data type, the column
length, and the source column name.
-		/// </summary>
-		/// <param name="parameterName">The name of the parameter.</param>
-		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
-		/// <param name="size">The length of the column.</param>
-		/// <param name="sourceColumn">The name of the source column.</param>
-		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
-		public MySqlParameter Add(string parameterName, MySqlDbType dbType, int size, string
sourceColumn)
-		{
-			return Add(new MySqlParameter(parameterName, dbType, size, sourceColumn));
-		}
-
-		#endregion
-
-	}
-}
+
+			string inComingName = value.ParameterName.ToLower();
+			if (inComingName[0] == paramMarker)
+				inComingName = inComingName.Substring(1, inComingName.Length-1);
+
+			for (int i=0; i < _parms.Count; i++)
+			{
+				MySqlParameter p = (MySqlParameter)_parms[i];
+				string name = p.ParameterName.ToLower();
+				if (name[0] == paramMarker)
+					name = name.Substring(1, name.Length-1);
+				if (name == inComingName)
+				{
+					_parms[i] = value;
+					return value;
+				}
+			}
+
+			_parms.Add(value);
+			return value;
+		}
+
+		/// <summary>
+		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> given the specified parameter name and value.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter.</param>
+		/// <param name="value">The <see cref="MySqlParameter.Value"/> of the
<see cref="MySqlParameter"/> to add to the collection.</param>
+		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
+		public MySqlParameter Add( string parameterName, object value )
+		{
+			return Add( new MySqlParameter( parameterName, value ) );
+		}
+
+		/// <summary>
+		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> given the parameter name and the data type.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter.</param>
+		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
+		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
+		public MySqlParameter Add(string parameterName, MySqlDbType dbType)
+		{
+			return Add(new MySqlParameter(parameterName, dbType));
+		}
+
+		/// <summary>
+		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> with the parameter name, the data type, and the
column length.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter.</param>
+		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
+		/// <param name="size">The length of the column.</param>
+		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
+		public MySqlParameter Add(string parameterName, MySqlDbType dbType, int size)
+		{
+			return Add(new MySqlParameter(parameterName, dbType, size ));
+		}
+
+		/// <summary>
+		/// Adds a <see cref="MySqlParameter"/> to the <see
cref="MySqlParameterCollection"/> with the parameter name, the data type, the column
length, and the source column name.
+		/// </summary>
+		/// <param name="parameterName">The name of the parameter.</param>
+		/// <param name="dbType">One of the <see cref="MySqlDbType"/> values.
</param>
+		/// <param name="size">The length of the column.</param>
+		/// <param name="sourceColumn">The name of the source column.</param>
+		/// <returns>The newly added <see cref="MySqlParameter"/>
object.</returns>
+		public MySqlParameter Add(string parameterName, MySqlDbType dbType, int size, string
sourceColumn)
+		{
+			return Add(new MySqlParameter(parameterName, dbType, size, sourceColumn));
+		}
+
+		#endregion
+
+	}
+}

Thread
Connector/NET commit: r235 - in branches/1.0: . TestSuite mysqlclient mysqlclient/Typesrburnett18 May