Added:
trunk/Installer/Binary/
Removed:
trunk/Installer/Custom.wxs
trunk/Installer/CustomAction.config
Modified:
trunk/CHANGES
trunk/Client.build
trunk/Driver/Properties/AssemblyInfo.cs
trunk/Driver/Source/CharSetMap.cs
trunk/Driver/Source/CommandBuilder.cs
trunk/Driver/Source/CompressedStream.cs
trunk/Driver/Source/Connection.cs
trunk/Driver/Source/Crypt.cs
trunk/Driver/Source/Driver.cs
trunk/Driver/Source/Exception.cs
trunk/Driver/Source/Field.cs
trunk/Driver/Source/ISSchemaProvider.cs
trunk/Driver/Source/Installer.cs
trunk/Driver/Source/Logger.cs
trunk/Driver/Source/MySqlClientFactory.cs
trunk/Driver/Source/MySqlConnectionStringBuilder.cs
trunk/Driver/Source/MySqlError.cs
trunk/Driver/Source/MySqlHelper.cs
trunk/Driver/Source/MySqlPool.cs
trunk/Driver/Source/MySqlPoolManager.cs
trunk/Driver/Source/MySqlPromotableTransaction.cs
trunk/Driver/Source/MySqlStream.cs
trunk/Driver/Source/MysqlDefs.cs
trunk/Driver/Source/NativeDriver.cs
trunk/Driver/Source/PerformanceMonitor.cs
trunk/Driver/Source/PreparableStatement.cs
trunk/Driver/Source/ProcedureCache.cs
trunk/Driver/Source/Resources.Designer.cs
trunk/Driver/Source/Resources.resx
trunk/Driver/Source/SchemaProvider.cs
trunk/Driver/Source/Statement.cs
trunk/Driver/Source/StoredProcedure.cs
trunk/Driver/Source/Types/MetaData.cs
trunk/Driver/Source/Types/MySqlBinary.cs
trunk/Driver/Source/Types/MySqlBit.cs
trunk/Driver/Source/Types/MySqlByte.cs
trunk/Driver/Source/Types/MySqlConversionException.cs
trunk/Driver/Source/Types/MySqlDateTime.cs
trunk/Driver/Source/Types/MySqlDecimal.cs
trunk/Driver/Source/Types/MySqlDouble.cs
trunk/Driver/Source/Types/MySqlInt16.cs
trunk/Driver/Source/Types/MySqlInt32.cs
trunk/Driver/Source/Types/MySqlInt64.cs
trunk/Driver/Source/Types/MySqlSingle.cs
trunk/Driver/Source/Types/MySqlString.cs
trunk/Driver/Source/Types/MySqlTime.cs
trunk/Driver/Source/Types/MySqlUByte.cs
trunk/Driver/Source/Types/MySqlUInt16.cs
trunk/Driver/Source/Types/MySqlUInt32.cs
trunk/Driver/Source/Types/MySqlUInt64.cs
trunk/Driver/Source/Types/MySqlValue.cs
trunk/Driver/Source/UsageAdvisor.cs
trunk/Driver/Source/command.cs
trunk/Driver/Source/common/ContextString.cs
trunk/Driver/Source/common/NamedPipeStream.cs
trunk/Driver/Source/common/NativeMethods.cs
trunk/Driver/Source/common/Platform.cs
trunk/Driver/Source/common/SHA1.cs
trunk/Driver/Source/common/SharedMemoryStream.cs
trunk/Driver/Source/common/SocketStream.cs
trunk/Driver/Source/common/StreamCreator.cs
trunk/Driver/Source/common/Version.cs
trunk/Driver/Source/common/WinCE.cs
trunk/Driver/Source/dataadapter.cs
trunk/Driver/Source/datareader.cs
trunk/Driver/Source/docs/MySqlConnection.xml
trunk/Driver/Source/parameter.cs
trunk/Driver/Source/parameter_collection.cs
trunk/Driver/Source/transaction.cs
trunk/Installer/main.wxs
trunk/Installer/samples.wxs
trunk/Installer/sources.wxs
trunk/MySQLClient.2005.sln
trunk/MySql.Web/MySql.Web.csproj
trunk/MySql.Web/Source/MembershipProvider.cs
trunk/MySql.Web/Source/RoleProvider.cs
trunk/Package.build
trunk/README
trunk/Release Notes.txt
trunk/TestSuite/AsyncTests.cs
trunk/TestSuite/BaseTest.cs
trunk/TestSuite/BlobTests.cs
trunk/TestSuite/CharacterSetTests.cs
trunk/TestSuite/CommandBuilderTests.cs
trunk/TestSuite/CommandTests.cs
trunk/TestSuite/ConnectionStringBuilder.cs
trunk/TestSuite/ConnectionTests.cs
trunk/TestSuite/CultureTests.cs
trunk/TestSuite/CursorTests.cs
trunk/TestSuite/DataAdapterTests.cs
trunk/TestSuite/DataReaderTests.cs
trunk/TestSuite/DataTypeTests.cs
trunk/TestSuite/DateTimeTests.cs
trunk/TestSuite/EventTests.cs
trunk/TestSuite/ExceptionTests.cs
trunk/TestSuite/GetSchemaTests.cs
trunk/TestSuite/InterfaceTests.cs
trunk/TestSuite/LanguageTests.cs
trunk/TestSuite/MicroPerfTests.cs
trunk/TestSuite/MySqlHelperTests.cs
trunk/TestSuite/ParameterTests.cs
trunk/TestSuite/PerfMonTests.cs
trunk/TestSuite/PoolingTests.cs
trunk/TestSuite/PreparedStatements.cs
trunk/TestSuite/Properties/AssemblyInfo.cs
trunk/TestSuite/SimpleTransactions.cs
trunk/TestSuite/StoredProcedure.cs
trunk/TestSuite/StressTests.cs
trunk/TestSuite/Syntax.cs
trunk/TestSuite/Syntax2.cs
trunk/TestSuite/Threading.cs
trunk/TestSuite/TimeoutAndCancel.cs
trunk/TestSuite/Transactions.cs
trunk/TestSuite/UsageAdvisor.cs
trunk/TestSuite/Utils.cs
trunk/commercial-banner.txt
trunk/gpl-banner.txt
Log:
merge from 5.0
Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/CHANGES 2007-03-01 21:03:34 UTC (rev 624)
@@ -3,7 +3,7 @@
- Added Membership and Role provider contributed by Sean Wright (thanks!)
- Now compiles for .NET CF 2.0
-Version 5.0.4
+Version 5.0.4 2-28-2007
Bugs fixed
----------
@@ -20,7 +20,13 @@
Bug #25906 Typo makes GetSchema with DataTypes collection throw an exception
Bug #25907 DataType Column of DataTypes collection does'nt contain the correct CLR Datatype
Bug #25950 DataSourceInformation collection contains incorrect values
-
+ Bug #26430 Will not install under Vista
+ Bug #26152 Opening a connection is really slow
+ Bug #24373 High CPU utilization when no idle connection
+ Bug #24957 MySql.Data.Types.MySqlConversionException is not marked as Serializable.
+ Bug #25603 Critial ConnectionPool Error in Connector.Net 5.03
+ Bug #26660 MySqlConnection.GetSchema fails with NullReferenceException for Foreign Keys
+
Other changes
-------------
Return parameters created with DeriveParameters now have the name RETURN_VALUE
@@ -31,6 +37,14 @@
sprocs or prepared statements
Assembly now properly appears in the Visual Studio 2005 Add/Remove Reference dialog
Added MySqlParameterCollection.AddWithValue and marked the Add(name, value) method as obsolete
+ Added "Use Procedure Bodies" connection string option to allow calling procedures without
+ using procedure metadata (if possible).
+ Reverted behavior that required parameter names to start with the parameter marker. We
+ apologize for this back and forth but we mistakenly changed the behavior to not
+ match what SqlClient supports. We now support using either syntax for adding
+ parameters however we also respond exactly like SqlClient in that if you ask for the
+ index of a parameter using a syntax different than you added the parameter, the result
+ will be -1.
Version 5.0.3 12-31-2006
Modified: trunk/Client.build
===================================================================
--- trunk/Client.build 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Client.build 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,252 +1,254 @@
<?xml version="1.0" encoding="Windows-1252"?>
<project name="MySqlClient" default="allframeworks" xmlns="http://nant.sf.net/schemas/nant-0.84.win32.net-1.0.xsd">
- <description>MySQLClient Managed Provider for MySQL</description>
+ <description>MySQLClient Managed Provider for MySQL</description>
- <!-- filesets -->
- <fileset id="Source">
- <include name="Driver/Properties/*.cs"/>
- <include name="Driver/Source/*.cs"/>
- <include name="Driver/Source/Common/*.cs"/>
- <include name="Driver/Source/Types/*.cs"/>
- <include name="Driver/Source/ZLib/*.cs"/>
- </fileset>
+ <!-- filesets -->
+ <fileset id="Source">
+ <include name="Driver/Properties/*.cs"/>
+ <include name="Driver/Source/*.cs"/>
+ <include name="Driver/Source/common/*.cs"/>
+ <include name="Driver/Source/Types/*.cs"/>
+ <include name="Driver/Source/zlib/*.cs"/>
+ </fileset>
- <if test="${not property::exists('debug')}">
- <property name="debug" value="false"/>
- </if>
-
- <!-- we default to optimized release binaries -->
- <property name="opt" value="true"/>
- <property name="buildType" value="release"/>
+ <if test="${not property::exists('debug')}">
+ <property name="debug" value="false"/>
+ </if>
- <if test="${(debug)}">
- <property name="opt" value="false"/>
- <property name="buildType" value="debug"/>
- </if>
+ <!-- we default to optimized release binaries -->
+ <property name="opt" value="true"/>
+ <property name="buildType" value="release"/>
- <if test="${not property::exists('defines')}">
- <property name="defines" value=""/>
- </if>
-
- <if test="${not property::exists('build.dir')}">
- <property name="build.dir" value="."/>
- </if>
+ <if test="${(debug)}">
+ <property name="opt" value="false"/>
+ <property name="buildType" value="debug"/>
+ </if>
- <!-- core managed driver target -->
- <target name="compile-client" description="Core client target">
- <property name="nant.settings.currentframework" value="${framework}"/>
- <property name="outdir" value="Driver/bin/${framework}/${buildType}"/>
-
- <mkdir dir="${outdir}" failonerror="false"/>
-
- <resgen todir="Driver/Source">
- <resources>
- <include name="Driver/Source/*.resx" />
- </resources>
- </resgen>
-
- <csc output="${outdir}/MySql.Data.dll" target="library"
- define="${defines}" debug="${debug}" optimize="${opt}" keycontainer="ConnectorNet"
+ <if test="${not property::exists('defines')}">
+ <property name="defines" value=""/>
+ </if>
+
+ <if test="${not property::exists('build.dir')}">
+ <property name="build.dir" value="."/>
+ </if>
+
+ <!-- core managed driver target -->
+ <target name="compile-client" description="Core client target">
+ <property name="nant.settings.currentframework" value="${framework}"/>
+ <property name="outdir" value="Driver/bin/${framework}/${buildType}"/>
+
+ <mkdir dir="${outdir}" failonerror="false"/>
+
+ <resgen todir="Driver/Source">
+ <resources>
+ <include name="Driver/Source/*.resx" />
+ </resources>
+ </resgen>
+
+ <csc output="${outdir}/MySql.Data.dll" target="library"
+ define="${defines}" debug="${debug}" optimize="${opt}" keycontainer="ConnectorNet"
doc="${outdir}/MySql.Data.xml">
- <arg value="/nowarn:0679,1591,2029"/>
- <resources prefix="MySql.Data.MySqlClient.Source">
- <include name="Driver/Source/Resources.resources"/>
- <include name="Driver/Source/ReservedWords.txt"/>
- </resources>
- <references>
- <include name="System.Data.dll"/>
- <include name="System.Drawing.dll"/>
- <include name="System.Transactions.dll"/>
- </references>
- <sources refid="Source"/>
- </csc>
- </target>
+ <arg value="/nowarn:0679,1591,2029"/>
+ <resources prefix="MySql.Data.MySqlClient.Source">
+ <include name="Driver/Source/Resources.resources"/>
+ <include name="Driver/Source/ReservedWords.txt"/>
+ </resources>
+ <references>
+ <include name="System.Data.dll"/>
+ <include name="System.Drawing.dll"/>
+ <include name="System.Transactions.dll"/>
+ </references>
+ <sources refid="Source"/>
+ </csc>
+ </target>
- <target name="compile-test-suite" description="Compiling test suite">
- <property name="nunit-lib" value="${nunit.dir}/bin"/>
- <property name="nant.settings.currentframework" value="${framework}"/>
- <property name="outdir" value="Driver/bin/${framework}/${buildType}"/>
+ <target name="compile-test-suite" description="Compiling test suite">
+ <property name="nant.settings.currentframework" value="${framework}"/>
+ <property name="outdir" value="Driver/bin/${framework}/${buildType}"/>
- <csc output="${outdir}/MySql.Data.Tests.dll" target="library"
- define="${defines}" debug="${debug}" optimize="${opt}"> <arg value="/nowarn:0679,2029"/>
- <sources>
- <include name="TestSuite/*.cs" />
- </sources>
- <references>
- <include name="${outdir}/MySql.Data.dll"/>
- <include name="System.Data.dll"/>
- <include name="System.Configuration.dll"/>
- <include name="System.Drawing.dll"/>
- <include name="System.Transactions.dll"/>
- <include name="${nunit-lib}/nunit.framework.dll"/>
- </references>
- </csc>
- </target>
+ <csc output="${outdir}/MySql.Data.Tests.dll" target="library"
+ define="${defines}" debug="${debug}" optimize="${opt}">
+ <arg value="/nowarn:0679,2029"/>
+ <sources>
+ <include name="TestSuite/*.cs" />
+ </sources>
+ <references>
+ <include name="${outdir}/MySql.Data.dll"/>
+ <include name="System.Data.dll"/>
+ <include name="System.Configuration.dll"/>
+ <include name="System.Drawing.dll"/>
+ <include name="System.Transactions.dll"/>
+ <include name="${nunit-lib}/nunit.framework.dll"/>
+ </references>
+ </csc>
+ </target>
- <!-- builds the client on all supported frameworks -->
- <target name="allframeworks" depends="net-2.0">
- <call target="Docs"/>
- </target>
+ <!-- builds the client on all supported frameworks -->
+ <target name="allframeworks" depends="net-2.0">
+ <call target="Docs"/>
+ </target>
- <!-- core managed driver target 1.1 -->
- <target name="net-1.1" description="1.1 .NET target">
- <property name="nunit.dir" value="${nunit1.dir}"/>
- <property name="framework" value="net-1.1"/>
- <call target="compile-client"/>
- <call target="compile-test-suite"/>
- </target>
+ <!-- core managed driver target 1.1 -->
+ <target name="net-1.1" description="1.1 .NET target">
+ <property name="nunit.dir" value="${nunit1.dir}"/>
+ <property name="framework" value="net-1.1"/>
+ <call target="compile-client"/>
+ <call target="compile-test-suite"/>
+ </target>
- <!-- core managed driver target 2.0 -->
- <target name="net-2.0" description="2.0 .NET target">
- <property name="nunit.dir" value="${nunit2.dir}"/>
- <property name="framework" value="net-2.0"/>
- <if test="${string::get-length(defines) > 0}">
- <property name="defines" value="${defines},"/>
- </if>
- <property name="defines" value="${defines}NET20"/>
- <call target="compile-client"/>
- <call target="compile-test-suite"/>
- </target>
-
- <!-- core managed driver target mono 1.0 -->
- <target name="mono-1.0" description="Mono 1.0 Target">
- <property name="nunit-lib" value="${framework::get-assembly-directory('mono-1.0')}"/>
- <property name="framework" value="mono-1.0"/>
- <call target="client"/>
- </target>
+ <!-- core managed driver target 2.0 -->
+ <target name="net-2.0" description="2.0 .NET target">
+ <property name="nunit.dir" value="${nunit2.dir}"/>
+ <property name="nunit-lib" value="${nunit.dir}/bin"/>
+ <property name="framework" value="net-2.0"/>
+ <if test="${string::get-length(defines) > 0}">
+ <property name="defines" value="${defines},"/>
+ </if>
+ <property name="defines" value="${defines}NET20"/>
+ <call target="compile-client"/>
+ <call target="compile-test-suite"/>
+ </target>
- <target name="mono-2.0" description="Mono 2.0 Target">
- <property name="defines" value="${defines},MONO,NET20"/>
- <property name="nunit-lib" value="c:/program files/nunit/src/build/mono/2.0/debug"/>
- <property name="framework" value="mono-2.0"/>
- <call target="client"/>
- </target>
+ <!-- core managed driver target mono 1.0 -->
+ <target name="mono-1.0" description="Mono 1.0 Target">
+ <property name="nunit-lib" value="${framework::get-assembly-directory('mono-1.0')}"/>
+ <property name="framework" value="mono-1.0"/>
+ <call target="client"/>
+ </target>
- <!-- testing targets -->
- <target name="alltests" depends="test-net-2.0">
- </target>
-
- <target name="test-net-1.1" depends="net-1.1">
- <property name="framework" value="net-1.1"/>
- <call target="testclient"/>
- <call target="fxcop"/>
- </target>
+ <target name="mono-2.0" description="Mono 2.0 Target">
+ <property name="defines" value="${defines},MONO,NET20"/>
+ <property name="nunit-lib" value="${framework::get-framework-directory('mono-1.0')}"/>
+ <property name="framework" value="mono-2.0"/>
+ <call target="compile-client"/>
+ <call target="compile-test-suite"/>
+ </target>
- <target name="test-net-2.0" depends="net-2.0">
- <property name="framework" value="net-2.0"/>
- <call target="testclient"/>
- </target>
+ <!-- testing targets -->
+ <target name="alltests" depends="test-net-2.0">
+ </target>
- <target name="test-mono-1.0" depends="mono-1.0">
- <property name="nunit" value="${nunit-mono}"/>
- <property name="framework" value="mono-1.0"/>
- <call target="testclient"/>
- </target>
+ <target name="test-net-1.1" depends="net-1.1">
+ <property name="framework" value="net-1.1"/>
+ <call target="testclient"/>
+ <call target="fxcop"/>
+ </target>
- <!--
+ <target name="test-net-2.0" depends="net-2.0">
+ <property name="framework" value="net-2.0"/>
+ <call target="testclient"/>
+ </target>
+
+ <target name="test-mono-1.0" depends="mono-1.0">
+ <property name="nunit" value="${nunit-mono}"/>
+ <property name="framework" value="mono-1.0"/>
+ <call target="testclient"/>
+ </target>
+
+ <!--
Target to run the test suite. This target will run through all the
supported versions of MySQL, stopping the services, and then starting
them one by one and running all supported configs on each database
-->
- <target name="testclient" description="Target to run NUnit tests">
- <mkdir dir="results"/>
- <property name="doCoverage" value="false"/>
+ <target name="testclient" description="Target to run NUnit tests">
+ <mkdir dir="results"/>
+ <property name="doCoverage" value="false"/>
- <!-- test 4.1 -->
- <echo message="Testing MySQL 4.1"/>
- <property name="excludes" value="5.0,NotWorking,SharedMemory"/>
- <property name="config" value="mysql-41.config"/>
- <call target="testdb"/>
+ <!-- test 4.1 -->
+ <echo message="Testing MySQL 4.1"/>
+ <property name="excludes" value="5.0,NotWorking,SharedMemory"/>
+ <property name="config" value="mysql-41.config"/>
+ <call target="testdb"/>
- <echo message="Testing MySQL 5.0"/>
- <property name="excludes" value="NotWorking,SharedMemory"/>
- <property name="config" value="mysql-50.config"/>
- <!--<property name="doCoverage" value="true"/>-->
- <call target="testdb"/>
-
- <echo message="Testing MySQL 5.1"/>
- <property name="excludes" value="NotWorking,SharedMemory"/>
- <property name="config" value="mysql-51.config"/>
- <call target="testdb"/>
- </target>
+ <echo message="Testing MySQL 5.0"/>
+ <property name="excludes" value="NotWorking,SharedMemory"/>
+ <property name="config" value="mysql-50.config"/>
+ <!--<property name="doCoverage" value="true"/>-->
+ <call target="testdb"/>
- <!--
+ <echo message="Testing MySQL 5.1"/>
+ <property name="excludes" value="NotWorking,SharedMemory"/>
+ <property name="config" value="mysql-51.config"/>
+ <call target="testdb"/>
+ </target>
+
+ <!--
execute the test suite against a single database instance, possibly using
coverage
-->
- <target name="testdb" description="Target to test a database with all possible configurations">
- <copy overwrite="true" file="testsuite/configs/${config}" tofile="Driver/bin/${framework}/${buildType}/MySql.Data.Tests.dll.config"/>
-
- <property name="nunit-exe" value="${nunit.dir}/bin/nunit-console.exe"/>
-<!-- <property name="nunit-exe" value="${nunit.dir}/mono/bin/nunit-console.exe" if="${string::contains(framework, 'mono')}"/>-->
+ <target name="testdb" description="Target to test a database with all possible configurations">
+ <copy overwrite="true" file="testsuite/configs/${config}" tofile="Driver/bin/${framework}/${buildType}/MySql.Data.Tests.dll.config"/>
- <exec unless="${doCoverage}" program="${nunit-exe}" workingdir="Driver/bin/${framework}/${buildType}"
+ <property name="nunit-exe" value="${nunit.dir}/bin/nunit-console.exe"/>
+ <!-- <property name="nunit-exe" value="${nunit.dir}/mono/bin/nunit-console.exe" if="${string::contains(framework, 'mono')}"/>-->
+
+ <exec unless="${doCoverage}" program="${nunit-exe}" workingdir="Driver/bin/${framework}/${buildType}"
failonerror="true">
- <arg value="/exclude=${excludes}"/>
- <arg value="MySql.Data.Tests.dll"/>
- <arg value="/xml=${framework}-nunit-results.xml"/>
- <arg value="/nologo"/>
- </exec>
-<!-- <exec if="${doCoverage}" program="${ncover.executable}"
+ <arg value="/exclude=${excludes}"/>
+ <arg value="MySql.Data.Tests.dll"/>
+ <arg value="/xml=${framework}-nunit-results.xml"/>
+ <arg value="/nologo"/>
+ </exec>
+ <!-- <exec if="${doCoverage}" program="${ncover.executable}"
commandline="/c "${nunit-exe}" "Driver/bin/${framework}/${buildType}/MySql.Data.Tests.dll /exclude=${excludes} /xml=../../../results/nunit-${framework}-${buildType}.xml" /a MySql.Data /o results/ncover-${framework}-${config}.xml"
failonerror="true"/>-->
- </target>
+ </target>
- <!-- Run fxcop on the current build -->
- <target name="fxcop" description="Runs FXCop">
- <exec program="${fxcop.executable}"
+ <!-- Run fxcop on the current build -->
+ <target name="fxcop" description="Runs FXCop">
+ <exec program="${fxcop.executable}"
commandline="/o:results/fxcop-${framework}-${buildType}.xml /c /f:bin/${framework}/${buildType}/MySql.Data.dll /s"
failonerror="false"/>
- </target>
-
- <!-- documentation target -->
- <target name="Docs" description="Documentation">
- <ndoc>
- <assemblies basedir="Driver/bin/${framework}/${buildType}">
- <include name="MySql.Data.dll" />
- </assemblies>
- <summaries>
- <include name="${build.dir}/Driver/docs/namespace.xml"/>
- </summaries>
- <documenters>
- <documenter name="MSDN">
- <property name="OutputDirectory" value="${build.dir}/Driver/bin/${framework}/${buildType}/doc/VS.Net" />
- <property name="HtmlHelpName" value="MySql.Data" />
- <property name="HtmlHelpCompilerFilename" value="hhc.exe" />
- <property name="IncludeFavorites" value="False" />
- <property name="Title" value="MySQL ADO.Net Data Provider" />
- <property name="SplitTOCs" value="False" />
- <property name="DefaulTOC" value="" />
- <property name="ShowVisualBasic" value="True" />
- <property name="ShowMissingSummaries" value="False" />
- <property name="ShowMissingRemarks" value="False" />
- <property name="ShowMissingParams" value="False" />
- <property name="ShowMissingReturns" value="False" />
- <property name="ShowMissingValues" value="False" />
- <property name="DocumentInternals" value="False" />
- <property name="DocumentProtected" value="True" />
- <property name="DocumentPrivates" value="False" />
- <property name="DocumentEmptyNamespaces" value="False" />
- <property name="IncludeAssemblyVersion" value="False" />
- <property name="CopyrightText" value="Copyright MySQL AB 2004-2006" />
- <property name="CopyrightHref" value="http://www.mysql.com" />
- </documenter>
- </documenters>
- </ndoc>
-
- <!-- now copy the generated docs to the doc folder -->
- <mkdir dir="doc"/>
- <copy file="Driver/bin/${framework}/${buildType}/doc/VS.Net/MySql.Data.chm" todir="doc"/>
- <delete dir="Driver/bin/${framework}/${buildType}/doc" failonerror="false"/>
- </target>
-
- <!-- Remove all generated files target -->
- <target name="clean" description="Remove all generated files">
- <delete failonerror="false">
- <fileset>
- <include name="bin/**" />
- </fileset>
- </delete>
- </target>
-
+ </target>
+
+ <!-- documentation target -->
+ <target name="Docs" description="Documentation">
+ <ndoc>
+ <assemblies basedir="Driver/bin/${framework}/${buildType}">
+ <include name="MySql.Data.dll" />
+ </assemblies>
+ <summaries>
+ <include name="${build.dir}/Driver/docs/namespace.xml"/>
+ </summaries>
+ <documenters>
+ <documenter name="MSDN">
+ <property name="OutputDirectory" value="${build.dir}/Driver/bin/${framework}/${buildType}/doc/VS.Net" />
+ <property name="HtmlHelpName" value="MySql.Data" />
+ <property name="HtmlHelpCompilerFilename" value="hhc.exe" />
+ <property name="IncludeFavorites" value="False" />
+ <property name="Title" value="MySQL ADO.Net Data Provider" />
+ <property name="SplitTOCs" value="False" />
+ <property name="DefaulTOC" value="" />
+ <property name="ShowVisualBasic" value="True" />
+ <property name="ShowMissingSummaries" value="False" />
+ <property name="ShowMissingRemarks" value="False" />
+ <property name="ShowMissingParams" value="False" />
+ <property name="ShowMissingReturns" value="False" />
+ <property name="ShowMissingValues" value="False" />
+ <property name="DocumentInternals" value="False" />
+ <property name="DocumentProtected" value="True" />
+ <property name="DocumentPrivates" value="False" />
+ <property name="DocumentEmptyNamespaces" value="False" />
+ <property name="IncludeAssemblyVersion" value="False" />
+ <property name="CopyrightText" value="Copyright MySQL AB 2004-2006" />
+ <property name="CopyrightHref" value="http://www.mysql.com" />
+ </documenter>
+ </documenters>
+ </ndoc>
+
+ <!-- now copy the generated docs to the doc folder -->
+ <mkdir dir="doc"/>
+ <copy file="Driver/bin/${framework}/${buildType}/doc/VS.Net/MySql.Data.chm" todir="doc"/>
+ <delete dir="Driver/bin/${framework}/${buildType}/doc" failonerror="false"/>
+ </target>
+
+ <!-- Remove all generated files target -->
+ <target name="clean" description="Remove all generated files">
+ <delete failonerror="false">
+ <fileset>
+ <include name="bin/**" />
+ </fileset>
+ </delete>
+ </target>
+
</project>
Modified: trunk/Driver/Properties/AssemblyInfo.cs
===================================================================
--- trunk/Driver/Properties/AssemblyInfo.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Properties/AssemblyInfo.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -33,7 +33,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MySQL AB")]
[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("Copyright 2004-2006, MySQL AB")]
+[assembly: AssemblyCopyright("Copyright 2004-2007, MySQL AB")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
@@ -50,7 +50,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("5.0.3")]
+[assembly: AssemblyVersion("5.0.4")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: trunk/Driver/Source/CharSetMap.cs
===================================================================
--- trunk/Driver/Source/CharSetMap.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/CharSetMap.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/CommandBuilder.cs
===================================================================
--- trunk/Driver/Source/CommandBuilder.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/CommandBuilder.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/CompressedStream.cs
===================================================================
--- trunk/Driver/Source/CompressedStream.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/CompressedStream.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Connection.cs
===================================================================
--- trunk/Driver/Source/Connection.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Connection.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Crypt.cs
===================================================================
--- trunk/Driver/Source/Crypt.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Crypt.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Driver.cs
===================================================================
--- trunk/Driver/Source/Driver.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Driver.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -148,10 +148,12 @@
{
this.connection = connection;
+ bool firstConfigure = false;
// if we have not already configured our server variables
// then do so now
if (serverProps == null)
{
+ firstConfigure = true;
// load server properties
serverProps = new Hashtable();
MySqlCommand cmd = new MySqlCommand("SHOW VARIABLES", connection);
@@ -187,8 +189,9 @@
throw new MySqlException( "This client library licensed only for use with commercially-licensed MySQL servers." );
#endif
// if the user has indicated that we are not to reset
- // the connection then we are done.
- if (!Settings.ConnectionReset) return;
+ // the connection and this is not our first time through,
+ // then we are done.
+ if (!Settings.ConnectionReset && !firstConfigure) return;
string charSet = connectionString.CharacterSet;
if (charSet == null || charSet.Length == 0)
Modified: trunk/Driver/Source/Exception.cs
===================================================================
--- trunk/Driver/Source/Exception.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Exception.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -20,6 +20,7 @@
using System;
using System.Data.Common;
+using System.Runtime.Serialization;
namespace MySql.Data.MySqlClient
{
Modified: trunk/Driver/Source/Field.cs
===================================================================
--- trunk/Driver/Source/Field.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Field.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -200,33 +200,45 @@
{
case MySqlDbType.Byte:
return new MySqlByte();
- case MySqlDbType.UByte: return new MySqlUByte();
- case MySqlDbType.Int16: return new MySqlInt16();
- case MySqlDbType.UInt16: return new MySqlUInt16();
+ case MySqlDbType.UByte:
+ return new MySqlUByte();
+ case MySqlDbType.Int16:
+ return new MySqlInt16();
+ case MySqlDbType.UInt16:
+ return new MySqlUInt16();
case MySqlDbType.Int24:
case MySqlDbType.Int32:
- case MySqlDbType.Year: return new MySqlInt32(type, true);
+ case MySqlDbType.Year:
+ return new MySqlInt32(type, true);
case MySqlDbType.UInt24:
- case MySqlDbType.UInt32: return new MySqlUInt32(type, true);
- case MySqlDbType.Bit: return new MySqlBit();
+ case MySqlDbType.UInt32:
+ return new MySqlUInt32(type, true);
+ case MySqlDbType.Bit:
+ return new MySqlBit();
case MySqlDbType.Int64:
return new MySqlInt64();
- case MySqlDbType.UInt64: return new MySqlUInt64();
- case MySqlDbType.Time: return new MySqlTimeSpan();
+ case MySqlDbType.UInt64:
+ return new MySqlUInt64();
+ case MySqlDbType.Time:
+ return new MySqlTimeSpan();
case MySqlDbType.Date:
case MySqlDbType.Datetime:
case MySqlDbType.Newdate:
- case MySqlDbType.Timestamp: return new MySqlDateTime(type, true);
+ case MySqlDbType.Timestamp:
+ return new MySqlDateTime(type, true);
case MySqlDbType.Decimal:
case MySqlDbType.NewDecimal:
return new MySqlDecimal();
- case MySqlDbType.Float: return new MySqlSingle();
- case MySqlDbType.Double: return new MySqlDouble();
+ case MySqlDbType.Float:
+ return new MySqlSingle();
+ case MySqlDbType.Double:
+ return new MySqlDouble();
case MySqlDbType.Set:
case MySqlDbType.Enum:
case MySqlDbType.String:
case MySqlDbType.VarString:
- case MySqlDbType.VarChar: return new MySqlString(type, true);
+ case MySqlDbType.VarChar:
+ return new MySqlString(type, true);
case MySqlDbType.Blob:
case MySqlDbType.MediumBlob:
case MySqlDbType.LongBlob:
Modified: trunk/Driver/Source/ISSchemaProvider.cs
===================================================================
--- trunk/Driver/Source/ISSchemaProvider.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/ISSchemaProvider.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -499,8 +499,12 @@
parmDef = parmDef.Substring(split[0].Length);
}
else
+ {
+ lowerDef = parmDef.ToLower(CultureInfo.InvariantCulture);
+ parmDef = parmDef.Substring(0, lowerDef.IndexOf("begin"));
parmRow["PARAMETER_NAME"] = String.Format("{0}RETURN_VALUE",
connection.ParameterMarker);
+ }
ParseType(parmDef, sqlMode, parmRow);
}
Modified: trunk/Driver/Source/Installer.cs
===================================================================
--- trunk/Driver/Source/Installer.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Installer.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Logger.cs
===================================================================
--- trunk/Driver/Source/Logger.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Logger.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/MySqlClientFactory.cs
===================================================================
--- trunk/Driver/Source/MySqlClientFactory.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlClientFactory.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/MySqlConnectionStringBuilder.cs
===================================================================
--- trunk/Driver/Source/MySqlConnectionStringBuilder.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlConnectionStringBuilder.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -28,32 +28,33 @@
namespace MySql.Data.MySqlClient
{
- /// <include file='docs/MySqlConnectionStringBuilder.xml' path='docs/Class/*'/>
- public sealed class MySqlConnectionStringBuilder : DbConnectionStringBuilder
- {
- string userId, password, server;
- string database, sharedMemName, pipeName, charSet;
- string optionFile;
- string originalConnectionString;
- StringBuilder persistConnString;
- uint port, connectionTimeout, minPoolSize, maxPoolSize;
- uint procCacheSize, connectionLifetime;
- MySqlConnectionProtocol protocol;
- MySqlDriverType driverType;
- bool compress, connectionReset, allowBatch, logging;
- bool oldSyntax, persistSI, usePerfMon, pooling;
- bool allowZeroDatetime, convertZeroDatetime;
- bool useUsageAdvisor, useSSL;
- bool ignorePrepare;
+ /// <include file='docs/MySqlConnectionStringBuilder.xml' path='docs/Class/*'/>
+ public sealed class MySqlConnectionStringBuilder : DbConnectionStringBuilder
+ {
+ string userId, password, server;
+ string database, sharedMemName, pipeName, charSet;
+ string optionFile;
+ string originalConnectionString;
+ StringBuilder persistConnString;
+ uint port, connectionTimeout, minPoolSize, maxPoolSize;
+ uint procCacheSize, connectionLifetime;
+ MySqlConnectionProtocol protocol;
+ MySqlDriverType driverType;
+ bool compress, connectionReset, allowBatch, logging;
+ bool oldSyntax, persistSI, usePerfMon, pooling;
+ bool allowZeroDatetime, convertZeroDatetime;
+ bool useUsageAdvisor, useSSL;
+ bool ignorePrepare;
+ bool useProcedureBodies;
/// <summary>
/// Initializes a new instance of the <see cref="MySqlConnectionStringBuilder"/> class.
/// </summary>
- public MySqlConnectionStringBuilder()
- {
- persistConnString = new StringBuilder();
- Clear();
- }
+ public MySqlConnectionStringBuilder()
+ {
+ persistConnString = new StringBuilder();
+ Clear();
+ }
/// <summary>
/// Initializes a new instance of the <see cref="MySqlConnectionStringBuilder"/> class.
@@ -64,766 +65,780 @@
/// information. Parsed into name/value pairs. Invalid key names raise
/// <see cref="KeyNotFoundException"/>.
/// </param>
- public MySqlConnectionStringBuilder(string connectionString)
- : base()
- {
- originalConnectionString = connectionString;
- persistConnString = new StringBuilder();
- ConnectionString = connectionString;
- }
+ public MySqlConnectionStringBuilder(string connectionString)
+ : base()
+ {
+ originalConnectionString = connectionString;
+ persistConnString = new StringBuilder();
+ ConnectionString = connectionString;
+ }
- #region Server Properties
+ #region Server Properties
- /// <summary>
- /// Gets or sets the name of the server.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the name of the server.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [Description("Server to connect to")]
+ [Category("Connection")]
+ [Description("Server to connect to")]
#endif
- public string Server
- {
- get { return this.server; }
- set { CheckNullAndSet("Server", value); server = value; }
- }
+ public string Server
+ {
+ get { return this.server; }
+ set { CheckNullAndSet("Server", value); server = value; }
+ }
- /// <summary>
- /// Gets or sets the name of the database the connection should
- /// initially connect to.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the name of the database the connection should
+ /// initially connect to.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [Description("Database to use initially")]
+ [Category("Connection")]
+ [Description("Database to use initially")]
#endif
- public string Database
- {
- get { return this.database; }
- set { CheckNullAndSet("Database", value); database = value; }
- }
+ public string Database
+ {
+ get { return this.database; }
+ set { CheckNullAndSet("Database", value); database = value; }
+ }
- /// <summary>
- /// Gets or sets the protocol that should be used for communicating
- /// with MySQL.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the protocol that should be used for communicating
+ /// with MySQL.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Connection Protocol")]
- [Description("Protocol to use for connection to MySQL")]
- [DefaultValue(MySqlConnectionProtocol.Sockets)]
+ [Category("Connection")]
+ [DisplayName("Connection Protocol")]
+ [Description("Protocol to use for connection to MySQL")]
+ [DefaultValue(MySqlConnectionProtocol.Sockets)]
#endif
- public MySqlConnectionProtocol ConnectionProtocol
- {
- get { return this.protocol; }
- set { base["Protocol"] = value; protocol = value; }
- }
+ public MySqlConnectionProtocol ConnectionProtocol
+ {
+ get { return this.protocol; }
+ set { base["Protocol"] = value; protocol = value; }
+ }
- /// <summary>
- /// Gets or sets the name of the named pipe that should be used
- /// for communicating with MySQL.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the name of the named pipe that should be used
+ /// for communicating with MySQL.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Pipe Name")]
- [Description("Name of pipe to use when connecting with named pipes (Win32 only)")]
+ [Category("Connection")]
+ [DisplayName("Pipe Name")]
+ [Description("Name of pipe to use when connecting with named pipes (Win32 only)")]
#endif
- public string PipeName
- {
- get { return this.pipeName; }
- set { CheckNullAndSet("Pipe Name", value); pipeName = value; }
- }
+ public string PipeName
+ {
+ get { return this.pipeName; }
+ set { CheckNullAndSet("Pipe Name", value); pipeName = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value that indicates whether this connection
- /// should use compression.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value that indicates whether this connection
+ /// should use compression.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Use Compression")]
- [Description("Should the connection ues compression")]
- [DefaultValue(false)]
+ [Category("Connection")]
+ [DisplayName("Use Compression")]
+ [Description("Should the connection ues compression")]
+ [DefaultValue(false)]
#endif
- public bool UseCompression
- {
- get { return this.compress; }
- set { base["compress"] = value; compress = value; }
- }
+ public bool UseCompression
+ {
+ get { return this.compress; }
+ set { base["compress"] = value; compress = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value that indicates whether this connection will allow
- /// commands to send multiple SQL statements in one execution.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value that indicates whether this connection will allow
+ /// commands to send multiple SQL statements in one execution.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Allow Batch")]
- [Description("Allows execution of multiple SQL commands in a single statement")]
- [DefaultValue(true)]
+ [Category("Connection")]
+ [DisplayName("Allow Batch")]
+ [Description("Allows execution of multiple SQL commands in a single statement")]
+ [DefaultValue(true)]
#endif
- public bool AllowBatch
- {
- get { return this.allowBatch; }
- set { base["allow batch"] = value; allowBatch = value; }
- }
+ public bool AllowBatch
+ {
+ get { return this.allowBatch; }
+ set { base["allow batch"] = value; allowBatch = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value that indicates whether logging is enabled.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value that indicates whether logging is enabled.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [Description("Enables output of diagnostic messages")]
- [DefaultValue(false)]
+ [Category("Connection")]
+ [Description("Enables output of diagnostic messages")]
+ [DefaultValue(false)]
#endif
- public bool Logging
- {
- get { return this.logging; }
- set { base["logging"] = value; logging = value; }
- }
+ public bool Logging
+ {
+ get { return this.logging; }
+ set { base["logging"] = value; logging = value; }
+ }
- /// <summary>
- /// Gets or sets the base name of the shared memory objects used to
- /// communicate with MySQL when the shared memory protocol is being used.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the base name of the shared memory objects used to
+ /// communicate with MySQL when the shared memory protocol is being used.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Shared Memory Name")]
- [Description("Name of the shared memory object to use")]
- [DefaultValue("MYSQL")]
+ [Category("Connection")]
+ [DisplayName("Shared Memory Name")]
+ [Description("Name of the shared memory object to use")]
+ [DefaultValue("MYSQL")]
#endif
- public string SharedMemoryName
- {
- get { return this.sharedMemName; }
- set { CheckNullAndSet("Shared Memory Name", value); sharedMemName = value; }
- }
+ public string SharedMemoryName
+ {
+ get { return this.sharedMemName; }
+ set { CheckNullAndSet("Shared Memory Name", value); sharedMemName = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value that indicates whether this connection uses
- /// the old style (@) parameter markers or the new (?) style.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value that indicates whether this connection uses
+ /// the old style (@) parameter markers or the new (?) style.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Use Old Syntax")]
- [Description("Allows the use of old style @ syntax for parameters")]
- [DefaultValue(false)]
+ [Category("Connection")]
+ [DisplayName("Use Old Syntax")]
+ [Description("Allows the use of old style @ syntax for parameters")]
+ [DefaultValue(false)]
#endif
- public bool UseOldSyntax
- {
- get { return this.oldSyntax; }
- set { base["Old Syntax"] = value; oldSyntax = value; }
- }
+ public bool UseOldSyntax
+ {
+ get { return this.oldSyntax; }
+ set { base["Old Syntax"] = value; oldSyntax = value; }
+ }
- /// <summary>
- /// Gets or sets the driver type that should be used for this connection.
- /// </summary>
- /// <remarks>
- /// There is only one valid value for this setting currently.
- /// </remarks>
+ /// <summary>
+ /// Gets or sets the driver type that should be used for this connection.
+ /// </summary>
+ /// <remarks>
+ /// There is only one valid value for this setting currently.
+ /// </remarks>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Driver Type")]
- [Description("Specifies the type of driver to use for this connection")]
- [DefaultValue(MySqlDriverType.Native)]
+ [Category("Connection")]
+ [DisplayName("Driver Type")]
+ [Description("Specifies the type of driver to use for this connection")]
+ [DefaultValue(MySqlDriverType.Native)]
#endif
- public MySqlDriverType DriverType
- {
- get { return this.driverType; }
- set { base["Driver Type"] = value; driverType = value; }
- }
+ public MySqlDriverType DriverType
+ {
+ get { return this.driverType; }
+ set { base["Driver Type"] = value; driverType = value; }
+ }
- internal string OptionFile
- {
- get { return this.optionFile; }
- set { CheckNullAndSet("Option File", value); optionFile = value; }
- }
+ internal string OptionFile
+ {
+ get { return this.optionFile; }
+ set { CheckNullAndSet("Option File", value); optionFile = value; }
+ }
- /// <summary>
- /// Gets or sets the port number that is used when the socket
- /// protocol is being used.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the port number that is used when the socket
+ /// protocol is being used.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [Description("Port to use for TCP/IP connections")]
- [DefaultValue(3306)]
+ [Category("Connection")]
+ [Description("Port to use for TCP/IP connections")]
+ [DefaultValue(3306)]
#endif
- public uint Port
- {
- get { return this.port; }
- set { base["Port"] = value; port = value; }
- }
+ public uint Port
+ {
+ get { return this.port; }
+ set { base["Port"] = value; port = value; }
+ }
- /// <summary>
- /// Gets or sets the connection timeout.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the connection timeout.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Connection")]
- [DisplayName("Connect Timeout")]
- [Description("The length of time (in seconds) to wait for a connection " +
- "to the server before terminating the attempt and generating an error.")]
- [DefaultValue(15)]
+ [Category("Connection")]
+ [DisplayName("Connect Timeout")]
+ [Description("The length of time (in seconds) to wait for a connection " +
+ "to the server before terminating the attempt and generating an error.")]
+ [DefaultValue(15)]
#endif
- public uint ConnectionTimeout
- {
- get { return this.connectionTimeout; }
- set { base["Connection Timeout"] = value; connectionTimeout = value; }
- }
+ public uint ConnectionTimeout
+ {
+ get { return this.connectionTimeout; }
+ set { base["Connection Timeout"] = value; connectionTimeout = value; }
+ }
- #endregion
+ #endregion
- #region Authentication Properties
+ #region Authentication Properties
- /// <summary>
- /// Gets or sets the user id that should be used to connect with.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the user id that should be used to connect with.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Security")]
- [DisplayName("User ID")]
- [Description("Indicates the user ID to be used when connecting to the data source.")]
+ [Category("Security")]
+ [DisplayName("User ID")]
+ [Description("Indicates the user ID to be used when connecting to the data source.")]
#endif
- public string UserID
- {
- get { return this.userId; }
- set { CheckNullAndSet("User Id", value); userId = value; }
- }
+ public string UserID
+ {
+ get { return this.userId; }
+ set { CheckNullAndSet("User Id", value); userId = value; }
+ }
- /// <summary>
- /// Gets or sets the password that should be used to connect with.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the password that should be used to connect with.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Security")]
- [Description("Indicates the password to be used when connecting to the data source.")]
+ [Category("Security")]
+ [Description("Indicates the password to be used when connecting to the data source.")]
#endif
- public string Password
- {
- get { return this.password; }
- set { CheckNullAndSet("Password", value); password = value; }
- }
+ public string Password
+ {
+ get { return this.password; }
+ set { CheckNullAndSet("Password", value); password = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value that indicates if the password should be persisted
- /// in the connection string.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value that indicates if the password should be persisted
+ /// in the connection string.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Security")]
- [DisplayName("Persist Security Info")]
- [Description("When false, security-sensitive information, such as the password, " +
- "is not returned as part of the connection if the connection is open or " +
- "has ever been in an open state.")]
+ [Category("Security")]
+ [DisplayName("Persist Security Info")]
+ [Description("When false, security-sensitive information, such as the password, " +
+ "is not returned as part of the connection if the connection is open or " +
+ "has ever been in an open state.")]
#endif
- public bool PersistSecurityInfo
- {
- get { return persistSI; }
- set { base["Persist Security Info"] = value; persistSI = value; }
- }
+ public bool PersistSecurityInfo
+ {
+ get { return persistSI; }
+ set { base["Persist Security Info"] = value; persistSI = value; }
+ }
#if !PocketPC && !MONO
- [Category("Authentication")]
- [Description("Should the connection use SSL. This currently has no effect.")]
- [DefaultValue(false)]
+ [Category("Authentication")]
+ [Description("Should the connection use SSL. This currently has no effect.")]
+ [DefaultValue(false)]
#endif
- internal bool UseSSL
- {
- get { return useSSL; }
- set { base["usessl"] = value; useSSL = value; }
- }
+ internal bool UseSSL
+ {
+ get { return useSSL; }
+ set { base["usessl"] = value; useSSL = value; }
+ }
- #endregion
+ #endregion
- #region Other Properties
+ #region Other Properties
- /// <summary>
- /// Gets or sets a boolean value that indicates if zero date time values are supported.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value that indicates if zero date time values are supported.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Advanced")]
- [DisplayName("Allow Zero Datetime")]
- [Description("Should zero datetimes be supported")]
- [DefaultValue(false)]
+ [Category("Advanced")]
+ [DisplayName("Allow Zero Datetime")]
+ [Description("Should zero datetimes be supported")]
+ [DefaultValue(false)]
#endif
- public bool AllowZeroDateTime
- {
- get { return this.allowZeroDatetime; }
- set { base["Allow Zero DateTime"] = value; allowZeroDatetime = value; }
- }
+ public bool AllowZeroDateTime
+ {
+ get { return this.allowZeroDatetime; }
+ set { base["Allow Zero DateTime"] = value; allowZeroDatetime = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value indicating if zero datetime values should be
- /// converted to DateTime.MinValue.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value indicating if zero datetime values should be
+ /// converted to DateTime.MinValue.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Advanced")]
- [DisplayName("Convert Zero Datetime")]
- [Description("Should illegal datetime values be converted to DateTime.MinValue")]
- [DefaultValue(false)]
+ [Category("Advanced")]
+ [DisplayName("Convert Zero Datetime")]
+ [Description("Should illegal datetime values be converted to DateTime.MinValue")]
+ [DefaultValue(false)]
#endif
- public bool ConvertZeroDateTime
- {
- get { return this.convertZeroDatetime; }
- set { base["Convert Zero DateTime"] = value; convertZeroDatetime = value; }
- }
+ public bool ConvertZeroDateTime
+ {
+ get { return this.convertZeroDatetime; }
+ set { base["Convert Zero DateTime"] = value; convertZeroDatetime = value; }
+ }
- /// <summary>
- /// Gets or sets the character set that should be used for sending queries to the server.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the character set that should be used for sending queries to the server.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Advanced")]
- [Description("Character set this connection should use")]
+ [Category("Advanced")]
+ [Description("Character set this connection should use")]
#endif
- public string CharacterSet
- {
- get { return this.charSet; }
- set { CheckNullAndSet("Character Set", value); charSet = value; }
- }
+ public string CharacterSet
+ {
+ get { return this.charSet; }
+ set { CheckNullAndSet("Character Set", value); charSet = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value indicating if the Usage Advisor should be enabled.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value indicating if the Usage Advisor should be enabled.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Advanced")]
- [DisplayName("Use Usage Advisor")]
- [Description("Logs inefficient database operations")]
- [DefaultValue(false)]
+ [Category("Advanced")]
+ [DisplayName("Use Usage Advisor")]
+ [Description("Logs inefficient database operations")]
+ [DefaultValue(false)]
#endif
- public bool UseUsageAdvisor
- {
- get { return useUsageAdvisor; }
- set { base["Use Usage Advisor"] = value; useUsageAdvisor = value; }
- }
+ public bool UseUsageAdvisor
+ {
+ get { return useUsageAdvisor; }
+ set { base["Use Usage Advisor"] = value; useUsageAdvisor = value; }
+ }
- /// <summary>
- /// Gets or sets the size of the stored procedure cache.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the size of the stored procedure cache.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Advanced")]
- [DisplayName("Procedure Cache Size")]
- [Description("Indicates how many stored procedures can be cached at one time. " +
- "A value of 0 effectively disables the procedure cache.")]
- [DefaultValue(25)]
+ [Category("Advanced")]
+ [DisplayName("Procedure Cache Size")]
+ [Description("Indicates how many stored procedures can be cached at one time. " +
+ "A value of 0 effectively disables the procedure cache.")]
+ [DefaultValue(25)]
#endif
- public uint ProcedureCacheSize
- {
- get { return this.procCacheSize; }
- set { base["Procedure Cache Size"] = value; procCacheSize = value; }
- }
+ public uint ProcedureCacheSize
+ {
+ get { return this.procCacheSize; }
+ set { base["Procedure Cache Size"] = value; procCacheSize = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value indicating if the permon hooks should be enabled.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value indicating if the permon hooks should be enabled.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Advanced")]
- [DisplayName("Use Performance Monitor")]
- [Description("Indicates that performance counters should be updated during execution.")]
- [DefaultValue(false)]
+ [Category("Advanced")]
+ [DisplayName("Use Performance Monitor")]
+ [Description("Indicates that performance counters should be updated during execution.")]
+ [DefaultValue(false)]
#endif
- public bool UsePerformanceMonitor
- {
- get { return usePerfMon; }
- set { base["Use Performance Monitor"] = value; usePerfMon = value; }
- }
+ public bool UsePerformanceMonitor
+ {
+ get { return usePerfMon; }
+ set { base["Use Performance Monitor"] = value; usePerfMon = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value indicating if calls to Prepare() should be ignored.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value indicating if calls to Prepare() should be ignored.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Advanced")]
- [DisplayName("Ignore Prepare")]
- [Description("Instructs the provider to ignore any attempts to prepare a command.")]
- [DefaultValue(true)]
+ [Category("Advanced")]
+ [DisplayName("Ignore Prepare")]
+ [Description("Instructs the provider to ignore any attempts to prepare a command.")]
+ [DefaultValue(true)]
#endif
- public bool IgnorePrepare
- {
- get { return ignorePrepare; }
- set { base["Ignore Prepare"] = value; ignorePrepare = value; }
- }
+ public bool IgnorePrepare
+ {
+ get { return ignorePrepare; }
+ set { base["Ignore Prepare"] = value; ignorePrepare = value; }
+ }
- #endregion
+#if !PocketPC && !MONO
+ [Category("Advanced")]
+ [DisplayName("Use Procedure Bodies")]
+ [Description("Indicates if stored procedure bodies will be available for parameter detection.")]
+ [DefaultValue(true)]
+#endif
+ public bool UseProcedureBodies
+ {
+ get { return useProcedureBodies; }
+ set { base["Use Procedure Bodies"] = value; useProcedureBodies = value; }
+ }
- #region Pooling Properties
+ #endregion
- /// <summary>
- /// Gets or sets the lifetime of a pooled connection.
- /// </summary>
+ #region Pooling Properties
+
+ /// <summary>
+ /// Gets or sets the lifetime of a pooled connection.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Pooling")]
- [DisplayName("Load Balance Timeout")]
- [Description("The minimum amount of time (in seconds) for this connection to " +
- "live in the pool before being destroyed.")]
- [DefaultValue(0)]
+ [Category("Pooling")]
+ [DisplayName("Load Balance Timeout")]
+ [Description("The minimum amount of time (in seconds) for this connection to " +
+ "live in the pool before being destroyed.")]
+ [DefaultValue(0)]
#endif
- public uint ConnectionLifeTime
- {
- get { return connectionLifetime; }
- set { base["Connection Lifetime"] = value; connectionLifetime = value; }
- }
+ public uint ConnectionLifeTime
+ {
+ get { return connectionLifetime; }
+ set { base["Connection Lifetime"] = value; connectionLifetime = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value indicating if connection pooling is enabled.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value indicating if connection pooling is enabled.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Pooling")]
- [Description("When true, the connection object is drawn from the appropriate " +
- "pool, or if necessary, is created and added to the appropriate pool.")]
- [DefaultValue(true)]
+ [Category("Pooling")]
+ [Description("When true, the connection object is drawn from the appropriate " +
+ "pool, or if necessary, is created and added to the appropriate pool.")]
+ [DefaultValue(true)]
#endif
- public bool Pooling
- {
- get { return pooling; }
- set { base["Pooling"] = value; pooling = value; }
- }
+ public bool Pooling
+ {
+ get { return pooling; }
+ set { base["Pooling"] = value; pooling = value; }
+ }
- /// <summary>
- /// Gets the minimum connection pool size.
- /// </summary>
+ /// <summary>
+ /// Gets the minimum connection pool size.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Pooling")]
- [DisplayName("Min Pool Size")]
- [Description("The minimum number of connections allowed in the pool.")]
- [DefaultValue(0)]
+ [Category("Pooling")]
+ [DisplayName("Min Pool Size")]
+ [Description("The minimum number of connections allowed in the pool.")]
+ [DefaultValue(0)]
#endif
- public uint MinimumPoolSize
- {
- get { return minPoolSize; }
- set { base["Minimum Pool Size"] = value; minPoolSize = value; }
- }
+ public uint MinimumPoolSize
+ {
+ get { return minPoolSize; }
+ set { base["Minimum Pool Size"] = value; minPoolSize = value; }
+ }
- /// <summary>
- /// Gets or sets the maximum connection pool setting.
- /// </summary>
+ /// <summary>
+ /// Gets or sets the maximum connection pool setting.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Pooling")]
- [DisplayName("Max Pool Size")]
- [Description("The maximum number of connections allowed in the pool.")]
- [DefaultValue(100)]
+ [Category("Pooling")]
+ [DisplayName("Max Pool Size")]
+ [Description("The maximum number of connections allowed in the pool.")]
+ [DefaultValue(100)]
#endif
- public uint MaximumPoolSize
- {
- get { return maxPoolSize; }
- set { base["Maximum Pool Size"] = value; maxPoolSize = value; }
- }
+ public uint MaximumPoolSize
+ {
+ get { return maxPoolSize; }
+ set { base["Maximum Pool Size"] = value; maxPoolSize = value; }
+ }
- /// <summary>
- /// Gets or sets a boolean value indicating if the connection should be reset when retrieved
- /// from the pool.
- /// </summary>
+ /// <summary>
+ /// Gets or sets a boolean value indicating if the connection should be reset when retrieved
+ /// from the pool.
+ /// </summary>
#if !PocketPC && !MONO
- [Category("Pooling")]
- [DisplayName("Connection Reset")]
- [Description("When true, indicates the connection state is reset when " +
- "removed from the pool.")]
- [DefaultValue(true)]
+ [Category("Pooling")]
+ [DisplayName("Connection Reset")]
+ [Description("When true, indicates the connection state is reset when " +
+ "removed from the pool.")]
+ [DefaultValue(true)]
#endif
- public bool ConnectionReset
- {
- get { return connectionReset; }
- set { base["Connection Reset"] = value; connectionReset = value; }
- }
+ public bool ConnectionReset
+ {
+ get { return connectionReset; }
+ set { base["Connection Reset"] = value; connectionReset = value; }
+ }
- #endregion
+ #endregion
- #region Conversion Routines
+ #region Conversion Routines
- private void CheckNullAndSet(string keyword, object value)
- {
- if (value == null)
- throw new ArgumentException(Resources.KeywordNoNull, keyword);
- base[keyword] = value;
- }
+ private void CheckNullAndSet(string keyword, object value)
+ {
+ if (value == null)
+ throw new ArgumentException(Resources.KeywordNoNull, keyword);
+ base[keyword] = value;
+ }
- private uint ConvertToUInt(object value)
- {
- try
- {
- uint uValue = (value as IConvertible).ToUInt32(CultureInfo.InvariantCulture);
- return uValue;
- }
- catch (InvalidCastException)
- {
- throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
- }
- }
+ private uint ConvertToUInt(object value)
+ {
+ try
+ {
+ uint uValue = (value as IConvertible).ToUInt32(CultureInfo.InvariantCulture);
+ return uValue;
+ }
+ catch (InvalidCastException)
+ {
+ throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
+ }
+ }
- private bool ConvertToBool(object value)
- {
- if (value is string)
- {
- string s = value.ToString().ToLower();
- if (s == "yes" || s == "true") return true;
- if (s == "no" || s == "false") return false;
- throw new ArgumentException(Resources.ImproperValueFormat, (string)value);
- }
- else
- {
- try
- {
- return (value as IConvertible).ToBoolean(
- CultureInfo.InvariantCulture);
- }
- catch (InvalidCastException)
- {
- throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
- }
- }
- }
+ private bool ConvertToBool(object value)
+ {
+ if (value is string)
+ {
+ string s = value.ToString().ToLower();
+ if (s == "yes" || s == "true") return true;
+ if (s == "no" || s == "false") return false;
+ throw new ArgumentException(Resources.ImproperValueFormat, (string)value);
+ }
+ else
+ {
+ try
+ {
+ return (value as IConvertible).ToBoolean(
+ CultureInfo.InvariantCulture);
+ }
+ catch (InvalidCastException)
+ {
+ throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
+ }
+ }
+ }
- private MySqlConnectionProtocol ConvertToProtocol(object value)
- {
- try
- {
- if (value is string)
- return (MySqlConnectionProtocol)Enum.Parse(
- typeof(MySqlConnectionProtocol), (value as string), true);
- }
- catch (Exception)
- {
- if (value is string)
- {
- string lowerString = (value as string).ToLower();
- if (lowerString == "socket" || lowerString == "tcp")
- return MySqlConnectionProtocol.Sockets;
-#if !CF
- else if (lowerString == "pipe")
- return MySqlConnectionProtocol.NamedPipe;
- else if (lowerString == "unix")
- return MySqlConnectionProtocol.UnixSocket;
- else if (lowerString == "memory")
- return MySqlConnectionProtocol.SharedMemory;
-#endif
- }
- }
- throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
- }
+ private MySqlConnectionProtocol ConvertToProtocol(object value)
+ {
+ try
+ {
+ if (value is MySqlConnectionProtocol) return (MySqlConnectionProtocol)value;
+ return (MySqlConnectionProtocol)Enum.Parse(
+ typeof(MySqlConnectionProtocol), value.ToString(), true);
+ }
+ catch (Exception)
+ {
+ if (value is string)
+ {
+ string lowerString = (value as string).ToLower();
+ if (lowerString == "socket" || lowerString == "tcp")
+ return MySqlConnectionProtocol.Sockets;
+ else if (lowerString == "pipe")
+ return MySqlConnectionProtocol.NamedPipe;
+ else if (lowerString == "unix")
+ return MySqlConnectionProtocol.UnixSocket;
+ else if (lowerString == "memory")
+ return MySqlConnectionProtocol.SharedMemory;
+ }
+ }
+ throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
+ }
- private MySqlDriverType ConvertToDriverType(object value)
- {
- if (value is string)
- return (MySqlDriverType)Enum.Parse(
- typeof(MySqlDriverType), (value as string), true);
- throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
- }
+ private MySqlDriverType ConvertToDriverType(object value)
+ {
+ if (value is MySqlDriverType) return (MySqlDriverType)value;
+ return (MySqlDriverType)Enum.Parse(
+ typeof(MySqlDriverType), value.ToString(), true);
+ throw new ArgumentException(Resources.ImproperValueFormat, value.ToString());
+ }
- #endregion
+ #endregion
- #region Private Methods
+ #region Private Methods
- private void Reset()
- {
- connectionTimeout = 15;
- pooling = true;
- port = 3306;
- server = String.Empty;
- persistSI = false;
- connectionLifetime = 0;
- connectionReset = false;
- minPoolSize = 0;
- maxPoolSize = 100;
- userId = "";
- password = "";
- useUsageAdvisor = false;
- charSet = "";
- compress = false;
- pipeName = "MYSQL";
- logging = false;
- oldSyntax = false;
- sharedMemName = "MYSQL";
- allowBatch = true;
- convertZeroDatetime = false;
- database = "";
- driverType = MySqlDriverType.Native;
- protocol = MySqlConnectionProtocol.Sockets;
- allowZeroDatetime = false;
- usePerfMon = false;
- procCacheSize = 25;
- useSSL = false;
- ignorePrepare = true;
- }
+ private void Reset()
+ {
+ connectionTimeout = 15;
+ pooling = true;
+ port = 3306;
+ server = String.Empty;
+ persistSI = false;
+ connectionLifetime = 0;
+ connectionReset = false;
+ minPoolSize = 0;
+ maxPoolSize = 100;
+ userId = "";
+ password = "";
+ useUsageAdvisor = false;
+ charSet = "";
+ compress = false;
+ pipeName = "MYSQL";
+ logging = false;
+ oldSyntax = false;
+ sharedMemName = "MYSQL";
+ allowBatch = true;
+ convertZeroDatetime = false;
+ database = "";
+ driverType = MySqlDriverType.Native;
+ protocol = MySqlConnectionProtocol.Sockets;
+ allowZeroDatetime = false;
+ usePerfMon = false;
+ procCacheSize = 25;
+ useSSL = false;
+ ignorePrepare = true;
+ useProcedureBodies = true;
+ }
- #endregion
+ #endregion
- /// <summary>
- /// Takes a given connection string and returns it, possible
- /// stripping out the password info
- /// </summary>
- /// <returns></returns>
- public string GetConnectionString(bool includePass)
- {
- if (includePass)
- return originalConnectionString;
- string connStr = persistConnString.ToString();
- return connStr.Remove(connStr.Length - 1, 1);
- }
+ /// <summary>
+ /// Takes a given connection string and returns it, possible
+ /// stripping out the password info
+ /// </summary>
+ /// <returns></returns>
+ public string GetConnectionString(bool includePass)
+ {
+ if (includePass)
+ return originalConnectionString;
+ string connStr = persistConnString.ToString();
+ return connStr.Remove(connStr.Length - 1, 1);
+ }
- /// <summary>
- /// Clears the contents of the <see cref="MySqlConnectionStringBuilder"/> instance.
- /// </summary>
- public override void Clear()
- {
- base.Clear();
- persistConnString.Remove(0, persistConnString.Length);
- Reset();
- }
+ /// <summary>
+ /// Clears the contents of the <see cref="MySqlConnectionStringBuilder"/> instance.
+ /// </summary>
+ public override void Clear()
+ {
+ base.Clear();
+ persistConnString.Remove(0, persistConnString.Length);
+ Reset();
+ }
- private Keyword GetKey(string key)
- {
- string lowerKey = key.ToLower();
- switch (lowerKey)
- {
- case "uid":
- case "username":
- case "user id":
- case "user name":
- case "userid":
- case "user":
- return Keyword.UserID;
- case "host":
- case "server":
- case "data source":
- case "datasource":
- case "address":
- case "addr":
- case "network address":
- return Keyword.Server;
- case "password":
- case "pwd":
- return Keyword.Password;
- case "useusageadvisor":
- case "usage advisor":
- case "use usage advisor":
- return Keyword.UseUsageAdvisor;
- case "character set":
- case "charset":
- return Keyword.CharacterSet;
- case "use compression":
- case "compress":
- return Keyword.Compress;
- case "pipe name":
- case "pipe":
- return Keyword.PipeName;
- case "logging":
- return Keyword.Logging;
- case "old syntax":
- case "oldsyntax":
- return Keyword.OldSyntax;
- case "allow batch":
- return Keyword.AllowBatch;
- case "convert zero datetime":
- case "convertzerodatetime":
- return Keyword.ConvertZeroDatetime;
- case "persist security info":
- return Keyword.PersistSecurityInfo;
- case "initial catalog":
- case "database":
- return Keyword.Database;
- case "connection timeout":
- case "connect timeout":
- return Keyword.ConnectionTimeout;
- case "port":
- return Keyword.Port;
- case "pooling":
- return Keyword.Pooling;
- case "min pool size":
- case "minimum pool size":
- return Keyword.MinimumPoolSize;
- case "max pool size":
- case "maximum pool size":
- return Keyword.MaximumPoolSize;
- case "connection lifetime":
- return Keyword.ConnectionLifetime;
- case "allow zero datetime":
- case "allowzerodatetime":
- return Keyword.AllowZeroDatetime;
- case "procedure cache size":
- case "procedurecachesize":
- case "procedure cache":
- case "procedurecache":
- return Keyword.ProcedureCacheSize;
- case "connection reset":
- return Keyword.ConnectionReset;
- case "ignore prepare":
- return Keyword.IgnorePrepare;
-#if !CF
- case "shared memory name":
- return Keyword.SharedMemoryName;
- case "useperformancemonitor":
- case "use performance monitor":
- return Keyword.UsePerformanceMonitor;
- case "encrypt":
- return Keyword.UseSSL;
- case "driver":
- return Keyword.DriverType;
- case "protocol":
- return Keyword.Protocol;
-#endif
+ private Keyword GetKey(string key)
+ {
+ string lowerKey = key.ToLower();
+ switch (lowerKey)
+ {
+ case "uid":
+ case "username":
+ case "user id":
+ case "user name":
+ case "userid":
+ case "user":
+ return Keyword.UserID;
+ case "host":
+ case "server":
+ case "data source":
+ case "datasource":
+ case "address":
+ case "addr":
+ case "network address":
+ return Keyword.Server;
+ case "password":
+ case "pwd":
+ return Keyword.Password;
+ case "useusageadvisor":
+ case "usage advisor":
+ case "use usage advisor":
+ return Keyword.UseUsageAdvisor;
+ case "character set":
+ case "charset":
+ return Keyword.CharacterSet;
+ case "use compression":
+ case "compress":
+ return Keyword.Compress;
+ case "pipe name":
+ case "pipe":
+ return Keyword.PipeName;
+ case "logging":
+ return Keyword.Logging;
+ case "old syntax":
+ case "oldsyntax":
+ return Keyword.OldSyntax;
+ case "shared memory name":
+ return Keyword.SharedMemoryName;
+ case "allow batch":
+ return Keyword.AllowBatch;
+ case "convert zero datetime":
+ case "convertzerodatetime":
+ return Keyword.ConvertZeroDatetime;
+ case "persist security info":
+ return Keyword.PersistSecurityInfo;
+ case "initial catalog":
+ case "database":
+ return Keyword.Database;
+ case "connection timeout":
+ case "connect timeout":
+ return Keyword.ConnectionTimeout;
+ case "port":
+ return Keyword.Port;
+ case "pooling":
+ return Keyword.Pooling;
+ case "min pool size":
+ case "minimum pool size":
+ return Keyword.MinimumPoolSize;
+ case "max pool size":
+ case "maximum pool size":
+ return Keyword.MaximumPoolSize;
+ case "connection lifetime":
+ return Keyword.ConnectionLifetime;
+ case "driver":
+ return Keyword.DriverType;
+ case "protocol":
+ return Keyword.Protocol;
+ case "allow zero datetime":
+ case "allowzerodatetime":
+ return Keyword.AllowZeroDatetime;
+ case "useperformancemonitor":
+ case "use performance monitor":
+ return Keyword.UsePerformanceMonitor;
+ case "procedure cache size":
+ case "procedurecachesize":
+ case "procedure cache":
+ case "procedurecache":
+ return Keyword.ProcedureCacheSize;
+ case "connection reset":
+ return Keyword.ConnectionReset;
+ case "ignore prepare":
+ return Keyword.IgnorePrepare;
+ case "encrypt":
+ return Keyword.UseSSL;
+ case "procedure bodies":
+ case "use procedure bodies":
+ return Keyword.UseProcedureBodies;
}
- throw new ArgumentException(Resources.KeywordNotSupported, key);
- }
+ throw new ArgumentException(Resources.KeywordNotSupported, key);
+ }
- private object GetValue(Keyword kw)
- {
- switch (kw)
- {
- case Keyword.UserID: return UserID;
- case Keyword.Password: return Password;
- case Keyword.Port: return Port;
- case Keyword.Server: return Server;
- case Keyword.UseUsageAdvisor: return UseUsageAdvisor;
- case Keyword.CharacterSet: return CharacterSet;
- case Keyword.Compress: return UseCompression;
- case Keyword.PipeName: return PipeName;
- case Keyword.Logging: return Logging;
- case Keyword.OldSyntax: return UseOldSyntax;
- case Keyword.SharedMemoryName: return SharedMemoryName;
- case Keyword.AllowBatch: return AllowBatch;
- case Keyword.ConvertZeroDatetime: return ConvertZeroDateTime;
- case Keyword.PersistSecurityInfo: return PersistSecurityInfo;
- case Keyword.Database: return Database;
- case Keyword.ConnectionTimeout: return ConnectionTimeout;
- case Keyword.Pooling: return Pooling;
- case Keyword.MinimumPoolSize: return MinimumPoolSize;
- case Keyword.MaximumPoolSize: return MaximumPoolSize;
- case Keyword.ConnectionLifetime: return ConnectionLifeTime;
- case Keyword.DriverType: return DriverType;
- case Keyword.Protocol: return ConnectionProtocol;
- case Keyword.ConnectionReset: return ConnectionReset;
- case Keyword.ProcedureCacheSize: return ProcedureCacheSize;
- case Keyword.AllowZeroDatetime: return AllowZeroDateTime;
- case Keyword.UsePerformanceMonitor: return UsePerformanceMonitor;
- case Keyword.IgnorePrepare: return IgnorePrepare;
- case Keyword.UseSSL: return UseSSL;
- default: return null; /* this will never happen */
- }
- }
+ private object GetValue(Keyword kw)
+ {
+ switch (kw)
+ {
+ case Keyword.UserID: return UserID;
+ case Keyword.Password: return Password;
+ case Keyword.Port: return Port;
+ case Keyword.Server: return Server;
+ case Keyword.UseUsageAdvisor: return UseUsageAdvisor;
+ case Keyword.CharacterSet: return CharacterSet;
+ case Keyword.Compress: return UseCompression;
+ case Keyword.PipeName: return PipeName;
+ case Keyword.Logging: return Logging;
+ case Keyword.OldSyntax: return UseOldSyntax;
+ case Keyword.SharedMemoryName: return SharedMemoryName;
+ case Keyword.AllowBatch: return AllowBatch;
+ case Keyword.ConvertZeroDatetime: return ConvertZeroDateTime;
+ case Keyword.PersistSecurityInfo: return PersistSecurityInfo;
+ case Keyword.Database: return Database;
+ case Keyword.ConnectionTimeout: return ConnectionTimeout;
+ case Keyword.Pooling: return Pooling;
+ case Keyword.MinimumPoolSize: return MinimumPoolSize;
+ case Keyword.MaximumPoolSize: return MaximumPoolSize;
+ case Keyword.ConnectionLifetime: return ConnectionLifeTime;
+ case Keyword.DriverType: return DriverType;
+ case Keyword.Protocol: return ConnectionProtocol;
+ case Keyword.ConnectionReset: return ConnectionReset;
+ case Keyword.ProcedureCacheSize: return ProcedureCacheSize;
+ case Keyword.AllowZeroDatetime: return AllowZeroDateTime;
+ case Keyword.UsePerformanceMonitor: return UsePerformanceMonitor;
+ case Keyword.IgnorePrepare: return IgnorePrepare;
+ case Keyword.UseSSL: return UseSSL;
+ case Keyword.UseProcedureBodies: return UseProcedureBodies;
+ default: return null; /* this will never happen */
+ }
+ }
- private void SetValue(Keyword kw, object value)
- {
- switch (kw)
- {
- case Keyword.UserID: UserID = (string)value; break;
- case Keyword.Password: Password = (string)value; break;
- case Keyword.Port: Port = ConvertToUInt(value); break;
- case Keyword.Server: Server = (string)value; break;
- case Keyword.UseUsageAdvisor: UseUsageAdvisor = ConvertToBool(value); break;
- case Keyword.CharacterSet: CharacterSet = (string)value; break;
- case Keyword.Compress: UseCompression = ConvertToBool(value); break;
- case Keyword.PipeName: PipeName = (string)value; break;
- case Keyword.Logging: Logging = ConvertToBool(value); break;
- case Keyword.OldSyntax: UseOldSyntax = ConvertToBool(value); break;
- case Keyword.SharedMemoryName: SharedMemoryName = (string)value; break;
- case Keyword.AllowBatch: AllowBatch = ConvertToBool(value); break;
- case Keyword.ConvertZeroDatetime: ConvertZeroDateTime = ConvertToBool(value); break;
- case Keyword.PersistSecurityInfo: PersistSecurityInfo = ConvertToBool(value); break;
- case Keyword.Database: Database = (string)value; break;
- case Keyword.ConnectionTimeout: ConnectionTimeout = ConvertToUInt(value); break;
- case Keyword.Pooling: Pooling = ConvertToBool(value); break;
- case Keyword.MinimumPoolSize: MinimumPoolSize = ConvertToUInt(value); break;
- case Keyword.MaximumPoolSize: MaximumPoolSize = ConvertToUInt(value); break;
- case Keyword.ConnectionLifetime: ConnectionLifeTime = ConvertToUInt(value); break;
- case Keyword.DriverType: DriverType = ConvertToDriverType(value); break;
- case Keyword.Protocol: ConnectionProtocol = ConvertToProtocol(value); break;
- case Keyword.ConnectionReset: ConnectionReset = ConvertToBool(value); break;
- case Keyword.UsePerformanceMonitor: UsePerformanceMonitor = ConvertToBool(value); break;
- case Keyword.AllowZeroDatetime: AllowZeroDateTime = ConvertToBool(value); break;
- case Keyword.ProcedureCacheSize: ProcedureCacheSize = ConvertToUInt(value); break;
- case Keyword.IgnorePrepare: IgnorePrepare = ConvertToBool(value); break;
- case Keyword.UseSSL: UseSSL = ConvertToBool(value); break;
- }
- }
+ private void SetValue(Keyword kw, object value)
+ {
+ switch (kw)
+ {
+ case Keyword.UserID: UserID = (string)value; break;
+ case Keyword.Password: Password = (string)value; break;
+ case Keyword.Port: Port = ConvertToUInt(value); break;
+ case Keyword.Server: Server = (string)value; break;
+ case Keyword.UseUsageAdvisor: UseUsageAdvisor = ConvertToBool(value); break;
+ case Keyword.CharacterSet: CharacterSet = (string)value; break;
+ case Keyword.Compress: UseCompression = ConvertToBool(value); break;
+ case Keyword.PipeName: PipeName = (string)value; break;
+ case Keyword.Logging: Logging = ConvertToBool(value); break;
+ case Keyword.OldSyntax: UseOldSyntax = ConvertToBool(value); break;
+ case Keyword.SharedMemoryName: SharedMemoryName = (string)value; break;
+ case Keyword.AllowBatch: AllowBatch = ConvertToBool(value); break;
+ case Keyword.ConvertZeroDatetime: ConvertZeroDateTime = ConvertToBool(value); break;
+ case Keyword.PersistSecurityInfo: PersistSecurityInfo = ConvertToBool(value); break;
+ case Keyword.Database: Database = (string)value; break;
+ case Keyword.ConnectionTimeout: ConnectionTimeout = ConvertToUInt(value); break;
+ case Keyword.Pooling: Pooling = ConvertToBool(value); break;
+ case Keyword.MinimumPoolSize: MinimumPoolSize = ConvertToUInt(value); break;
+ case Keyword.MaximumPoolSize: MaximumPoolSize = ConvertToUInt(value); break;
+ case Keyword.ConnectionLifetime: ConnectionLifeTime = ConvertToUInt(value); break;
+ case Keyword.DriverType: DriverType = ConvertToDriverType(value); break;
+ case Keyword.Protocol: ConnectionProtocol = ConvertToProtocol(value); break;
+ case Keyword.ConnectionReset: ConnectionReset = ConvertToBool(value); break;
+ case Keyword.UsePerformanceMonitor: UsePerformanceMonitor = ConvertToBool(value); break;
+ case Keyword.AllowZeroDatetime: AllowZeroDateTime = ConvertToBool(value); break;
+ case Keyword.ProcedureCacheSize: ProcedureCacheSize = ConvertToUInt(value); break;
+ case Keyword.IgnorePrepare: IgnorePrepare = ConvertToBool(value); break;
+ case Keyword.UseSSL: UseSSL = ConvertToBool(value); break;
+ case Keyword.UseProcedureBodies: UseProcedureBodies = ConvertToBool(value); break;
+ }
+ }
/// <summary>
/// Gets or sets the value associated with the specified key. In C#, this property
@@ -848,35 +863,49 @@
}
}
- internal enum Keyword
- {
- UserID,
- Password,
- Server,
- Port,
- UseUsageAdvisor,
- CharacterSet,
- Compress,
- PipeName,
- Logging,
- OldSyntax,
- SharedMemoryName,
- AllowBatch,
- ConvertZeroDatetime,
- PersistSecurityInfo,
- Database,
- ConnectionTimeout,
- Pooling,
- MinimumPoolSize,
- MaximumPoolSize,
- ConnectionLifetime,
- DriverType,
- Protocol,
- ConnectionReset,
- AllowZeroDatetime,
- UsePerformanceMonitor,
- ProcedureCacheSize,
- IgnorePrepare,
- UseSSL
- }
+ internal enum Keyword
+ {
+ UserID,
+ Password,
+ Server,
+ Port,
+ UseUsageAdvisor,
+ CharacterSet,
+ Compress,
+ PipeName,
+ Logging,
+ OldSyntax,
+ SharedMemoryName,
+ AllowBatch,
+ ConvertZeroDatetime,
+ PersistSecurityInfo,
+ Database,
+ ConnectionTimeout,
+ Pooling,
+ MinimumPoolSize,
+ MaximumPoolSize,
+ ConnectionLifetime,
+ DriverType,
+ Protocol,
+ ConnectionReset,
+ AllowZeroDatetime,
+ UsePerformanceMonitor,
+ ProcedureCacheSize,
+ IgnorePrepare,
+ UseSSL,
+ UseProcedureBodies
+ }
+
+/* internal class ProtocolConverter : TypeConverter.StringConverter
+ {
+ public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+ {
+ return true;
+ }
+
+ public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+ {
+ return new StandardValuesCollection(new string[] { "Sockets", "NamedPipe", "UnixSocket", "SharedMemory" });
+ }
+ }*/
}
Modified: trunk/Driver/Source/MySqlError.cs
===================================================================
--- trunk/Driver/Source/MySqlError.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlError.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/MySqlHelper.cs
===================================================================
--- trunk/Driver/Source/MySqlHelper.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlHelper.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/MySqlPool.cs
===================================================================
--- trunk/Driver/Source/MySqlPool.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlPool.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -22,6 +22,8 @@
using MySql.Data.Common;
using System.Collections;
using System.Collections.Generic;
+using System.Diagnostics;
+using System.Threading;
namespace MySql.Data.MySqlClient
{
@@ -41,11 +43,15 @@
private uint minSize;
private uint maxSize;
private ProcedureCache procedureCache;
+ private Object lockObject;
+ private Semaphore poolGate;
public MySqlPool(MySqlConnectionStringBuilder settings)
{
minSize = settings.MinimumPoolSize;
maxSize = settings.MaximumPoolSize;
+ if (minSize > maxSize)
+ minSize = maxSize;
this.settings = settings;
#if NET20
inUsePool = new List<Driver>((int)maxSize);
@@ -60,9 +66,15 @@
CreateNewPooledConnection();
procedureCache = new ProcedureCache((int)settings.ProcedureCacheSize);
- }
+ poolGate = new Semaphore((int)maxSize, (int)maxSize);
- public MySqlConnectionStringBuilder Settings
+ // we don't really need to create this but it makes the code a bit cleaner
+ lockObject = new Object();
+ }
+
+ #region Properties
+
+ public MySqlConnectionStringBuilder Settings
{
get { return settings; }
set { settings = value; }
@@ -73,94 +85,106 @@
get { return procedureCache; }
}
-/* private int CheckConnections()
- {
- int freed = 0;
- lock (inUsePool.SyncRoot)
- {
- for (int i=inUsePool.Count-1; i >= 0; i--)
- {
- Driver d = (inUsePool[i] as Driver);
- if (! d.Ping())
- {
- inUsePool.RemoveAt(i);
- freed++;
- }
- }
- }
- return freed;
- }
-*/
+ /// <summary>
+ /// It is assumed that this property will only be used from inside an active
+ /// lock.
+ /// </summary>
+ private bool HasIdleConnections
+ {
+ get { return idlePool.Count > 0; }
+ }
+
+ /// <summary>
+ /// It is assumed that this property will only be used from inside an active
+ /// lock.
+ /// </summary>
+ private bool HasRoomForConnections
+ {
+ get
+ {
+ if ((inUsePool.Count + idlePool.Count) == maxSize)
+ return false;
+ return true;
+ }
+
+ }
+
+ #endregion
+
+ /// <summary>
+ /// CheckoutConnection handles the process of pulling a driver
+ /// from the idle pool, possibly resetting its state,
+ /// and adding it to the in use pool. We assume that this method is only
+ /// called inside an active lock so there is no need to acquire a new lock.
+ /// </summary>
+ /// <returns>An idle driver object</returns>
private Driver CheckoutConnection()
{
- lock((idlePool as ICollection).SyncRoot)
- {
- if (idlePool.Count == 0) return null;
- Driver driver = (Driver)idlePool.Dequeue();
+ Driver driver = (Driver)idlePool.Dequeue();
- // if the user asks us to ping/reset pooled connections
- // do so now
- if (settings.ConnectionReset)
- {
- if (!driver.Ping())
- {
- driver.Close();
- return null;
- }
- driver.Reset();
- }
+ // first check to see that the server is still alive
+ if (!driver.Ping())
+ {
+ driver.Close();
+ return null;
+ }
- lock ((inUsePool as ICollection).SyncRoot)
- {
- inUsePool.Add(driver);
- }
- return driver;
- }
+ // if the user asks us to ping/reset pooled connections
+ // do so now
+ if (settings.ConnectionReset)
+ driver.Reset();
+
+ inUsePool.Add(driver);
+
+ return driver;
}
- private Driver GetPooledConnection()
+ /// <summary>
+ /// It is assumed that this method is only called from inside an active lock.
+ /// </summary>
+ private Driver GetPooledConnection()
{
- while (true)
- {
- if (idlePool.Count > 0)
- return CheckoutConnection();
+ while (true)
+ {
+ // if we don't have an idle connection but we have room for a new
+ // one, then create it here.
+ if (!HasIdleConnections)
+ CreateNewPooledConnection();
- // if idlepool == 0 and inusepool == max, then we can't create a new one
- if (inUsePool.Count == maxSize)
- return null;
-
- CreateNewPooledConnection();
- }
+ Driver d = CheckoutConnection();
+ if (d != null)
+ return d;
+ }
}
+ /// <summary>
+ /// It is assumed that this method is only called from inside an active lock.
+ /// </summary>
private void CreateNewPooledConnection()
{
- lock ((idlePool as ICollection).SyncRoot)
- lock ((inUsePool as ICollection).SyncRoot)
- {
- // first we check if we are allowed to create another
- if ((inUsePool.Count + idlePool.Count) == maxSize)
- return;
-
- Driver driver = Driver.Create(settings);
-
- idlePool.Enqueue(driver);
- }
+ Driver driver = Driver.Create(settings);
+ idlePool.Enqueue(driver);
}
public void ReleaseConnection(Driver driver)
{
- lock ((idlePool as ICollection).SyncRoot)
- lock ((inUsePool as ICollection).SyncRoot)
- {
- inUsePool.Remove(driver);
- if (driver.IsTooOld())
- driver.Close();
- else
- idlePool.Enqueue(driver);
- }
- }
+ lock (lockObject)
+ {
+ if (!inUsePool.Contains(driver))
+ return;
+ inUsePool.Remove(driver);
+ if (driver.IsTooOld())
+ driver.Close();
+ else
+ idlePool.Enqueue(driver);
+
+ // we now either have a connection available or have room to make
+ // one so we release one slot in our semaphore
+ poolGate.Release();
+ }
+ }
+
/// <summary>
/// Removes a connection from the in use pool. The only situations where this method
/// would be called are when a connection that is in use gets some type of fatal exception
@@ -170,32 +194,31 @@
/// <param name="driver"></param>
public void RemoveConnection(Driver driver)
{
- lock ((inUsePool as ICollection).SyncRoot)
+ lock (lockObject)
{
- inUsePool.Remove(driver);
+ if (inUsePool.Contains(driver))
+ {
+ inUsePool.Remove(driver);
+ poolGate.Release();
+ }
}
}
public Driver GetConnection()
{
- Driver driver = null;
+ int ticks = (int)settings.ConnectionTimeout * 1000;
- int start = Environment.TickCount;
- uint ticks = settings.ConnectionTimeout * 1000;
+ // wait till we are allowed in
+ bool allowed = poolGate.WaitOne(ticks, false);
+ if (! allowed)
+ throw new MySqlException(Resources.TimeoutGettingConnection);
- // wait timeOut seconds at most to get a connection
- while (driver == null && (Environment.TickCount - start) < ticks)
- driver = GetPooledConnection();
-
- // if pool size is at maximum, then we must have reached our timeout so we simply
- // throw our exception
- if (driver == null)
- throw new MySqlException("error connecting: Timeout expired. The timeout period elapsed " +
- "prior to obtaining a connection from the pool. This may have occurred because all " +
- "pooled connections were in use and max pool size was reached.");
-
- return driver;
+ // if we get here, then it means that we either have an idle connection
+ // or room to make a new connection
+ lock (lockObject)
+ {
+ return GetPooledConnection();
+ }
}
-
}
}
Modified: trunk/Driver/Source/MySqlPoolManager.cs
===================================================================
--- trunk/Driver/Source/MySqlPoolManager.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlPoolManager.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/MySqlPromotableTransaction.cs
===================================================================
--- trunk/Driver/Source/MySqlPromotableTransaction.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlPromotableTransaction.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/MySqlStream.cs
===================================================================
--- trunk/Driver/Source/MySqlStream.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MySqlStream.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/MysqlDefs.cs
===================================================================
--- trunk/Driver/Source/MysqlDefs.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/MysqlDefs.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -19,6 +19,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
using System;
+using System.ComponentModel;
namespace MySql.Data.MySqlClient
{
Modified: trunk/Driver/Source/NativeDriver.cs
===================================================================
--- trunk/Driver/Source/NativeDriver.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/NativeDriver.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/PerformanceMonitor.cs
===================================================================
--- trunk/Driver/Source/PerformanceMonitor.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/PerformanceMonitor.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/PreparableStatement.cs
===================================================================
--- trunk/Driver/Source/PreparableStatement.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/PreparableStatement.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -36,8 +36,8 @@
private int pageSize;
private int statementId;
- public PreparableStatement(MySqlConnection connection, string text)
- : base(connection, text)
+ public PreparableStatement(MySqlCommand command, string text)
+ : base(command, text)
{
pageSize = 0;
statementId = 0;
@@ -68,17 +68,14 @@
#endregion
- public virtual void Prepare(MySqlParameterCollection parameters)
+ public virtual void Prepare()
{
- // store our parameters.
- this.parameters = parameters;
-
// strip out names from parameter markers
string text;
ArrayList parameter_names = PrepareCommandText(out text);
// ask our connection to send the prepare command
- statementId = driver.PrepareStatement(text, ref paramList);
+ statementId = Driver.PrepareStatement(text, ref paramList);
// now we need to assign our field names since we stripped them out
// for the prepare
@@ -86,20 +83,20 @@
paramList[i].ColumnName = (string)parameter_names[i];
}
- public override void Execute(MySqlParameterCollection parameters)
+ public override void Execute()
{
// if we are not prepared, then call down to our base
if (!IsPrepared)
{
- base.Execute(parameters);
+ base.Execute();
return;
}
- MySqlStream stream = new MySqlStream(driver.Encoding);
+ MySqlStream stream = new MySqlStream(Driver.Encoding);
//TODO: support long data here
// create our null bitmap
- BitArray nullMap = new BitArray(parameters.Count);
+ BitArray nullMap = new BitArray(Parameters.Count);
// now we run through the parameters that PREPARE sent back and use
// those names to index into the parameters the user gave us.
@@ -108,11 +105,11 @@
if (paramList != null)
for (int x = 0; x < paramList.Length; x++)
{
- MySqlParameter p = parameters[paramList[x].ColumnName];
+ MySqlParameter p = Parameters[paramList[x].ColumnName];
if (p.Value == DBNull.Value || p.Value == null)
nullMap[x] = true;
}
- byte[] nullMapBytes = new byte[(parameters.Count + 7) / 8];
+ byte[] nullMapBytes = new byte[(Parameters.Count + 7) / 8];
// we check this because Mono doesn't ignore the case where nullMapBytes
// is zero length.
@@ -135,18 +132,18 @@
{
foreach (MySqlField param in paramList)
{
- MySqlParameter parm = parameters[param.ColumnName];
+ MySqlParameter parm = Parameters[param.ColumnName];
stream.WriteInteger((long)parm.GetPSType(), 2);
}
// now write out all non-null values
foreach (MySqlField param in paramList)
{
- int index = parameters.IndexOf(param.ColumnName);
+ int index = Parameters.IndexOf(param.ColumnName);
if (index == -1)
throw new MySqlException("Parameter '" + param.ColumnName +
"' is not defined.");
- MySqlParameter parm = parameters[index];
+ MySqlParameter parm = Parameters[index];
if (parm.Value == DBNull.Value || parm.Value == null)
continue;
@@ -157,7 +154,7 @@
executionCount++;
- driver.ExecuteStatement(stream.InternalBuffer.ToArray());
+ Driver.ExecuteStatement(stream.InternalBuffer.ToArray());
}
public override bool ExecuteNext()
@@ -188,12 +185,12 @@
foreach (string token in tokens)
{
- if (token[0] != connection.ParameterMarker)
+ if (token[0] != Connection.ParameterMarker)
newSQL.Append(token);
else
{
parameterMap.Add(token);
- newSQL.Append(connection.ParameterMarker);
+ newSQL.Append(Connection.ParameterMarker);
}
}
Modified: trunk/Driver/Source/ProcedureCache.cs
===================================================================
--- trunk/Driver/Source/ProcedureCache.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/ProcedureCache.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Resources.Designer.cs
===================================================================
--- trunk/Driver/Source/Resources.Designer.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Resources.Designer.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -357,6 +357,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to When calling stored procedures and 'Use Procedure Bodies' is false, all parameters must have their type explicitly set..
+ /// </summary>
+ internal static string NoBodiesAndTypeNotSet {
+ get {
+ return ResourceManager.GetString("NoBodiesAndTypeNotSet", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Nested transactions are not supported..
/// </summary>
internal static string NoNestedTransactions {
@@ -392,6 +401,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Parameter '{0}' has already been defined..
+ /// </summary>
+ internal static string ParameterAlreadyDefined {
+ get {
+ return ResourceManager.GetString("ParameterAlreadyDefined", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Parameter cannot have a negative value.
/// </summary>
internal static string ParameterCannotBeNegative {
@@ -419,6 +437,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to Parameter '{0}' must be defined..
+ /// </summary>
+ internal static string ParameterMustBeDefined {
+ get {
+ return ResourceManager.GetString("ParameterMustBeDefined", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Password must be valid and contain length characters.
/// </summary>
internal static string PasswordMustHaveLegalChars {
@@ -572,6 +599,15 @@
}
/// <summary>
+ /// Looks up a localized string similar to error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached..
+ /// </summary>
+ internal static string TimeoutGettingConnection {
+ get {
+ return ResourceManager.GetString("TimeoutGettingConnection", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Unable to connect to any of the specified MySQL hosts..
/// </summary>
internal static string UnableToConnectToHost {
@@ -599,7 +635,7 @@
}
/// <summary>
- /// Looks up a localized string similar to Unable to retrieve stored procedure metadata. Either grant SELECTprivilege to mysql.proc for this user or use "noAccessToProcedureBody=true" with your connection string..
+ /// Looks up a localized string similar to Unable to retrieve stored procedure metadata. Either grant SELECTprivilege to mysql.proc for this user or use "use procedure bodies=false" with your connection string..
/// </summary>
internal static string UnableToRetrieveSProcData {
get {
Modified: trunk/Driver/Source/Resources.resx
===================================================================
--- trunk/Driver/Source/Resources.resx 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Resources.resx 2007-03-01 21:03:34 UTC (rev 624)
@@ -301,11 +301,23 @@
<value>Unable to connect to any of the specified MySQL hosts.</value>
</data>
<data name="UnableToRetrieveSProcData" xml:space="preserve">
- <value>Unable to retrieve stored procedure metadata. Either grant SELECTprivilege to mysql.proc for this user or use "noAccessToProcedureBody=true" with your connection string.</value>
+ <value>Unable to retrieve stored procedure metadata. Either grant SELECTprivilege to mysql.proc for this user or use "use procedure bodies=false" with your connection string.</value>
</data>
<data name="NextResultIsClosed" xml:space="preserve">
<value>Invalid attempt to call NextResult when the reader is closed.</value>
</data>
+ <data name="NoBodiesAndTypeNotSet" xml:space="preserve">
+ <value>When calling stored procedures and 'Use Procedure Bodies' is false, all parameters must have their type explicitly set.</value>
+ </data>
+ <data name="TimeoutGettingConnection" xml:space="preserve">
+ <value>error connecting: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.</value>
+ </data>
+ <data name="ParameterAlreadyDefined" xml:space="preserve">
+ <value>Parameter '{0}' has already been defined.</value>
+ </data>
+ <data name="ParameterMustBeDefined" xml:space="preserve">
+ <value>Parameter '{0}' must be defined.</value>
+ </data>
<data name="ObjectDisposed" xml:space="preserve">
<value>The object is not open or has been disposed.</value>
</data>
Modified: trunk/Driver/Source/SchemaProvider.cs
===================================================================
--- trunk/Driver/Source/SchemaProvider.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/SchemaProvider.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -58,7 +58,7 @@
public virtual DataTable GetDatabases(string[] restrictions)
{
string sql = "SHOW DATABASES";
- if (restrictions != null && restrictions.Length == 1)
+ if (restrictions != null && restrictions.Length >= 1)
sql = sql + " LIKE '" + restrictions[0] + "'";
MySqlDataAdapter da = new MySqlDataAdapter(sql, connection);
DataTable dt = new DataTable();
@@ -105,20 +105,25 @@
// we have to new up a new restriction array here since
// GetDatabases takes the database in the first slot
- string[] dbRestriction = new string[1] { restrictions[1] };
+ string[] dbRestriction = new string[4];
+ if (restrictions != null && restrictions.Length >= 2)
+ dbRestriction[0] = restrictions[1];
DataTable databases = GetDatabases(dbRestriction);
+ if (restrictions != null)
+ Array.Copy(restrictions, dbRestriction, dbRestriction.Length);
+
foreach (DataRow db in databases.Rows)
{
- restrictions[1] = db["SCHEMA_NAME"].ToString();
- string table_type = restrictions[1].ToLower() == "information_schema" ?
+ dbRestriction[1] = db["SCHEMA_NAME"].ToString();
+ string table_type = dbRestriction[1].ToLower() == "information_schema" ?
"SYSTEM VIEW" : "BASE TABLE";
- DataTable tables = FindTables(restrictions);
+ DataTable tables = FindTables(dbRestriction);
foreach (DataRow table in tables.Rows)
{
DataRow row = dt.NewRow();
row["TABLE_CATALOG"] = null;
- row["TABLE_SCHEMA"] = restrictions[1];
+ row["TABLE_SCHEMA"] = dbRestriction[1];
row["TABLE_NAME"] = table[0];
row["TABLE_TYPE"] = table_type;
row["ENGINE"] = table[1];
@@ -360,16 +365,19 @@
// first we use our restrictions to get a list of tables that should be
// consulted. We save the keyname restriction since GetTables doesn't
// understand that.
- string keyName = restrictions[3];
- restrictions[3] = null;
+ string keyName = null;
+ if (restrictions != null && restrictions.Length >= 4)
+ {
+ keyName = restrictions[3];
+ restrictions[3] = null;
+ }
+
DataTable tables = GetTables(restrictions);
// now for each table retrieved, we call our helper function to
// parse it's foreign keys
foreach (DataRow table in tables.Rows)
- {
GetForeignKeysOnTable(dt, table, keyName);
- }
return dt;
}
@@ -582,7 +590,7 @@
connection.Settings.UseOldSyntax ? "@" : "?");
row["ParameterNameMaxLength"] = 128;
row["ParameterNamePattern"] = @"^[\p{Lo}\p{Lu}\p{Ll}\p{Lm}_@#][\p{Lo}\p{Lu}\p{Ll}\p{Lm}\p{Nd}\uff3f_@#\$]*(?=\s+|$)";
- row["QuotedIdentifierPattern"] = @"(([^\[]|\]\])*)";
+ row["QuotedIdentifierPattern"] = @"(([^\`]|\`\`)*)";
row["QuotedIdentifierCase"] = IdentifierCase.Insensitive;
row["StatementSeparatorPattern"] = ";";
row["StringLiteralPattern"] = "'(([^']|'')*)'";
Modified: trunk/Driver/Source/Statement.cs
===================================================================
--- trunk/Driver/Source/Statement.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Statement.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -27,20 +27,17 @@
{
internal abstract class Statement
{
- protected MySqlConnection connection;
- protected Driver driver;
+ protected MySqlCommand command;
protected string commandText;
private ArrayList buffers;
- protected MySqlParameterCollection parameters;
- private Statement(MySqlConnection connection)
+ private Statement(MySqlCommand cmd)
{
- this.connection = connection;
- this.driver = connection.driver;
+ command = cmd;
buffers = new ArrayList();
}
- public Statement(MySqlConnection connection, string text) : this(connection)
+ public Statement(MySqlCommand cmd, string text) : this(cmd)
{
commandText = text;
}
@@ -52,6 +49,21 @@
get { return commandText; }
}
+ protected Driver Driver
+ {
+ get { return command.Connection.driver; }
+ }
+
+ protected MySqlConnection Connection
+ {
+ get { return command.Connection; }
+ }
+
+ protected MySqlParameterCollection Parameters
+ {
+ get { return command.Parameters; }
+ }
+
#endregion
public virtual void Close()
@@ -62,10 +74,8 @@
{
}
- public virtual void Execute(MySqlParameterCollection parameters)
+ public virtual void Execute()
{
- this.parameters = parameters;
-
// we keep a reference to this until we are done
BindParameters();
ExecuteNext();
@@ -77,7 +87,7 @@
return false;
MemoryStream ms = (MemoryStream)buffers[0];
- driver.Query(ms.GetBuffer(), (int)ms.Length);
+ Driver.Query(ms.GetBuffer(), (int)ms.Length);
buffers.RemoveAt(0);
return true;
}
@@ -87,8 +97,8 @@
// tokenize the sql
ArrayList tokenArray = TokenizeSql(ResolvedCommandText);
- MySqlStream stream = new MySqlStream(driver.Encoding);
- stream.Version = driver.Version;
+ MySqlStream stream = new MySqlStream(Driver.Encoding);
+ stream.Version = Driver.Version;
// make sure our token array ends with a ;
string lastToken = (string)tokenArray[tokenArray.Count - 1];
@@ -102,12 +112,12 @@
if (token == ";")
{
buffers.Add(stream.InternalBuffer);
- stream = new MySqlStream(driver.Encoding);
+ stream = new MySqlStream(Driver.Encoding);
continue;
}
- if (token[0] == parameters.ParameterMarker)
+ if (token[0] == Parameters.ParameterMarker)
{
- if (SerializeParameter(parameters, stream, token))
+ if (SerializeParameter(Parameters, stream, token))
continue;
}
@@ -117,6 +127,27 @@
}
/// <summary>
+ /// We use a separate method here because we want to support using parameter
+ /// names with and without a leading marker but we don't want the indexing
+ /// methods of MySqlParameterCollection to support that.
+ /// </summary>
+ /// <param name="name"></param>
+ /// <returns></returns>
+ private MySqlParameter GetParameter(MySqlParameterCollection parameters, string name)
+ {
+ string parmName = name;
+ int index = parameters.IndexOf(name);
+ if (index == -1)
+ {
+ name = name.Substring(1);
+ index = Parameters.IndexOf(name);
+ if (index == -1)
+ return null;
+ }
+ return parameters[index];
+ }
+
+ /// <summary>
/// Serializes the given parameter to the given memory stream
/// </summary>
/// <remarks>
@@ -128,16 +159,17 @@
private bool SerializeParameter(MySqlParameterCollection parameters,
MySqlStream stream, string parmName)
{
- int index = parameters.IndexOf(parmName);
- if (index == -1)
+ MySqlParameter parameter = GetParameter(parameters, parmName);
+ if (parameter == null)
{
// if we are using old syntax, we can't throw exceptions for parameters
// not defined.
- if (connection.Settings.UseOldSyntax)
+ if (Connection.Settings.UseOldSyntax)
return false;
- throw new MySqlException("Parameter '" + parmName + "' must be defined");
+ throw new MySqlException(
+ String.Format(Resources.ParameterMustBeDefined));
}
- MySqlParameter parameter = parameters[index];
+
parameter.Serialize(stream, false);
return true;
}
@@ -153,7 +185,7 @@
/// </remarks>
public ArrayList TokenizeSql(string sql)
{
- bool batch = connection.Settings.AllowBatch & driver.SupportsBatch;
+ bool batch = Connection.Settings.AllowBatch & Driver.SupportsBatch;
char delim = Char.MinValue;
StringBuilder sqlPart = new StringBuilder();
bool escaped = false;
@@ -203,15 +235,15 @@
delim = c;
else if (c == '\\')
escaped = !escaped;
- else if (c == connection.ParameterMarker && delim == Char.MinValue && !escaped)
+ else if (c == Connection.ParameterMarker && delim == Char.MinValue && !escaped)
{
tokens.Add(sqlPart.ToString());
sqlPart.Remove(0, sqlPart.Length);
}
- else if (sqlPart.Length > 0 && sqlPart[0] == connection.ParameterMarker &&
+ else if (sqlPart.Length > 0 && sqlPart[0] == Connection.ParameterMarker &&
!Char.IsLetterOrDigit(c) && c != '_' && c != '.' && c != '$' &&
- ((c != '@' && c != connection.ParameterMarker) &&
- (c != '?' && c != connection.ParameterMarker)))
+ ((c != '@' && c != Connection.ParameterMarker) &&
+ (c != '?' && c != Connection.ParameterMarker)))
{
tokens.Add(sqlPart.ToString());
sqlPart.Remove(0, sqlPart.Length);
Modified: trunk/Driver/Source/StoredProcedure.cs
===================================================================
--- trunk/Driver/Source/StoredProcedure.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/StoredProcedure.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -37,19 +37,17 @@
private DataTable parametersTable;
private string resolvedCommandText;
- public StoredProcedure(MySqlConnection connection, string text)
- :
- base(connection, text)
+ public StoredProcedure(MySqlCommand cmd, string text)
+ : base(cmd, text)
{
uint code = (uint)DateTime.Now.GetHashCode();
hash = code.ToString();
- this.connection = connection;
}
private string GetReturnParameter()
{
- if (parameters != null)
- foreach (MySqlParameter p in parameters)
+ if (Parameters != null)
+ foreach (MySqlParameter p in Parameters)
if (p.Direction == ParameterDirection.ReturnValue)
{
string pName = p.ParameterName.Substring(1);
@@ -63,15 +61,68 @@
get { return resolvedCommandText; }
}
+ private DataSet GetParameters(string procName)
+ {
+ // if we can use mysql.proc, then do so
+ if (Connection.Settings.UseProcedureBodies)
+ return Connection.ProcedureCache.GetProcedure(Connection, procName);
+
+ // we can't use mysql.proc so we attempt to "make do"
+ DataSet ds = new DataSet();
+ string[] restrictions = new string[4];
+ int dotIndex = procName.IndexOf('.');
+ restrictions[1] = procName.Substring(0, dotIndex++);
+ restrictions[2] = procName.Substring(dotIndex, procName.Length - dotIndex);
+ ds.Tables.Add(Connection.GetSchema("procedures", restrictions));
+
+ // we use an internal method to create our procedure parameters table. We pass
+ // in a non-null routines table and this will prevent the code from attempting
+ // a show create. It will process zero routine records but will return an empty
+ // parameters table we can then fill.
+ DataTable zeroRoutines = new DataTable();
+ ISSchemaProvider sp = new ISSchemaProvider(Connection);
+ DataTable pTable = sp.GetProcedureParameters(null, zeroRoutines);
+ pTable.TableName = "procedure parameters";
+ ds.Tables.Add(pTable);
+
+ // now we run through the parameters that were set and fill in the parameters table
+ // the best we can
+ int pos = 1;
+ foreach (MySqlParameter p in command.Parameters)
+ {
+ // in this mode, all parameters must have their type set
+ if (!p.TypeHasBeenSet)
+ throw new InvalidOperationException(Resources.NoBodiesAndTypeNotSet);
+
+ DataRow row = pTable.NewRow();
+ row["PARAMETER_NAME"] = p.ParameterName;
+ row["PARAMETER_MODE"] = "IN";
+ if (p.Direction == ParameterDirection.InputOutput)
+ row["PARAMETER_MODE"] = "INOUT";
+ else if (p.Direction == ParameterDirection.Output)
+ row["PARAMETER_MODE"] = "OUT";
+ else if (p.Direction == ParameterDirection.ReturnValue)
+ {
+ row["PARAMETER_MODE"] = "OUT";
+ row["ORDINAL_POSITION"] = 0;
+ }
+ else
+ row["ORDINAL_POSITION"] = pos++;
+ pTable.Rows.Add(row);
+ }
+ return ds;
+ }
+
public override void Resolve()
{
// first retrieve the procedure definition from our
// procedure cache
string spName = commandText;
if (spName.IndexOf(".") == -1)
- spName = connection.Database + "." + spName;
- DataSet ds = connection.ProcedureCache.GetProcedure(connection, spName);
+ spName = Connection.Database + "." + spName;
+ DataSet ds = GetParameters(spName);
+
DataTable procTable = ds.Tables["procedures"];
parametersTable = ds.Tables["procedure parameters"];
@@ -85,16 +136,16 @@
if (param["ORDINAL_POSITION"].Equals(0)) continue;
string mode = (string)param["PARAMETER_MODE"];
string pName = (string)param["PARAMETER_NAME"];
- string datatype = (string)param["DATA_TYPE"];
// make sure the parameters given to us have an appropriate
// type set if it's not already
- MySqlParameter p = parameters[pName];
+ MySqlParameter p = command.Parameters[pName];
if (!p.TypeHasBeenSet)
{
- bool unsigned = param["FLAGS"].ToString().IndexOf("UNSIGNED") != -1;
+ string datatype = (string)param["DATA_TYPE"];
+ bool unsigned = param["FLAGS"].ToString().IndexOf("UNSIGNED") != -1;
bool real_as_float = procTable.Rows[0]["SQL_MODE"].ToString().IndexOf("REAL_AS_FLOAT") != -1;
- p.MySqlDbType = MetaData.NameToType(datatype, unsigned, real_as_float, connection);
+ p.MySqlDbType = MetaData.NameToType(datatype, unsigned, real_as_float, Connection);
}
string basePName = pName.Substring(1);
@@ -143,9 +194,9 @@
{
if (outSelect.Length == 0) return;
- char marker = connection.ParameterMarker;
+ char marker = Connection.ParameterMarker;
- MySqlCommand cmd = new MySqlCommand("SELECT " + outSelect, connection);
+ MySqlCommand cmd = new MySqlCommand("SELECT " + outSelect, Connection);
MySqlDataReader reader = cmd.ExecuteReader();
// since MySQL likes to return user variables as strings
@@ -156,7 +207,7 @@
{
string fieldName = reader.GetName(i);
fieldName = marker + fieldName.Remove(0, hash.Length + 1);
- reader.values[i] = MySqlField.GetIMySqlValue(parameters[fieldName].MySqlDbType, true);
+ reader.values[i] = MySqlField.GetIMySqlValue(Parameters[fieldName].MySqlDbType, true);
}
reader.Read();
@@ -164,7 +215,7 @@
{
string fieldName = reader.GetName(i);
fieldName = marker + fieldName.Remove(0, hash.Length + 1);
- parameters[fieldName].Value = reader.GetValue(i);
+ Parameters[fieldName].Value = reader.GetValue(i);
}
reader.Close();
}
Modified: trunk/Driver/Source/Types/MetaData.cs
===================================================================
--- trunk/Driver/Source/Types/MetaData.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MetaData.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlBinary.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlBinary.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlBinary.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -99,17 +99,17 @@
if (val is System.Byte[])
buffToWrite = (byte[])val;
- else if (val is String)
+ else if (val is Char[])
+ buffToWrite = stream.Encoding.GetBytes(val as char[]);
+ else
{
- string s = (val as string);
+ string s = val.ToString();
if (length == 0)
length = s.Length;
else
s = s.Substring(0, length);
buffToWrite = stream.Encoding.GetBytes(s);
}
- else if (val is Char[])
- buffToWrite = stream.Encoding.GetBytes(val as char[]);
// we assume zero length means write all of the value
if (length == 0)
Modified: trunk/Driver/Source/Types/MySqlBit.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlBit.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlBit.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlByte.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlByte.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlByte.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlConversionException.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlConversionException.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlConversionException.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -25,7 +25,8 @@
/// <summary>
/// Summary description for MySqlConversionException.
/// </summary>
- public class MySqlConversionException : ApplicationException
+ [Serializable]
+ public class MySqlConversionException : Exception
{
/// <summary>Ctor</summary>
public MySqlConversionException(string msg)
Modified: trunk/Driver/Source/Types/MySqlDateTime.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlDateTime.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlDateTime.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlDecimal.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlDecimal.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlDecimal.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlDouble.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlDouble.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlDouble.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlInt16.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlInt16.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlInt16.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlInt32.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlInt32.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlInt32.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlInt64.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlInt64.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlInt64.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlSingle.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlSingle.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlSingle.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlString.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlString.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlString.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlTime.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlTime.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlTime.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlUByte.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlUByte.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlUByte.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlUInt16.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlUInt16.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlUInt16.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlUInt32.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlUInt32.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlUInt32.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlUInt64.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlUInt64.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlUInt64.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/Types/MySqlValue.cs
===================================================================
--- trunk/Driver/Source/Types/MySqlValue.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/Types/MySqlValue.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/UsageAdvisor.cs
===================================================================
--- trunk/Driver/Source/UsageAdvisor.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/UsageAdvisor.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/command.cs
===================================================================
--- trunk/Driver/Source/command.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/command.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -351,9 +351,9 @@
if (statement == null || !statement.IsPrepared)
{
if (CommandType == CommandType.StoredProcedure)
- statement = new StoredProcedure(this.Connection, sql);
+ statement = new StoredProcedure(this, sql);
else
- statement = new PreparableStatement(this.Connection, sql);
+ statement = new PreparableStatement(this, sql);
}
// stored procs are the only statement type that need do anything during resolve
@@ -382,7 +382,7 @@
}
// execute the statement
- statement.Execute(parameters);
+ statement.Execute();
querySent.Set();
canCancel = true;
@@ -469,11 +469,11 @@
return;
if (CommandType == CommandType.StoredProcedure)
- statement = new StoredProcedure(this.Connection, CommandText);
+ statement = new StoredProcedure(this, CommandText);
else
- statement = new PreparableStatement(this.Connection, CommandText);
+ statement = new PreparableStatement(this, CommandText);
- statement.Prepare(parameters);
+ statement.Prepare();
}
/// <include file='docs/mysqlcommand.xml' path='docs/Prepare/*'/>
Modified: trunk/Driver/Source/common/ContextString.cs
===================================================================
--- trunk/Driver/Source/common/ContextString.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/ContextString.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/NamedPipeStream.cs
===================================================================
--- trunk/Driver/Source/common/NamedPipeStream.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/NamedPipeStream.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/NativeMethods.cs
===================================================================
--- trunk/Driver/Source/common/NativeMethods.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/NativeMethods.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/Platform.cs
===================================================================
--- trunk/Driver/Source/common/Platform.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/Platform.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/SHA1.cs
===================================================================
--- trunk/Driver/Source/common/SHA1.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/SHA1.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/SharedMemoryStream.cs
===================================================================
--- trunk/Driver/Source/common/SharedMemoryStream.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/SharedMemoryStream.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/SocketStream.cs
===================================================================
--- trunk/Driver/Source/common/SocketStream.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/SocketStream.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/StreamCreator.cs
===================================================================
--- trunk/Driver/Source/common/StreamCreator.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/StreamCreator.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -72,7 +72,7 @@
#endif
{
#if NET20
- IPHostEntry ipHE = Dns.GetHostEntry(dnsHosts[index]);
+ IPHostEntry ipHE = GetHostEntry(dnsHosts[index]);
#else
IPHostEntry ipHE = Dns.GetHostByName(dnsHosts[index]);
#endif
@@ -99,6 +99,21 @@
return stream;
}
+ private IPHostEntry GetHostEntry(string hostname)
+ {
+ IPAddress addr = null;
+ IPHostEntry ipHE;
+ if (IPAddress.TryParse(hostname, out addr))
+ {
+ ipHE = new IPHostEntry();
+ ipHE.AddressList = new IPAddress[1];
+ ipHE.AddressList[0] = addr;
+ }
+ else
+ ipHE = Dns.GetHostEntry(hostname);
+ return ipHE;
+ }
+
#if !CF
private Stream CreateNamedPipeStream(string hostname)
{
Modified: trunk/Driver/Source/common/Version.cs
===================================================================
--- trunk/Driver/Source/common/Version.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/Version.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/common/WinCE.cs
===================================================================
--- trunk/Driver/Source/common/WinCE.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/common/WinCE.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/dataadapter.cs
===================================================================
--- trunk/Driver/Source/dataadapter.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/dataadapter.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/datareader.cs
===================================================================
--- trunk/Driver/Source/datareader.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/datareader.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -371,14 +371,14 @@
IMySqlValue val = GetFieldValue(column, true);
MySqlDateTime dt;
- // we need to do this because functions like date_add return string
- if (val is MySqlString)
+ if (val is MySqlDateTime)
+ dt = (MySqlDateTime)val;
+ else
{
- string s = ((MySqlString)val).Value;
+ // we need to do this because functions like date_add return string
+ string s = GetString(column);
dt = MySqlDateTime.Parse(s, this.connection.driver.Version);
}
- else
- dt = (MySqlDateTime)val;
if (connection.Settings.ConvertZeroDateTime && !dt.IsValidDateTime)
return DateTime.MinValue;
Modified: trunk/Driver/Source/docs/MySqlConnection.xml
===================================================================
--- trunk/Driver/Source/docs/MySqlConnection.xml 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/docs/MySqlConnection.xml 2007-03-01 21:03:34 UTC (rev 624)
@@ -873,6 +873,16 @@
encountered with MySQL prepared statements.
</td>
</tr>
+ <tr>
+ <td>Use Procedure Bodies</td>
+ <td>true</td>
+ <td>
+ Instructs the provider to attempt to call the procedure without first resolving the metadata. Thjis
+ is useful in situations where the calling user does not have access to the mysql.proc table. To
+ use this mode, the parameters for the procedure must be added to the command in the same order
+ as they appear in the procedure definition and their types must be explicitly set.
+ </td>
+ </tr>
</table>
</div>
<para>
Modified: trunk/Driver/Source/parameter.cs
===================================================================
--- trunk/Driver/Source/parameter.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/parameter.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/Driver/Source/parameter_collection.cs
===================================================================
--- trunk/Driver/Source/parameter_collection.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/parameter_collection.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -108,8 +108,8 @@
name = name.Substring(1, name.Length - 1);
if (name == inComingName)
{
- items[i] = value;
- return value;
+ throw new MySqlException(
+ String.Format(Resources.ParameterAlreadyDefined, value.ParameterName));
}
}
@@ -128,7 +128,7 @@
return value;
}
- int index = items.Add(value);
+ returnParameterIndex = items.Add(value);
return value;
}
Modified: trunk/Driver/Source/transaction.cs
===================================================================
--- trunk/Driver/Source/transaction.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Driver/Source/transaction.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Copied: trunk/Installer/Binary (from rev 621, branches/5.0/Installer/Binary)
Deleted: trunk/Installer/Custom.wxs
===================================================================
--- trunk/Installer/Custom.wxs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Installer/Custom.wxs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Fragment>
- <UI Id="CustomDialogs">
- <Dialog Id="RegisterGACAndStartMenu" Width="370" Height="270" Title="!(loc.SetupTypeDlg_Title)">
- <Control Id="Checkbox1" Type="CheckBox" X="18" Y="108" Width="348" Height="12" Property="REGISTERGAC" CheckBoxValue="1">
- <Text>Register Connector/Net in the Global Assembly Cache</Text>
- </Control>
- <Control Id="Checkbox2" Type="CheckBox" X="18" Y="132" Width="348" Height="12" Property="CREATESTARTMENU" CheckBoxValue="1">
- <Text>Create Start Menu Items</Text>
- </Control>
- <Control Id="Checkbox3" Type="CheckBox" X="18" Y="156" Hidden="yes" Width="348" Height="12" Property="INTEGRATEHELP" CheckBoxValue="1">
- <Text>Integrate Help Into Visual Studio .NET</Text>
- </Control>
- <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)">
- <Publish Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "InstallCustom"</Publish>
- <Publish Event="NewDialog" Value="SetupTypeDlg">WixUI_InstallMode = "InstallTypical"</Publish>
- <Publish Event="NewDialog" Value="SetupTypeDlg">WixUI_InstallMode = "InstallComplete"</Publish>
- <Publish Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
- <Publish Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Repair"</Publish>
- <Publish Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
- </Control>
- <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="!(loc.WixUINext)">
- <Publish Event="NewDialog" Value="VerifyReadyDlg"><![CDATA[1]]></Publish>
- </Control>
- <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
- <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
- </Control>
- <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.SetupTypeDlgBannerBitmap)" />
- <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
- <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
- <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}Final Setup Options" />
- <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Select the options you want from the list below." />
- </Dialog>
-
- <Publish Dialog="SetupTypeDlg" Control="Next" Event="NewDialog" Value="RegisterGACAndStartMenu">1</Publish>
- <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="RegisterGACAndStartMenu">1</Publish>
- </UI>
-
- <!-- link in our custom dialog -->
-<!-- <CustomAction Id="RGSM1" Property='WixUI_SetupTypeDlg_NextTypical' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM2" Property='WixUI_SetupTypeDlg_NextComplete' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM3" Property='WixUI_CustomizeDlg_Next' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM4" Property='WixUI_VerifyReadyDlg_BackCustom' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM5" Property='WixUI_VerifyReadyDlg_BackTypical' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM6" Property='WixUI_VerifyReadyDlg_BackComplete' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM7" Property='WixUI_VerifyReadyDlg_BackChange' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM8" Property='WixUI_VerifyReadyDlg_BackRepair' Value='RegisterGACAndStartMenu' />
- <CustomAction Id="RGSM9" Property='WixUI_VerifyReadyDlg_BackRemove' Value='RegisterGACAndStartMenu' />
-
- <InstallUISequence>
- <Custom Action="RGSM1" Sequence="1"/>
- <Custom Action="RGSM2" After="RGSM1"/>
- <Custom Action="RGSM3" After="RGSM2"/>
- <Custom Action="RGSM4" After="RGSM3"/>
- <Custom Action="RGSM5" After="RGSM4"/>
- <Custom Action="RGSM6" After="RGSM5"/>
- <Custom Action="RGSM7" After="RGSM6"/>
- <Custom Action="RGSM8" After="RGSM7"/>
- <Custom Action="RGSM9" After="RGSM8"/>
- </InstallUISequence>-->
-
- </Fragment>
-</Wix>
\ No newline at end of file
Deleted: trunk/Installer/CustomAction.config
===================================================================
--- trunk/Installer/CustomAction.config 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Installer/CustomAction.config 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<configuration>
-<startup>
-<supportedRuntime version="v2.0.50727"/>
-</startup>
-</configuration>
Modified: trunk/Installer/main.wxs
===================================================================
--- trunk/Installer/main.wxs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Installer/main.wxs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,139 +1,156 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?define ProductVersion="5.0.4"?>
-<?define ProductName="MySQL Connector Net $(var.ProductVersion)"?>
-<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
- <Product Id="7394c123-cacc-4ad2-82b8-c6992131af08" Name="$(var.ProductName)" Manufacturer="MySQL" Version="$(var.ProductVersion)" Language="1033">
-
- <Package Compressed="yes" InstallerVersion="200" Languages="1033" SummaryCodepage="1252" />
-
- <Media Id="1" EmbedCab="yes" Cabinet="ConnectorNet.cab" CompressionLevel="high" />
-
- <!-- Our directory structure -->
- <Directory Id='TARGETDIR' Name='SourceDir'>
- <Directory Id='ProgramFilesFolder' Name='PFiles'>
- <Directory Id='CompanyDir' Name='MySQL'>
- <Directory Id='INSTALLDIR' Name='$(var.ProductName)'>
- <Directory Id='Binaries' Name='Binaries'>
- <Directory Id='BinNet20' Name='.NET 2.0'/>
- <Directory Id='BinNet11' Name='.NET 1.1'/>
- <Directory Id='BinNet10' Name='.NET 1.0'/>
- <Directory Id='Mono10' Name='Mono 1.0'/>
- </Directory>
- <Directory Id='DocsDir' Name='Documentation'/>
- <Directory Id='DriverDir' Name='Driver'/>
- <Directory Id='SampleDir' Name='Samples'/>
- </Directory>
- </Directory>
- </Directory>
-
- <Directory Id="ProgramMenuFolder" Name="PMFolder">
- <Directory Id='PMCompanyDir' Name='MySQL'>
- <Directory Id="ShortCutDir" Name="$(var.ProductName)"/>
- </Directory>
- </Directory>
- </Directory>
-
- <!-- Top level junk - readme, changelog, etc -->
- <DirectoryRef Id='INSTALLDIR'>
- <Component Id="BaseComponents" Guid="6cbae281-be1e-4952-8a5d-cb5d1ad799a9" DiskId="1">
- <File Id="ChangeLog" Name="CHANGES" Source="..\CHANGES" />
- <File Id="RelNotes" Name="Release Notes.txt" Source="..\Release Notes.txt" />
- <?if $(var.IsGPL) = true ?>
- <File Id="EXCEPTIONS" Name="EXCEPTIONS" Source="..\EXCEPTIONS" DiskId="1"/>
- <File Id="COPYING" Name="COPYING" Source="..\COPYING" DiskId="1" />
- <?endif?>
- <File Id="README1" Name="README" Source="..\README" DiskId="1"/>
- <RegistryKey Id="MySqlKey" Root="HKLM" Action="createAndRemoveOnUninstall"
- Key="Software\MySQL AB\MySQL Connector/Net $(var.ProductVersion)">
- <RegistryValue Id="Location" Name="Location" Value="[TARGETDIR]" Type="string"/>
- <RegistryValue Id="Version" Name="Version" Value="$(var.ProductVersion)" Type="string"/>
- </RegistryKey>
- </Component>
- </DirectoryRef>
-
- <!-- .Net 2.0 Binaries -->
- <DirectoryRef Id='BinNet20'>
- <Component Id="Net20" Guid="1b476514-8bcb-48a1-8b32-e477f520b450">
- <File Id="CoreBin20" Name="MySql.Data.dll"
- Source="..\Driver\bin\net-2.0\$(var.build)\mysql.data.dll" DiskId="1"/>
- <File Id="CoreBin20Config" Name="CustomAction.config" Source="CustomAction.config" DiskId="1"/>
- <RegistryKey Id="VSRegistry" Root="HKLM" Action="createAndRemoveOnUninstall"
- Key="SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\MySQL Connector Net $(var.ProductVersion)">
- <RegistryValue Id="VSRegistryValue" Value="[BinNet20]" Type="string" Action="write"/>
- </RegistryKey>
- </Component>
- </DirectoryRef>
-
- <!-- Start menu junk -->
- <DirectoryRef Id='ShortCutDir'>
- <Component Id="StartMenuComponent" Guid="0cd164ab-5f94-4ed3-a7aa-8bbf805a87a0">
- <Shortcut Id="S100" Name="Documentation" Description="Complete documentation for the connector"
- Target="[DocsDir]/MySql.Data.chm" Directory="ShortCutDir" />
- <Shortcut Id="S101" Name="ChangeLog" Description="Complete changelog for the connector" Directory="ShortCutDir"
- Icon="ChangeLogIcon" Target="[INSTALLDIR]/CHANGES"/>
- <Shortcut Id="S102" Name="Release Notes" Description="Release notes" Directory="ShortCutDir"
- Target="[INSTALLDIR]/Release Notes.txt"/>
- </Component>
- </DirectoryRef>
-
- <DirectoryRef Id='DocsDir'>
- <Component Id="Docs" Guid="686fbf13-83a2-4f50-a002-3378328d4740">
- <File Id="CoreCHM" Name="MySql.Data.chm" Source="..\doc\MySql.Data.chm" DiskId="1" />
- </Component>
- </DirectoryRef>
-
- <Feature Id="CoreComponents" Level="1" Title="Core Components" Description="Core Desc" Display="hidden">
- <ComponentRef Id="BaseComponents"/>
- <ComponentRef Id="StartMenuComponent"/>
- </Feature>
-
- <Feature Id="SupportedAssemblies" Level="1" Title="Supported Frameworks"
- ConfigurableDirectory="INSTALLDIR" Absent="disallow"
- Description="Frameworks that will be supported.">
- <Feature Id="FeatureNet10" Level='0' Title=".NET 1.0">
- <!--<ComponentRef Id="Net10"/>-->
- <!--<ComponentRef Id="GACFiles10"/>-->
- </Feature>
- <Feature Id="FeatureNet11" Level='0' Title=".NET 1.1">
- <!--<ComponentRef Id="Net11"/>-->
- <!--<ComponentRef Id="GACFiles11"/>-->
- </Feature>
- <Feature Id="FeatureNet20" Level='1' Title=".NET 2.0">
- <ComponentRef Id="Net20"/>
- </Feature>
- </Feature>
-
- <Feature Id='DocsFeature' Level='1' Title='Documentation' Description='Documentation'>
- <ComponentRef Id='Docs'/>
- </Feature>
-
- <FeatureRef Id="Samples"/>
- <FeatureRef Id="Sources"/>
-
- <Property Id="WIXUI_INSTALLDIR" Value='INSTALLDIR'/>
- <UIRef Id="WixUI_Mondo"/>
- <WixVariable Id="WixUILicenseRtf" Value="License.rtf"/>
- <WixVariable Id="WixUIBannerBmp" Value="Bitmaps/BannrBmp.bmp"/>
- <WixVariable Id="WixUIDialogBmp" Value="Bitmaps/DlgBmp.bmp"/>
-
- <Icon Id="ChangeLogIcon" SourceFile="Bitmaps\document.ico"/>
-
- <!-- custom actions for performing machine.config mods -->
-<!-- <Binary Id="InstallUtil" SourceFile="InstallUtilLib.dll" />
- <CustomAction Id="CustomInstall" BinaryKey="InstallUtil" DllEntry="ManagedInstall" Execute="deferred" />
- <CustomAction Id="InstallSetProp" Property="CustomInstall" Value="/installtype=notransaction /action=install /LogFile= "[#CoreBin20]" "[#CoreBin20Config]"" />
- <CustomAction Id="CustomUninstall" BinaryKey="InstallUtil" DllEntry="ManagedInstall" Execute="deferred" />
- <CustomAction Id="UninstallSetProp" Property="CustomUninstall" Value="/installtype=notransaction /action=uninstall /LogFile= "[#CoreBin20]" "[#CoreBin20Config]"" />
-
- <InstallExecuteSequence>
- <Custom Action="InstallSetProp" After="InstallFiles">NOT Installed</Custom>
- <Custom Action="CustomInstall" After="InstallSetProp">NOT Installed</Custom>
-
- <Custom Action="UninstallSetProp" After="ProcessComponents">Installed</Custom>
- <Custom Action="CustomUninstall" After="UninstallSetProp">Installed</Custom>
- </InstallExecuteSequence>-->
- </Product>
-</Wix>
-
-
-
+<?xml version="1.0" encoding="utf-8"?>
+<?define ProductVersion="5.0.4"?>
+<?define ProductName="MySQL Connector Net $(var.ProductVersion)"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Product Id="5FD88490-011C-4df1-B886-F298D955171B" Name="$(var.ProductName)" Manufacturer="MySQL" Version="$(var.ProductVersion)" Language="1033">
+
+ <Package Compressed="yes" InstallerVersion="200" Languages="1033" SummaryCodepage="1252" />
+
+ <Media Id="1" EmbedCab="yes" Cabinet="ConnectorNet.cab" CompressionLevel="high" />
+
+ <!-- First make sure that .NET 2.0 is installed -->
+ <PropertyRef Id="NETFRAMEWORK20"/>
+ <Condition Message="The .NET Framework 2.0 must be installed before installing this package.">Installed OR NETFRAMEWORK20</Condition>
+
+ <!-- Our directory structure -->
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id='ProgramFilesFolder' Name='PFiles'>
+ <Directory Id='CompanyDir' Name='MySQL'>
+ <Directory Id='INSTALLDIR' Name='$(var.ProductName)'>
+ <Directory Id='Binaries' Name='Binaries'>
+ <Directory Id='BinNet20' Name='.NET 2.0'/>
+ <Directory Id='BinNet11' Name='.NET 1.1'/>
+ <Directory Id='BinNet10' Name='.NET 1.0'/>
+ <Directory Id='Mono10' Name='Mono 1.0'/>
+ </Directory>
+ <Directory Id='DocsDir' Name='Documentation'/>
+ <Directory Id='DriverDir' Name='Driver'/>
+ <Directory Id='SampleDir' Name='Samples'/>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <Directory Id="ProgramMenuFolder" Name="PMFolder">
+ <Directory Id='PMCompanyDir' Name='MySQL'>
+ <Directory Id="ShortCutDir" Name="$(var.ProductName)"/>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <!-- Top level junk - readme, changelog, etc -->
+ <DirectoryRef Id='INSTALLDIR'>
+ <Component Id="BaseComponents" Guid="6cbae281-be1e-4952-8a5d-cb5d1ad799a9" DiskId="1">
+ <File Id="ChangeLog" Name="CHANGES" Source="..\CHANGES" />
+ <File Id="RelNotes" Name="Release Notes.txt" Source="..\Release Notes.txt" />
+ <?if $(var.IsGPL) = true ?>
+ <File Id="EXCEPTIONS" Name="EXCEPTIONS" Source="..\EXCEPTIONS" DiskId="1"/>
+ <File Id="COPYING" Name="COPYING" Source="..\COPYING" DiskId="1" />
+ <?endif?>
+ <File Id="README1" Name="README" Source="..\README" DiskId="1"/>
+ <RegistryKey Id="MySqlKey" Root="HKLM" Action="createAndRemoveOnUninstall"
+ Key="Software\MySQL AB\MySQL Connector/Net $(var.ProductVersion)">
+ <RegistryValue Id="Location" Name="Location" Value="[INSTALLDIR]" Type="string"/>
+ <RegistryValue Id="Version" Name="Version" Value="$(var.ProductVersion)" Type="string"/>
+ </RegistryKey>
+ </Component>
+ </DirectoryRef>
+
+ <!-- .Net 2.0 Binaries -->
+ <DirectoryRef Id='BinNet20'>
+ <Component Id="Net20" Guid="17250F82-34FF-44d6-9721-601E976AF1A8">
+ <File Id="CoreBin20" Name="MySql.Data.dll"
+ Source="..\Driver\bin\net-2.0\$(var.build)\mysql.data.dll" DiskId="1"/>
+ <RegistryKey Id="VSRegistry" Root="HKLM" Action="createAndRemoveOnUninstall"
+ Key="SOFTWARE\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\MySQL Connector Net $(var.ProductVersion)">
+ <RegistryValue Id="VSRegistryValue" Value="[BinNet20]" Type="string" Action="write"/>
+ </RegistryKey>
+ </Component>
+ <Component Id="GAC20" Guid="BAC52988-72B6-483e-8B7B-017E77461CDC">
+ <File Id="GAC20" Name="MySql.Data.dll"
+ Source="..\Driver\bin\net-2.0\$(var.build)\mysql.data.dll" DiskId="1" Assembly=".net" KeyPath="yes"/>
+ </Component>
+ </DirectoryRef>
+
+ <!-- Start menu junk -->
+ <DirectoryRef Id='ShortCutDir'>
+ <Component Id="StartMenuComponent" Guid="B0801261-F922-4fce-A711-C8B278554E03">
+ <Shortcut Id="S100" Name="Documentation" Description="Complete documentation for the connector"
+ Target="[DocsDir]/MySql.Data.chm" Directory="ShortCutDir" />
+ <Shortcut Id="S101" Name="ChangeLog" Description="Complete changelog for the connector" Directory="ShortCutDir"
+ Icon="ChangeLogIcon" Target="[INSTALLDIR]/CHANGES"/>
+ <Shortcut Id="S102" Name="Release Notes" Description="Release notes" Directory="ShortCutDir"
+ Target="[INSTALLDIR]/Release Notes.txt"/>
+ </Component>
+ </DirectoryRef>
+
+ <DirectoryRef Id='DocsDir'>
+ <Component Id="Docs" Guid="091551DE-12FA-4c9a-84DE-221E14993714">
+ <File Id="CoreCHM" Name="MySql.Data.chm" Source="..\doc\MySql.Data.chm" DiskId="1" />
+ </Component>
+ </DirectoryRef>
+
+ <Feature Id="CoreComponents" Level="1" Title="Core Components"
+ Description="Core Components" ConfigurableDirectory ="INSTALLDIR"
+ Absent="disallow" Display="2">
+ <ComponentRef Id="BaseComponents"/>
+ <ComponentRef Id="Net20"/>
+ <ComponentRef Id="GAC20"/>
+ <ComponentRef Id="StartMenuComponent"/>
+ </Feature>
+
+ <!-- <Feature Id="SupportedAssemblies" Level="1" Title="Supported Frameworks"
+ ConfigurableDirectory="INSTALLDIR" Absent="disallow"
+ Description="Frameworks that will be supported.">
+ <Feature Id="FeatureNet20" Level='1' Title=".NET 2.0">
+ <ComponentRef Id="Net20"/>
+ </Feature>
+ </Feature>-->
+
+ <Feature Id='DocsFeature' Display='4' Level='1' Title='Documentation' Description='Documentation'>
+ <ComponentRef Id='Docs'/>
+ </Feature>
+
+ <FeatureRef Id="Samples"/>
+ <FeatureRef Id="Sources"/>
+
+ <Property Id="WIXUI_INSTALLDIR" Value='INSTALLDIR'/>
+ <UIRef Id="WixUI_Mondo"/>
+ <WixVariable Id="WixUILicenseRtf" Value="License.rtf"/>
+ <WixVariable Id="WixUIBannerBmp" Value="Bitmaps/BannrBmp.bmp"/>
+ <WixVariable Id="WixUIDialogBmp" Value="Bitmaps/DlgBmp.bmp"/>
+
+ <Icon Id="ChangeLogIcon" SourceFile="Bitmaps\document.ico"/>
+
+ <!-- custom actions for machine.config mods -->
+ <Binary Id="InstallUtil" SourceFile="Binary\InstallUtilLib.dll" />
+ <Binary Id="MSVBDPCADLL" SourceFile="Binary\MSVBDPCADLL.ibd" />
+ <Binary Id="VSDNETCFG" SourceFile="Binary\VSDNETCFG.ibd" />
+
+ <CustomAction Id="SetPrereqs" BinaryKey="MSVBDPCADLL" DllEntry="CheckFX" Impersonate="no" />
+ <CustomAction Id="MyCASetProp" Property="InstallCA" Impersonate="no"
+ Value="/installtype=notransaction /action=install /LogFile= "[#CoreBin20]" "[VSDFxConfigFile]""/>
+ <CustomAction Id="InstallCA" BinaryKey="InstallUtil" DllEntry="ManagedInstall"
+ Execute="deferred" Impersonate="no"/>
+
+ <CustomAction Id="SetPrereqs1" BinaryKey="MSVBDPCADLL" DllEntry="CheckFX" Impersonate="no"/>
+ <CustomAction Id="MyCAUnSetProp" Property="RemoveCA" Impersonate="no"
+ Value="/installtype=notransaction /action=uninstall /LogFile= "[#CoreBin20]" "[VSDFxConfigFile]""/>
+ <CustomAction Id="RemoveCA" BinaryKey="InstallUtil" DllEntry="ManagedInstall"
+ Execute="deferred" Impersonate="no" />
+
+ <InstallExecuteSequence>
+ <!-- Install code -->
+ <Custom Action="SetPrereqs" After="InstallFiles"/>
+ <Custom Action="MyCASetProp" After="SetPrereqs">NOT Installed</Custom>
+ <Custom Action="InstallCA" After="MyCASetProp">NOT Installed</Custom>
+
+ <!-- UnInstall code -->
+ <Custom Action="SetPrereqs1" Before="RemoveFiles">Installed</Custom>
+ <Custom Action="MyCAUnSetProp" After="SetPrereqs1">Installed</Custom>
+ <Custom Action="RemoveCA" After="MyCAUnSetProp">Installed</Custom>
+ </InstallExecuteSequence>
+ </Product>
+</Wix>
+
+
+
Modified: trunk/Installer/samples.wxs
===================================================================
--- trunk/Installer/samples.wxs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Installer/samples.wxs 2007-03-01 21:03:34 UTC (rev 624)
@@ -4,7 +4,7 @@
<DirectoryRef Id='SampleDir'>
<Directory Id="TableEditor" Name="Table Editor">
<Directory Id="teCS" Name="cs">
- <Component Id="Sample1CS" Guid="22cbf994-2ffb-4c7c-8538-1f773cd8a2a5">
+ <Component Id="Sample1CS" Guid="69C435DD-64A5-44cd-B3BE-89747B50956C">
<File Id="teCS1" Name="App.ico" Source="..\Samples\TableEditor\cs\App.ico" DiskId="1"/>
<File Id="teCS2" Name="AssemblyInfo.cs" Source="..\Samples\TableEditor\cs\AssemblyInfo.cs" DiskId="1"/>
<File Id="teCS3" Name="Form1.cs" Source="..\Samples\TableEditor\cs\Form1.cs" DiskId="1"/>
@@ -14,7 +14,7 @@
</Component>
</Directory>
<Directory Id="teVB" Name="vb">
- <Component Id="Sample1VB" Guid="72104075-eff1-4d96-b186-8b0a61e7d858">
+ <Component Id="Sample1VB" Guid="AC22A69F-2E52-40cf-8C4C-4E70EAC6F088">
<File Id="teVB2" Name="AssemblyInfo.vb" Source="..\Samples\TableEditor\vb\AssemblyInfo.vb" DiskId="1"/>
<File Id="teVB3" Name="Form1.vb" Source="..\Samples\TableEditor\vb\Form1.vb" DiskId="1"/>
<File Id="teVB4" Name="Form1.resx" Source="..\Samples\TableEditor\vb\Form1.resx" DiskId="1"/>
@@ -25,7 +25,7 @@
</Directory>
<Directory Id="Async" Name="Async">
<Directory Id="asyncCS" Name="cs">
- <Component Id="Sample2CS" Guid="1cfb8520-6afd-4979-888b-7dfdf4728219">
+ <Component Id="Sample2CS" Guid="326A8013-1780-4e65-A1C0-A1C725659DA4">
<File Id="sample2file1" Name="App.ico" Source="..\Samples\Async\cs\App.ico" DiskId="1"/>
<File Id="sample2file2" Name="AssemblyInfo.cs" Source="..\Samples\Async\cs\AssemblyInfo.cs" DiskId="1"/>
<File Id="sample2file3" Name="Form1.cs" Source="..\Samples\Async\cs\Form1.cs" DiskId="1"/>
@@ -36,7 +36,7 @@
</Directory>
</DirectoryRef>
- <Feature Id='Samples' Level='1' Title='Samples' Description='Sample Applications'>
+ <Feature Id='Samples' Display='6' Level='1' Title='Samples' Description='Sample Applications'>
<Feature Id='CSSamples' Level='1' Title='CSharp' Description='Sample CSharp Applications' InstallDefault='local'>
<ComponentRef Id='Sample1CS'/>
<ComponentRef Id='Sample2CS'/>
Modified: trunk/Installer/sources.wxs
===================================================================
--- trunk/Installer/sources.wxs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Installer/sources.wxs 2007-03-01 21:03:34 UTC (rev 624)
@@ -2,7 +2,7 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment Id='SourceFragment'>
<DirectoryRef Id='DriverDir'>
- <Component Id="TopLevelSrc" Guid="0b171095-b9cb-4bab-8c0e-4b8e8247bfe0">
+ <Component Id="TopLevelSrc" Guid="4B94BD76-FF6D-4605-AC99-C45A03364872">
<File Id="nantFile" Name="client.build" Source="..\client.build" DiskId="1"/>
<File Id="m2005proj" Name="MySql.Data.2005.csproj" Source="..\Driver\MySql.Data.2005.csproj" DiskId="1"/>
</Component>
@@ -12,7 +12,7 @@
</Component>
</Directory>
<Directory Id="srcFolder" Name="Source">
- <Component Id="CoreSrc" DiskId="1" Guid="14ffe0b2-329f-4981-ab1c-1d099ec958fa">
+ <Component Id="CoreSrc" DiskId="1" Guid="EB1FC0F7-1300-4938-BC0D-720792D064BE">
<File Id="file1" Name="CharSetMap.cs" Source="..\Driver\Source\CharSetMap.cs" />
<File Id="file2" Name="command.cs" Source="..\Driver\Source\command.cs" />
<File Id="file3" Name="CommandBuilder.cs" Source="..\Driver\Source\CommandBuilder.cs" />
@@ -52,7 +52,7 @@
<File Id="file46" Name="Installer.cs" Source="..\Driver\Source\Installer.cs"/>
</Component>
<Directory Id="commonFolder" Name="Common">
- <Component Id="CommonSrc" DiskId="1" Guid="e5726acb-91cc-4212-8d2b-594bee186f8c">
+ <Component Id="CommonSrc" DiskId="1" Guid="AB468934-0BF8-41d3-BFDD-C3E1CFD45F1B">
<File Id="file179" Name="ContextString.cs" Source="..\Driver\Source\common\ContextString.cs" />
<File Id="file180" Name="NamedPipeStream.cs" Source="..\Driver\Source\common\NamedPipeStream.cs" />
<File Id="file181" Name="NativeMethods.cs" Source="..\Driver\Source\common\NativeMethods.cs" />
@@ -66,7 +66,7 @@
</Component>
</Directory>
<Directory Id="docSrcFolder" Name="Docs">
- <Component Id="DocsSrc" DiskId="1" Guid="9fa4a523-7578-4d1e-b682-6383c6663518">
+ <Component Id="DocsSrc" DiskId="1" Guid="530BFFA7-199F-49c3-9DEA-D1ADAF61179D">
<File Id="file245" Name="MySqlCommand.xml" Source="..\Driver\Source\docs\MySqlCommand.xml" />
<File Id="file246" Name="MySqlCommandBuilder.xml" Source="..\Driver\Source\docs\MySqlCommandBuilder.xml" />
<File Id="file247" Name="MySqlConnection.xml" Source="..\Driver\Source\docs\MySqlConnection.xml" />
@@ -81,7 +81,7 @@
</Component>
</Directory>
<Directory Id="typesFolder" Name="Types">
- <Component Id="TypesSrc" DiskId="1" Guid="00026aa3-136d-4379-a8e2-c12c72866890">
+ <Component Id="TypesSrc" DiskId="1" Guid="57BCAC51-1A1A-4fcf-BFE9-9081E5821301">
<File Id="file299" Name="MetaData.cs" Source="..\Driver\Source\Types\MetaData.cs" />
<File Id="file300" Name="MySqlBinary.cs" Source="..\Driver\Source\Types\MySqlBinary.cs" />
<File Id="file301" Name="MySqlBit.cs" Source="..\Driver\Source\Types\MySqlBit.cs" />
@@ -104,7 +104,7 @@
</Component>
</Directory>
<Directory Id="zlibFolder" Name="zlib">
- <Component Id="ZLibSrc" DiskId="1" Guid="5bf41c05-1d57-4a64-b8a6-e0bad6141317">
+ <Component Id="ZLibSrc" DiskId="1" Guid="AF13C4FD-CA99-4fc6-AE6B-6DD44FBEC3CF">
<File Id="file500" Name="Adler32.cs" Source="..\Driver\Source\zlib\Adler32.cs" />
<File Id="file501" Name="Deflate.cs" Source="..\Driver\Source\zlib\Deflate.cs" />
<File Id="file502" Name="InfBlocks.cs" Source="..\Driver\Source\zlib\InfBlocks.cs" />
@@ -123,7 +123,7 @@
</Directory>
</Directory>
<Directory Id="TestSuite" Name="TestSuite">
- <Component Id="TestSuiteSrc" DiskId="1" Guid="54eddace-adcc-44eb-bc25-eb69cbf278d3">
+ <Component Id="TestSuiteSrc" DiskId="1" Guid="8D1DD3AA-DF35-4107-B7BD-DDE707F79756">
<File Id="file402" Name="AsyncTests.cs" Source="..\TestSuite\AsyncTests.cs" />
<File Id="file403" Name="BaseTest.cs" Source="..\TestSuite\BaseTest.cs" />
<File Id="file404" Name="BlobTests.cs" Source="..\TestSuite\BlobTests.cs" />
@@ -164,14 +164,14 @@
<File Id="file445" Name="ConnectionStringBuilder.cs" Source="..\TestSuite\ConnectionStringBuilder.cs"/>
</Component>
<Directory Id="TSProperties" Name="Properties">
- <Component Id="TestSuitePropSrc" DiskId="1" Guid="45741f34-56c0-4186-aeb2-7218210bed7d">
+ <Component Id="TestSuitePropSrc" DiskId="1" Guid="42D875F4-62AF-4f5a-BF96-11C6EBA6017C">
<File Id="file401" Name="AssemblyInfo.cs" Source="..\TestSuite\Properties\AssemblyInfo.cs" />
</Component>
</Directory>
</Directory>
</DirectoryRef>
- <Feature Id='Sources' Level='1' Title='Sources' Description='Source code for all assemblies'>
+ <Feature Id='Sources' Display ='8' Level='1' Title='Sources' Description='Source code for all assemblies'>
<ComponentRef Id='TopLevelSrc'/>
<ComponentRef Id='PropSrc'/>
<ComponentRef Id='CoreSrc'/>
Modified: trunk/MySQLClient.2005.sln
===================================================================
--- trunk/MySQLClient.2005.sln 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/MySQLClient.2005.sln 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,7 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySql.Data.CF.2005", "Driver\MySql.Data.CF.2005.csproj", "{19DAEB9F-F508-43A5-AB25-D66919A18259}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySql.Data.2005", "Driver\MySql.Data.2005.csproj", "{E9DF5ED1-4CBD-4226-B931-9A51610AC14D}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MySql.Web", "MySql.Web\MySql.Web.csproj", "{C28B1166-1380-445D-AEC1-8A18B990DD18}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -10,12 +12,20 @@
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {19DAEB9F-F508-43A5-AB25-D66919A18259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {19DAEB9F-F508-43A5-AB25-D66919A18259}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {19DAEB9F-F508-43A5-AB25-D66919A18259}.Debug|x86.ActiveCfg = Debug|Any CPU
- {19DAEB9F-F508-43A5-AB25-D66919A18259}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {19DAEB9F-F508-43A5-AB25-D66919A18259}.Release|Any CPU.Build.0 = Release|Any CPU
- {19DAEB9F-F508-43A5-AB25-D66919A18259}.Release|x86.ActiveCfg = Release|Any CPU
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Debug|x86.ActiveCfg = Debug|x86
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Debug|x86.Build.0 = Debug|x86
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Release|x86.ActiveCfg = Release|x86
+ {E9DF5ED1-4CBD-4226-B931-9A51610AC14D}.Release|x86.Build.0 = Release|x86
+ {C28B1166-1380-445D-AEC1-8A18B990DD18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C28B1166-1380-445D-AEC1-8A18B990DD18}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C28B1166-1380-445D-AEC1-8A18B990DD18}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {C28B1166-1380-445D-AEC1-8A18B990DD18}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C28B1166-1380-445D-AEC1-8A18B990DD18}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C28B1166-1380-445D-AEC1-8A18B990DD18}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: trunk/MySql.Web/MySql.Web.csproj
===================================================================
--- trunk/MySql.Web/MySql.Web.csproj 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/MySql.Web/MySql.Web.csproj 2007-03-01 21:03:34 UTC (rev 624)
@@ -37,8 +37,15 @@
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Source\MembershipProvider.cs" />
+ <Compile Include="Source\MySqlDataSourceView.cs" />
<Compile Include="Source\RoleProvider.cs" />
</ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\branches\5.0\Driver\MySql.Data.2005.csproj">
+ <Project>{E9DF5ED1-4CBD-4226-B931-9A51610AC14D}</Project>
+ <Name>MySql.Data.2005</Name>
+ </ProjectReference>
+ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Modified: trunk/MySql.Web/Source/MembershipProvider.cs
===================================================================
--- trunk/MySql.Web/Source/MembershipProvider.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/MySql.Web/Source/MembershipProvider.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2007 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
@@ -263,7 +263,7 @@
}
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("UPDATE Users " + " SET Password = ?Password, LastPasswordChangedDate = ?LastPasswordChangedDate " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("UPDATE MySqlWebUsers " + " SET Password = ?Password, LastPasswordChangedDate = ?LastPasswordChangedDate " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Password", MySqlDbType.VarChar, 255).Value = EncodePassword(newPwd);
cmd.Parameters.Add("?LastPasswordChangedDate", MySqlDbType.Datetime).Value = DateTime.Now;
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
@@ -304,7 +304,7 @@
return false;
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("UPDATE Users " + " SET PasswordQuestion = ?PasswordQuestion, PasswordAnswer = ?PasswordAnswer" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("UPDATE MySqlWebUsers " + " SET PasswordQuestion = ?PasswordQuestion, PasswordAnswer = ?PasswordAnswer" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?PasswordQuestion", MySqlDbType.VarChar, 255).Value = newPwdQuestion;
cmd.Parameters.Add("?PasswordAnswer", MySqlDbType.VarChar, 255).Value = EncodePassword(newPwdAnswer);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
@@ -371,7 +371,7 @@
}
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("INSERT INTO Users " + " (PKID, Username, Password, Email, PasswordQuestion, " + " PasswordAnswer, IsApproved," + " Comment, CreationDate, LastPasswordChangedDate, LastActivityDate," + " ApplicationName, IsLockedOut, LastLockedOutDate," + " FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart, " + " FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart)" + " Values(?PKID, ?Username, ?Password, ?Email, ?PasswordQuestion, ?PasswordAnswer," + " ?IsApproved, ?Comment, ?CreationDate, ?LastPasswordChangedDate, ?LastActivityDate," + " ?ApplicationName, ?IsLockedOut, ?LastLockedOutDate, ?FailedPasswordAttemptCount," + " ?FailedPasswordAttemptWindowStart, ?FailedPasswordAnswerAttemptCount, ?FailedPasswordAnswerAttemptWindowStart)", conn);
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO MySqlWebUsers " + " (PKID, Username, Password, Email, PasswordQuestion, " + " PasswordAnswer, IsApproved," + " Comment, CreationDate, LastPasswordChangedDate, LastActivityDate," + " ApplicationName, IsLockedOut, LastLockedOutDate," + " FailedPasswordAttemptCount, FailedPasswordAttemptWindowStart, " + " FailedPasswordAnswerAttemptCount, FailedPasswordAnswerAttemptWindowStart)" + " Values(?PKID, ?Username, ?Password, ?Email, ?PasswordQuestion, ?PasswordAnswer," + " ?IsApproved, ?Comment, ?CreationDate, ?LastPasswordChangedDate, ?LastActivityDate," + " ?ApplicationName, ?IsLockedOut, ?LastLockedOutDate, ?FailedPasswordAttemptCount," + " ?FailedPasswordAttemptWindowStart, ?FailedPasswordAnswerAttemptCount, ?FailedPasswordAnswerAttemptWindowStart)", conn);
cmd.Parameters.Add("?PKID", MySqlDbType.VarChar).Value = providerUserKey.ToString();
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?Password", MySqlDbType.VarChar, 255).Value = EncodePassword(password);
@@ -427,7 +427,7 @@
public override bool DeleteUser(string username, bool deleteAllRelatedData)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("DELETE FROM Users " + " WHERE Username = ?Username AND Applicationname = ?Applicationname", conn);
+ MySqlCommand cmd = new MySqlCommand("DELETE FROM MySqlWebUsers " + " WHERE Username = ?Username AND Applicationname = ?Applicationname", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName.ToString();
int rowsAffected = 0;
@@ -437,7 +437,7 @@
rowsAffected = cmd.ExecuteNonQuery();
if (deleteAllRelatedData)
{
- cmd = new MySqlCommand("DELETE FROM usersinroles WHERE Username = ?Username", conn);
+ cmd = new MySqlCommand("DELETE FROM MySqlWebUsersInRoles WHERE Username = ?Username", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
rowsAffected = cmd.ExecuteNonQuery();
}
@@ -468,7 +468,7 @@
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM Users " + "WHERE ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM MySqlWebUsers " + "WHERE ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MembershipUserCollection users = new MembershipUserCollection();
MySqlDataReader reader = null;
@@ -481,7 +481,7 @@
{
return users;
}
- cmd.CommandText = "SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate " + " FROM Users " + " WHERE ApplicationName = ?ApplicationName " + " ORDER BY Username Asc";
+ cmd.CommandText = "SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate " + " FROM MySqlWebUsers " + " WHERE ApplicationName = ?ApplicationName " + " ORDER BY Username Asc";
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName.ToString();
reader = cmd.ExecuteReader();
int counter = 0;
@@ -529,7 +529,7 @@
TimeSpan onlineSpan = new TimeSpan(0, System.Web.Security.Membership.UserIsOnlineTimeWindow, 0);
DateTime compareTime = DateTime.Now.Subtract(onlineSpan);
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM Users " + " WHERE LastActivityDate > ?LastActivityUpdate AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM MySqlWebUsers " + " WHERE LastActivityDate > ?LastActivityUpdate AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?CompareDate", MySqlDbType.Datetime).Value = compareTime;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
int numOnline = 0;
@@ -568,7 +568,7 @@
throw new ProviderException("Cannot retrieve Hashed passwords.");
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Password, PasswordAnswer, IsLockedOut FROM Users " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Password, PasswordAnswer, IsLockedOut FROM MySqlWebUsers " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
string password = "";
@@ -628,7 +628,7 @@
public override MembershipUser GetUser(string username, bool userIsOnline)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" + " FROM Users WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" + " FROM MySqlWebUsers WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MembershipUser u = null;
@@ -643,7 +643,7 @@
u = GetUserFromReader(reader);
if (userIsOnline)
{
- MySqlCommand updateCmd = new MySqlCommand("UPDATE Users " + "SET LastActivityDate = ?LastActivityDate " + "WHERE Username = ?Username AND Applicationname = ?Applicationname", conn);
+ MySqlCommand updateCmd = new MySqlCommand("UPDATE MySqlWebUsers " + "SET LastActivityDate = ?LastActivityDate " + "WHERE Username = ?Username AND Applicationname = ?Applicationname", conn);
updateCmd.Parameters.Add("?LastActivityDate", MySqlDbType.Datetime).Value = DateTime.Now;
updateCmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
updateCmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
@@ -677,7 +677,7 @@
public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" + " FROM Users WHERE PKID = ?PKID", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate" + " FROM MySqlWebUsers WHERE PKID = ?PKID", conn);
cmd.Parameters.Add("?PKID", MySqlDbType.VarChar).Value = providerUserKey.ToString();
MembershipUser u = null;
MySqlDataReader reader = null;
@@ -691,7 +691,7 @@
u = GetUserFromReader(reader);
if (userIsOnline)
{
- MySqlCommand updateCmd = new MySqlCommand("UPDATE Users " + "SET LastActivityDate = ?LastActivityDate " + "WHERE PKID = ?PKID", conn);
+ MySqlCommand updateCmd = new MySqlCommand("UPDATE MySqlWebUsers " + "SET LastActivityDate = ?LastActivityDate " + "WHERE PKID = ?PKID", conn);
updateCmd.Parameters.Add("?LastActivityDate", MySqlDbType.Datetime).Value = DateTime.Now;
updateCmd.Parameters.Add("?PKID", MySqlDbType.VarChar).Value = providerUserKey.ToString();
updateCmd.ExecuteNonQuery();
@@ -758,7 +758,7 @@
public override bool UnlockUser(string username)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("UPDATE Users " + " SET IsLockedOut = False, LastLockedOutDate = ?LastLockedOutDate " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("UPDATE MySqlWebUsers " + " SET IsLockedOut = False, LastLockedOutDate = ?LastLockedOutDate " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?LastLockedOutDate", MySqlDbType.Datetime).Value = DateTime.Now;
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
@@ -794,14 +794,16 @@
public override string GetUserNameByEmail(string email)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Username" + " FROM Users WHERE Email = ?Email AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Username" + " FROM MySqlWebUsers WHERE Email = ?Email AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Email", MySqlDbType.VarChar, 128).Value = email;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
string username = "";
try
{
conn.Open();
- username = cmd.ExecuteScalar().ToString();
+ object name = cmd.ExecuteScalar();
+ if (name != null)
+ username = name.ToString();
}
catch (MySqlException e)
{
@@ -852,7 +854,7 @@
}
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT PasswordAnswer, IsLockedOut FROM Users " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT PasswordAnswer, IsLockedOut FROM MySqlWebUsers " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
int rowsAffected = 0;
@@ -880,7 +882,7 @@
UpdateFailureCount(username, "passwordAnswer");
throw new MembershipPasswordException("Incorrect password answer.");
}
- MySqlCommand updateCmd = new MySqlCommand("UPDATE Users " + " SET Password = ?Password, LastPasswordChangedDate = ?LastPasswordChangedDate" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName AND IsLockedOut = False", conn);
+ MySqlCommand updateCmd = new MySqlCommand("UPDATE MySqlWebUsers " + " SET Password = ?Password, LastPasswordChangedDate = ?LastPasswordChangedDate" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName AND IsLockedOut = False", conn);
updateCmd.Parameters.Add("?Password", MySqlDbType.VarChar, 255).Value = EncodePassword(newPassword);
updateCmd.Parameters.Add("?LastPasswordChangedDate", MySqlDbType.Datetime).Value = DateTime.Now;
updateCmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
@@ -920,7 +922,7 @@
public override void UpdateUser(MembershipUser user)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("UPDATE Users " + " SET Email = ?Email, Comment = ?Comment," + " IsApproved = ?IsApproved" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("UPDATE MySqlWebUsers " + " SET Email = ?Email, Comment = ?Comment," + " IsApproved = ?IsApproved" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Email", MySqlDbType.VarChar, 128).Value = user.Email;
cmd.Parameters.Add("?Comment", MySqlDbType.VarChar, 255).Value = user.Comment;
cmd.Parameters.Add("?IsApproved", MySqlDbType.Bit).Value = user.IsApproved;
@@ -953,7 +955,7 @@
{
bool isValid = false;
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Password, IsApproved FROM Users " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName AND IsLockedOut = False", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Password, IsApproved FROM MySqlWebUsers " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName AND IsLockedOut = False", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MySqlDataReader reader = null;
@@ -979,7 +981,7 @@
if (isApproved)
{
isValid = true;
- MySqlCommand updateCmd = new MySqlCommand("UPDATE Users SET LastLoginDate = ?LastLoginDate" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand updateCmd = new MySqlCommand("UPDATE MySqlWebUsers SET LastLoginDate = ?LastLoginDate" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
updateCmd.Parameters.Add("?LastLoginDate", MySqlDbType.Datetime).Value = DateTime.Now;
updateCmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
updateCmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
@@ -1018,7 +1020,7 @@
private void UpdateFailureCount(string username, string failureType)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT FailedPasswordAttemptCount, " + " FailedPasswordAttemptWindowStart, " + " FailedPasswordAnswerAttemptCount, " + " FailedPasswordAnswerAttemptWindowStart " + " FROM Users " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT FailedPasswordAttemptCount, " + " FailedPasswordAttemptWindowStart, " + " FailedPasswordAnswerAttemptCount, " + " FailedPasswordAnswerAttemptWindowStart " + " FROM MySqlWebUsers " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MySqlDataReader reader = null;
@@ -1048,11 +1050,11 @@
{
if (failureType == "password")
{
- cmd.CommandText = "UPDATE Users " + " SET FailedPasswordAttemptCount = ?Count, " + " FailedPasswordAttemptWindowStart = ?WindowStart " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
+ cmd.CommandText = "UPDATE MySqlWebUsers " + " SET FailedPasswordAttemptCount = ?Count, " + " FailedPasswordAttemptWindowStart = ?WindowStart " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
}
if (failureType == "passwordAnswer")
{
- cmd.CommandText = "UPDATE Users " + " SET FailedPasswordAnswerAttemptCount = ?Count, " + " FailedPasswordAnswerAttemptWindowStart = ?WindowStart " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
+ cmd.CommandText = "UPDATE MySqlWebUsers " + " SET FailedPasswordAnswerAttemptCount = ?Count, " + " FailedPasswordAnswerAttemptWindowStart = ?WindowStart " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
}
cmd.Parameters.Clear();
cmd.Parameters.Add("?Count", MySqlDbType.Int32).Value = 1;
@@ -1069,7 +1071,7 @@
failureCount += 1;
if (failureCount >= MaxInvalidPasswordAttempts)
{
- cmd.CommandText = "UPDATE Users " + " SET IsLockedOut = ?IsLockedOut, LastLockedOutDate = ?LastLockedOutDate " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
+ cmd.CommandText = "UPDATE MySqlWebUsers " + " SET IsLockedOut = ?IsLockedOut, LastLockedOutDate = ?LastLockedOutDate " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
cmd.Parameters.Clear();
cmd.Parameters.Add("?IsLockedOut", MySqlDbType.Bit).Value = true;
cmd.Parameters.Add("?LastLockedOutDate", MySqlDbType.Datetime).Value = DateTime.Now;
@@ -1084,11 +1086,11 @@
{
if (failureType == "password")
{
- cmd.CommandText = "UPDATE Users " + " SET FailedPasswordAttemptCount = ?Count" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
+ cmd.CommandText = "UPDATE MySqlWebUsers " + " SET FailedPasswordAttemptCount = ?Count" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
}
if (failureType == "passwordAnswer")
{
- cmd.CommandText = "UPDATE Users " + " SET FailedPasswordAnswerAttemptCount = ?Count" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
+ cmd.CommandText = "UPDATE MySqlWebUsers " + " SET FailedPasswordAnswerAttemptCount = ?Count" + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName";
}
cmd.Parameters.Clear();
cmd.Parameters.Add("?Count", MySqlDbType.Int32).Value = failureCount;
@@ -1203,7 +1205,7 @@
int pageIndex, int pageSize, out int totalRecords)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM Users " + "WHERE Username LIKE ?UsernameSearch AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM MySqlWebUsers " + "WHERE Username LIKE ?UsernameSearch AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?UsernameSearch", MySqlDbType.VarChar, 255).Value = usernameToMatch;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MembershipUserCollection users = new MembershipUserCollection();
@@ -1216,7 +1218,7 @@
{
return users;
}
- cmd.CommandText = "SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate " + " FROM Users " + " WHERE Username LIKE ?UsernameSearch AND ApplicationName = ?ApplicationName " + " ORDER BY Username Asc";
+ cmd.CommandText = "SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate " + " FROM MySqlWebUsers " + " WHERE Username LIKE ?UsernameSearch AND ApplicationName = ?ApplicationName " + " ORDER BY Username Asc";
cmd.Parameters.Add("?UsernameSearch", MySqlDbType.VarChar, 255).Value = usernameToMatch;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
reader = cmd.ExecuteReader();
@@ -1264,7 +1266,7 @@
int pageSize, out int totalRecords)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM Users " + "WHERE Email LIKE ?EmailSearch AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Count(*) FROM MySqlWebUsers " + "WHERE Email LIKE ?EmailSearch AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?EmailSearch", MySqlDbType.VarChar, 255).Value = emailToMatch;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName.ToString();
MembershipUserCollection users = new MembershipUserCollection();
@@ -1278,7 +1280,7 @@
{
return users;
}
- cmd.CommandText = "SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate " + " FROM Users " + " WHERE Email LIKE ?EmailSearch AND ApplicationName = ?ApplicationName " + " ORDER BY Username Asc";
+ cmd.CommandText = "SELECT PKID, Username, Email, PasswordQuestion," + " Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate," + " LastActivityDate, LastPasswordChangedDate, LastLockedOutDate " + " FROM MySqlWebUsers " + " WHERE Email LIKE ?EmailSearch AND ApplicationName = ?ApplicationName " + " ORDER BY Username Asc";
cmd.Parameters.Add("?EmailSearch", MySqlDbType.VarChar, 255).Value = emailToMatch;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
reader = cmd.ExecuteReader();
Modified: trunk/MySql.Web/Source/RoleProvider.cs
===================================================================
--- trunk/MySql.Web/Source/RoleProvider.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/MySql.Web/Source/RoleProvider.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2007 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
@@ -139,7 +139,7 @@
}
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("INSERT INTO UsersInRoles " + " (Username, Rolename, ApplicationName) " + " Values(?Username, ?Rolename, ?ApplicationName)", conn);
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO MySqlWebUsersInRoles " + " (Username, Rolename, ApplicationName) " + " Values(?Username, ?Rolename, ?ApplicationName)", conn);
MySqlParameter userParm = cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255);
MySqlParameter roleParm = cmd.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255);
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
@@ -195,7 +195,7 @@
throw new ProviderException("Role name already exists.");
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("INSERT INTO Roles " + " (Rolename, ApplicationName) " + " Values(?Rolename, ?ApplicationName)", conn);
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO MySqlWebRoles " + " (Rolename, ApplicationName) " + " Values(?Rolename, ?ApplicationName)", conn);
cmd.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255).Value = rolename;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
try
@@ -231,10 +231,10 @@
throw new ProviderException("Cannot delete a populated role.");
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("DELETE FROM Roles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("DELETE FROM MySqlWebRoles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255).Value = rolename;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
- MySqlCommand cmd2 = new MySqlCommand("DELETE FROM UsersInRoles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd2 = new MySqlCommand("DELETE FROM MySqlWebUsersInRoles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
cmd2.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255).Value = rolename;
cmd2.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MySqlTransaction tran = null;
@@ -278,7 +278,7 @@
{
string tmpRoleNames = "";
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Rolename FROM Roles " + " WHERE ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Rolename FROM MySqlWebRoles " + " WHERE ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MySqlDataReader reader = null;
@@ -322,7 +322,7 @@
{
string tmpRoleNames = "";
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Rolename FROM UsersInRoles " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Rolename FROM MySqlWebUsersInRoles " + " WHERE Username = ?Username AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MySqlDataReader reader = null;
@@ -355,7 +355,7 @@
{
string tmpUserNames = "";
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Username FROM UsersInRoles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Username FROM MySqlWebUsersInRoles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255).Value = rolename;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
MySqlDataReader reader = null;
@@ -388,7 +388,7 @@
{
bool userIsInRole = false;
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT COUNT(*) FROM UsersInRoles " + " WHERE Username = ?Username AND Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT COUNT(*) FROM MySqlWebUsersInRoles " + " WHERE Username = ?Username AND Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255).Value = username;
cmd.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255).Value = rolename;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
@@ -439,7 +439,7 @@
}
}
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("DELETE FROM UsersInRoles " + " WHERE Username = ?Username AND Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("DELETE FROM MySqlWebUsersInRoles " + " WHERE Username = ?Username AND Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
MySqlParameter userParm = cmd.Parameters.Add("?Username", MySqlDbType.VarChar, 255);
MySqlParameter roleParm = cmd.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255);
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
@@ -488,7 +488,7 @@
{
bool exists = false;
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT COUNT(*) FROM Roles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT COUNT(*) FROM MySqlWebRoles " + " WHERE Rolename = ?Rolename AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?Rolename", MySqlDbType.VarChar, 255).Value = rolename;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
try
@@ -521,7 +521,7 @@
public override string[] FindUsersInRole(string rolename, string usernameToMatch)
{
MySqlConnection conn = new MySqlConnection(connectionString);
- MySqlCommand cmd = new MySqlCommand("SELECT Username FROM UsersInRoles " + "WHERE Username LIKE ?UsernameSearch AND RoleName = ?RoleName AND ApplicationName = ?ApplicationName", conn);
+ MySqlCommand cmd = new MySqlCommand("SELECT Username FROM MySqlWebUsersInRoles " + "WHERE Username LIKE ?UsernameSearch AND RoleName = ?RoleName AND ApplicationName = ?ApplicationName", conn);
cmd.Parameters.Add("?UsernameSearch", MySqlDbType.VarChar, 255).Value = usernameToMatch;
cmd.Parameters.Add("?RoleName", MySqlDbType.VarChar, 255).Value = rolename;
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = pApplicationName;
Modified: trunk/Package.build
===================================================================
--- trunk/Package.build 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Package.build 2007-03-01 21:03:34 UTC (rev 624)
@@ -9,7 +9,7 @@
<include name="Driver/MySql.Data.2005.csproj"/>
<include name="Driver/Properties/**"/>
<include name="Driver/Source/**"/>
- <include name="installer/*"/>
+ <include name="installer/**"/>
<include name="testsuite/**"/>
<include name="Client.build"/>
<include name="CHANGES"/>
@@ -112,9 +112,9 @@
<target name="MakeInstaller">
<!-- now build the WIX installer -->
<exec workingdir="staging/Installer" program="candle"
- commandline="-dIsGPL=${IsGPL} -dbuild=release main.wxs samples.wxs sources.wxs"/>
+ commandline="-ext WixNetFxExtension -dIsGPL=${IsGPL} -dbuild=release main.wxs samples.wxs sources.wxs"/>
<exec workingdir="staging/Installer" program="light"
- commandline="-sval -ext WixUIExtension -cultures:en-us main.wixobj samples.wixobj sources.wixobj -out MySql.Data.msi"/>
+ commandline="-sval -ext WixNetFxExtension -ext WixUIExtension -cultures:en-us main.wixobj samples.wixobj sources.wixobj -out MySql.Data.msi"/>
</target>
<!-- verification targets -->
Modified: trunk/README
===================================================================
--- trunk/README 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/README 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-MySQL Connector/Net 5.0.3
+MySQL Connector/Net 5.0.4
MySQL AB's ADO.Net Driver for MySQL
Copyright (c) 2004-2006 MySQL AB
Modified: trunk/Release Notes.txt
===================================================================
--- trunk/Release Notes.txt 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/Release Notes.txt 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,61 +1,34 @@
-Connector/Net 5.0.3 Release Notes
+Connector/Net 5.0.4 Release Notes
------------------------------------
-Welcome to the release notes for Connector/Net 5.0.3.
+Welcome to the release notes for Connector/Net 5.0.4.
-This version of the connector incorporates many changes to its internal structure that
-will provide both increased speed and flexibility. Speed is increased by allowing column
-values to be processed without ever being boxed (if you use MySqlDataReader) and flexibility
-is increased by virtualizing the execution engine. This virtualization will allow future
-versions of the Connector to support the embedded server and to use the client library.
-
-Many more features have been added to this version including Usage Advisor, PerfMon hooks,
-asynchronous queries, and full ADO.net 2.0 support.
-
-.NET 1.0 binaries not included
---------------------------------------
-We believe that most of our users have moved their projects to .NET Framework 1.1 or higher. To this end,
-we are no longer providing binaries for .NET 1.0. The code should still compile to that target
-so any users who need this should be able to build it.
-
-.NET 1.1 binaries not included
---------------------------------------
-This release only ships with a .NET 2.0 compiled binary. The reason for this is because
-most of the core classes in the provider now derive from base classes provided by .NET 2.0.
-These include classes like DbCommand, DbConnection, etc. In order to ship binaries for
-.NET 1.1 using this code base, we would need to build our own set of base classes that
-mirror what the .NET 2.0 base classes are doing. We are working on this but those classes are
-not done yet. Again, rather than wait for those classes to be finished we decided to release
-what we have and start gathering feedback. Look for a .NET 1.1 version of Connector/Net 5 in the
-near future.
-
-Mono support
-------------
-Look for a Mono package in the near future.
-
-Functionality changes
+Important Changes
---------------------
-There are a number of functionality changes in this release compared to the 1.0 line. Those
-have been documented in the help file but we'll make a brief note about them here.
-* We no longer support having both a stored procedure and a stored function with the same
- name in the same database. MySQL supports this but the connector does not. If you attempt
- to call a stored procedure or stored function while a stored routine of the same name
- exists in that database, a MySqlException will be raised.
+* We've added support for MySqlParameterCollection.AddWithValue. This method should
+ be used whenever you are wanting to add a parameter by name and set its value in a
+ single method call. The previous .Add overload is marked as deprecated and will give
+ a compiler warning if you continue to use it.
-* Some of the type safe methods on MySqlDataReader such as GetString() will now
- throw an exception if you call them on a null column. You should use IsNull to check for
- a column's nullness.
+* This release includes support for calling stored procedures without having privileges
+ on the mysql.proc table. This is accomplished by adding 'Use Procedure Bodies=false' to
+ your connection string. The default is true (which means by default you still need
+ access to mysql.proc). Since MySQL does not yet support an information schema parameters
+ view, the connector has to trust the order of parameters that you set on the command.
+ So, to call a procedure using a limited privilege account, set 'Use Procedure Bodies=false'
+ on your connection string, add parameters to your command object in the exact same order
+ they appear in the procedure definition, and make sure all the parameters have their
+ type set.
-* MySqlCommandBuilder no longer has constructors for specifying 'last one wins' type of conflict
- resolution. You should use the ConflictOption property to specify this.
+* With 5.0.3, we required that all parameters start with the parameter marker (default is ?).
+ This was not fully thought out and has been rolled out in this release. With this release,
+ you can add parameters with or without the leading parameter marker. One thing to understand
+ though is that the IndexOf method of MySqlParameterCollection is still sensitive to the name.
+ What this means is that if you add a parameter with the name '?parm1' and then call IndexOf
+ with the value 'parm1', it will return -1.
-* MySqlCommandBuilder also no longer includes a select statement on the end of the update
- statement to refresh the dataset or datatable after an update. If you have server generated
- values and you need to retrieve them, you can either handcraft the update statement or
- refill your table or dataset.
+* Connecion pooling has been significantly changed in this release. Now, a semaphore is used
+ to control access to the pool. This significantly reduces CPU time incurred while waiting
+ on a connection to free and greatly simplifies the locking code involved.
-* MySqlCommandBuilder also no longer supports updating datasets and datatables where the user
- has specified a custom value for an autoincrement field. This is a limitation of .NET 2.0.
-
-
Modified: trunk/TestSuite/AsyncTests.cs
===================================================================
--- trunk/TestSuite/AsyncTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/AsyncTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/BaseTest.cs
===================================================================
--- trunk/TestSuite/BaseTest.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/BaseTest.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/BlobTests.cs
===================================================================
--- trunk/TestSuite/BlobTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/BlobTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -153,7 +153,7 @@
data[x] = (char)(65 + (x % 20));
MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (1, NULL, ?text1)", conn);
- cmd.Parameters.Add("?text1", data);
+ cmd.Parameters.AddWithValue("?text1", data);
if (prepare)
cmd.Prepare();
cmd.ExecuteNonQuery();
@@ -225,7 +225,7 @@
cmd.CommandText = "INSERT INTO Test VALUES(2, ?b1, ?t1)";
cmd.Parameters.Clear();
- cmd.Parameters.Add("?t1", DBNull.Value);
+ cmd.Parameters.AddWithValue("?t1", DBNull.Value);
string str = "This is my text value";
cmd.Parameters.Add(new MySqlParameter("?b1", MySqlDbType.LongBlob, str.Length,
ParameterDirection.Input, true, 0, 0, "b1", DataRowVersion.Current, str));
@@ -341,12 +341,12 @@
for (int x = 0; x < image.Length; x++)
image[x] = (byte)(x % 47);
MySqlCommand cmd = new MySqlCommand("INSERT INTO test VALUES(NULL, ?image, ?size)", conn);
- cmd.Parameters.Add("?image", image);
- cmd.Parameters.Add("?size", image.Length);
+ cmd.Parameters.AddWithValue("?image", image);
+ cmd.Parameters.AddWithValue("?size", image.Length);
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT imageSize, length(image), image FROM test WHERE id=?id";
- cmd.Parameters.Add("?id", 1);
+ cmd.Parameters.AddWithValue("?id", 1);
cmd.Prepare();
MySqlDataReader reader = null;
@@ -390,7 +390,7 @@
byte[] image = Utils.CreateBlob(1000000);
cmd.CommandText = "INSERT INTO test VALUES(NULL, ?image)";
- cmd.Parameters.Add("?image", image);
+ cmd.Parameters.AddWithValue("?image", image);
cmd.ExecuteNonQuery();
Assert.Fail("This should have thrown an exception");
}
Modified: trunk/TestSuite/CharacterSetTests.cs
===================================================================
--- trunk/TestSuite/CharacterSetTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/CharacterSetTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-+
@@ -154,6 +154,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Modified: trunk/TestSuite/CommandBuilderTests.cs
===================================================================
--- trunk/TestSuite/CommandBuilderTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/CommandBuilderTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/CommandTests.cs
===================================================================
--- trunk/TestSuite/CommandTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/CommandTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -158,7 +158,7 @@
MySqlCommand clone = new MySqlCommand(cmd.CommandText, (MySqlConnection)cmd.Connection,
(MySqlTransaction)cmd.Transaction);
- clone.Parameters.Add("?test", 1);
+ clone.Parameters.AddWithValue("?test", 1);
txn.Rollback();
}
Modified: trunk/TestSuite/ConnectionStringBuilder.cs
===================================================================
--- trunk/TestSuite/ConnectionStringBuilder.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/ConnectionStringBuilder.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/ConnectionTests.cs
===================================================================
--- trunk/TestSuite/ConnectionTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/ConnectionTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/CultureTests.cs
===================================================================
--- trunk/TestSuite/CultureTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/CultureTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/CursorTests.cs
===================================================================
--- trunk/TestSuite/CursorTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/CursorTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/DataAdapterTests.cs
===================================================================
--- trunk/TestSuite/DataAdapterTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/DataAdapterTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -568,5 +568,20 @@
Assert.Fail(ex.Message);
}
}
+
+ [Test]
+ public void RangeFill()
+ {
+ execSQL("DROP TABLE IF EXISTS test");
+ execSQL("CREATE TABLE test (id INT)");
+ execSQL("INSERT INTO test VALUES (1)");
+ execSQL("INSERT INTO test VALUES (2)");
+ execSQL("INSERT INTO test VALUES (3)");
+ execSQL("INSERT INTO test VALUES (4)");
+
+ MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", conn);
+ DataSet ds = new DataSet();
+ da.Fill(ds, 1, 2, "test");
+ }
}
}
Modified: trunk/TestSuite/DataReaderTests.cs
===================================================================
--- trunk/TestSuite/DataReaderTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/DataReaderTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -130,7 +130,7 @@
byte[] bytes = Utils.CreateBlob(len);
MySqlCommand cmd = new MySqlCommand(
"INSERT INTO Test (id, name, b1) VALUES(1, 'Test', ?b1)", conn);
- cmd.Parameters.Add("?b1", bytes);
+ cmd.Parameters.AddWithValue("?b1", bytes);
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT * FROM Test";
@@ -599,7 +599,7 @@
"SELECT id, dt, b1 FROM Test WHERE id < ?param1; "+
"SELECT b1 FROM Test WHERE id >= ?param1;", conn);
- cmd.Parameters.Add("?param1",50);
+ cmd.Parameters.AddWithValue("?param1",50);
reader = cmd.ExecuteReader();
Modified: trunk/TestSuite/DataTypeTests.cs
===================================================================
--- trunk/TestSuite/DataTypeTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/DataTypeTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -179,8 +179,8 @@
Guid g = Guid.NewGuid();
cmd.CommandText = "INSERT INTO Test VALUES (?id, ?guid, NULL, NULL, NULL)";
- cmd.Parameters.Add( new MySqlParameter("?id", 1));
- cmd.Parameters.Add( new MySqlParameter( "?guid", g ));
+ cmd.Parameters.Add(new MySqlParameter("?id", 1));
+ cmd.Parameters.Add(new MySqlParameter("?guid", g));
cmd.ExecuteNonQuery();
cmd.Parameters[0].Value = 2;
@@ -202,25 +202,25 @@
cmd.CommandText = "SELECT * FROM Test";
reader = cmd.ExecuteReader();
- Assert.AreEqual( true, reader.Read() );
+ Assert.AreEqual(true, reader.Read());
Guid newG = reader.GetGuid(1);
- Assert.AreEqual( g, newG );
+ Assert.AreEqual(g, newG);
- Assert.AreEqual( true, reader.Read() );
+ Assert.AreEqual(true, reader.Read());
newG = reader.GetGuid(1);
- Assert.AreEqual( g, newG );
+ Assert.AreEqual(g, newG);
- Assert.AreEqual( true, reader.Read() );
+ Assert.AreEqual(true, reader.Read());
newG = reader.GetGuid(1);
- Assert.AreEqual( g, newG );
+ Assert.AreEqual(g, newG);
- Assert.AreEqual( true, reader.Read() );
+ Assert.AreEqual(true, reader.Read());
newG = reader.GetGuid(1);
- Assert.AreEqual( g, newG );
+ Assert.AreEqual(g, newG);
}
catch (Exception ex)
{
- Assert.Fail( ex.Message );
+ Assert.Fail(ex.Message);
}
finally
{
@@ -553,7 +553,7 @@
execSQL("CREATE TABLE test (val decimal(10,1))");
MySqlCommand cmd = new MySqlCommand("INSERT INTO test VALUES(?dec)", conn);
- cmd.Parameters.Add("?dec", (decimal)2.4);
+ cmd.Parameters.AddWithValue("?dec", (decimal)2.4);
Assert.AreEqual(1, cmd.ExecuteNonQuery());
cmd.Prepare();
@@ -592,7 +592,7 @@
execSQL("CREATE TABLE test (val decimal(10,1))");
MySqlCommand cmd = new MySqlCommand("INSERT INTO test VALUES(?dec)", conn);
- cmd.Parameters.Add("?dec", (decimal)2.4);
+ cmd.Parameters.AddWithValue("?dec", (decimal)2.4);
Assert.AreEqual(1, cmd.ExecuteNonQuery());
cmd.Prepare();
@@ -733,5 +733,27 @@
Assert.AreEqual(-24, ts.Minutes);
Assert.AreEqual(0, ts.Seconds);
}
+
+ /// <summary>
+ /// Bug #25605 BINARY and VARBINARY is returned as a string
+ /// </summary>
+ [Category("NotWorking")]
+ [Test]
+ public void BinaryAndVarBinary()
+ {
+ MySqlCommand cmd = new MySqlCommand("SELECT BINARY 'something' AS BinaryData", conn);
+ using (MySqlDataReader reader = cmd.ExecuteReader())
+ {
+ reader.Read();
+ byte[] buffer = new byte[2];
+ long read = reader.GetBytes(0, 0, buffer, 0, 2);
+ Assert.AreEqual('s', buffer[0]);
+ Assert.AreEqual('o', buffer[1]);
+ Assert.AreEqual(2, read);
+
+ string s = reader.GetString(0);
+ Assert.AreEqual("something", s);
+ }
+ }
}
}
Modified: trunk/TestSuite/DateTimeTests.cs
===================================================================
--- trunk/TestSuite/DateTimeTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/DateTimeTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -130,14 +130,14 @@
[Test]
public void DateAdd()
{
- MySqlCommand cmd = new MySqlCommand( "select date_add(?someday, interval 1 hour)",
+ MySqlCommand cmd = new MySqlCommand("select date_add(?someday, interval 1 hour)",
conn);
DateTime now = DateTime.Now;
DateTime later = now.AddHours(1);
later = later.AddMilliseconds(later.Millisecond * -1);
- cmd.Parameters.Add("?someday", now );
+ cmd.Parameters.AddWithValue("?someday", now);
MySqlDataReader reader = null;
- try
+ try
{
reader = cmd.ExecuteReader();
Assert.IsTrue(reader.Read());
@@ -149,7 +149,7 @@
}
catch (Exception ex)
{
- Assert.Fail( ex.Message );
+ Assert.Fail(ex.Message);
}
finally
{
@@ -418,7 +418,7 @@
{
execSQL("INSERT INTO test VALUES(1, Now(), '0000-00-00', NULL, NULL)");
MySqlCommand cmd = new MySqlCommand("SELECT d FROM test WHERE id=?id", conn);
- cmd.Parameters.Add("?id", 1);
+ cmd.Parameters.AddWithValue("?id", 1);
cmd.Prepare();
MySqlDataReader reader = null;
try
Modified: trunk/TestSuite/EventTests.cs
===================================================================
--- trunk/TestSuite/EventTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/EventTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/ExceptionTests.cs
===================================================================
--- trunk/TestSuite/ExceptionTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/ExceptionTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/GetSchemaTests.cs
===================================================================
--- trunk/TestSuite/GetSchemaTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/GetSchemaTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -499,7 +499,36 @@
Assert.AreEqual("id", row["REFERENCED_COLUMN_NAME"]);
}
+ /// <summary>
+ /// Bug #26660 MySqlConnection.GetSchema fails with NullReferenceException for Foreign Keys
+ /// </summary>
[Test]
+ public void ForeignKeys()
+ {
+ execSQL("DROP TABLE IF EXISTS product_order");
+ execSQL("DROP TABLE IF EXISTS product");
+ execSQL("DROP TABLE IF EXISTS customer");
+ execSQL("CREATE TABLE product (category INT NOT NULL, id INT NOT NULL, " +
+ "price DECIMAL, PRIMARY KEY(category, id)) TYPE=INNODB");
+ execSQL("CREATE TABLE customer (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB");
+ execSQL("CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT, " +
+ "product_category INT NOT NULL, product_id INT NOT NULL, customer_id INT NOT NULL, " +
+ "PRIMARY KEY(no), INDEX (product_category, product_id), " +
+ "FOREIGN KEY (product_category, product_id) REFERENCES product(category, id) " +
+ "ON UPDATE CASCADE ON DELETE RESTRICT, INDEX (customer_id), " +
+ "FOREIGN KEY (customer_id) REFERENCES customer(id)) TYPE=INNODB");
+
+ try
+ {
+ DataTable dt = conn.GetSchema("Foreign Keys");
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
+ }
+
+ [Test]
public void MultiSingleForeignKey()
{
execSQL("DROP TABLE IF EXISTS product_order");
Modified: trunk/TestSuite/InterfaceTests.cs
===================================================================
--- trunk/TestSuite/InterfaceTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/InterfaceTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/LanguageTests.cs
===================================================================
--- trunk/TestSuite/LanguageTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/LanguageTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -383,7 +383,6 @@
cmd.CommandText = "SELECT id FROM test WHERE value = ?parameter";
cmd.Parameters.Add("?parameter", MySqlDbType.VarString);
cmd.Parameters[0].Value = "šđč枊ĐČĆŽ";
- cmd.CommandTimeout = 0;
object o = cmd.ExecuteScalar();
Assert.AreEqual(1, o);
}
Modified: trunk/TestSuite/MicroPerfTests.cs
===================================================================
--- trunk/TestSuite/MicroPerfTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/MicroPerfTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/MySqlHelperTests.cs
===================================================================
--- trunk/TestSuite/MySqlHelperTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/MySqlHelperTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/ParameterTests.cs
===================================================================
--- trunk/TestSuite/ParameterTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/ParameterTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -220,8 +220,8 @@
conn2.Open();
MySqlCommand cmd = new MySqlCommand("INSERT INTO Test (id, name) VALUES (@id, @name)", conn2);
- cmd.Parameters.Add( "@id", 33 );
- cmd.Parameters.Add( "@name", "Test" );
+ cmd.Parameters.AddWithValue( "@id", 33 );
+ cmd.Parameters.AddWithValue( "@name", "Test" );
cmd.ExecuteNonQuery();
MySqlDataReader reader = null;
@@ -371,7 +371,7 @@
public void UnTypedParameterBeingReused()
{
MySqlCommand cmd = new MySqlCommand("INSERT INTO test (id, dt) VALUES (?id, ?dt)", conn);
- cmd.Parameters.Add("?id", 1);
+ cmd.Parameters.AddWithValue("?id", 1);
MySqlParameter p = cmd.CreateParameter();
p.ParameterName = "?dt";
p.Value = DBNull.Value;
@@ -400,15 +400,15 @@
try
{
MySqlCommand cmd = new MySqlCommand("INSERT INTO test (id, name) VALUES (?id, ?name)", conn);
- cmd.Parameters.Add("?id", 1);
- cmd.Parameters.Add("?name", "test");
+ cmd.Parameters.AddWithValue("?id", 1);
+ cmd.Parameters.AddWithValue("?name", "test");
cmd.ExecuteNonQuery();
cmd.CommandText = "INSERT INTO test (id, name, dt) VALUES (?id1, ?name1, ?id)";
cmd.Parameters[0].ParameterName = "?id1";
cmd.Parameters[0].Value = 2;
cmd.Parameters[1].ParameterName = "?name1";
- cmd.Parameters.Add("?id", DateTime.Now);
+ cmd.Parameters.AddWithValue("?id", DateTime.Now);
cmd.ExecuteNonQuery();
}
catch (Exception ex)
@@ -416,5 +416,48 @@
Assert.Fail(ex.Message);
}
}
+
+ [Test]
+ public void WithAndWithoutMarker()
+ {
+ try
+ {
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO test (id, name) VALUES (?id, ?name)", conn);
+ cmd.Parameters.AddWithValue("id", 1);
+ Assert.AreEqual(-1, cmd.Parameters.IndexOf("?id"));
+ cmd.Parameters.AddWithValue("name", "test");
+ cmd.ExecuteNonQuery();
+
+ cmd.Parameters.Clear();
+ cmd.Parameters.AddWithValue("?id", 2);
+ Assert.AreEqual(-1, cmd.Parameters.IndexOf("id"));
+ cmd.Parameters.AddWithValue("?name", "test2");
+ cmd.ExecuteNonQuery();
+
+ cmd.CommandText = "SELECT COUNT(*) FROM test";
+ object count = cmd.ExecuteScalar();
+ Assert.AreEqual(2, count);
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
+ }
+
+ [Test]
+ public void DoubleAddingParameters()
+ {
+ try
+ {
+ MySqlCommand cmd = new MySqlCommand("INSERT INTO test (id, name) VALUES (?id, ?name)", conn);
+ cmd.Parameters.AddWithValue("id", 1);
+ cmd.Parameters.AddWithValue("name", "test");
+ cmd.Parameters.AddWithValue("?id", 2);
+ Assert.Fail("Should not get here");
+ }
+ catch (Exception)
+ {
+ }
+ }
}
}
Modified: trunk/TestSuite/PerfMonTests.cs
===================================================================
--- trunk/TestSuite/PerfMonTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/PerfMonTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -69,7 +69,7 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?id", 1);
+ cmd.Parameters.AddWithValue("?id", 1);
cmd.ExecuteScalar();
Assert.AreEqual(hardCount + 1, hardQuery.RawValue);
@@ -78,7 +78,7 @@
MySqlCommand cmd2 = new MySqlCommand("spTest", conn);
cmd2.CommandType = CommandType.StoredProcedure;
- cmd2.Parameters.Add("?id", 1);
+ cmd2.Parameters.AddWithValue("?id", 1);
cmd2.ExecuteScalar();
Assert.AreEqual(hardCount, hardQuery.RawValue);
Modified: trunk/TestSuite/PoolingTests.cs
===================================================================
--- trunk/TestSuite/PoolingTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/PoolingTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-+
@@ -223,6 +223,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Modified: trunk/TestSuite/PreparedStatements.cs
===================================================================
--- trunk/TestSuite/PreparedStatements.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/PreparedStatements.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -127,10 +127,10 @@
dt = dt.AddMilliseconds( dt.Millisecond * -1 );
TimeSpan ts = new TimeSpan( 8, 11, 44, 56, 501 );
- cmd.Parameters.Add( "?id", 1 );
- cmd.Parameters.Add( "?d", dt );
- cmd.Parameters.Add( "?dt", dt );
- cmd.Parameters.Add( "?tm", ts );
+ cmd.Parameters.AddWithValue("?id", 1);
+ cmd.Parameters.AddWithValue("?d", dt);
+ cmd.Parameters.AddWithValue("?dt", dt);
+ cmd.Parameters.AddWithValue("?tm", ts);
int count = cmd.ExecuteNonQuery();
Assert.AreEqual( 1, count, "Records affected by insert" );
@@ -264,9 +264,9 @@
byte[] bytes = Utils.CreateBlob( 400000 );
string inStr = "This is my text";
- cmd.Parameters.Add( "?id", 1 );
- cmd.Parameters.Add( "?blob1", bytes );
- cmd.Parameters.Add( "?text1", inStr );
+ cmd.Parameters.AddWithValue("?id", 1);
+ cmd.Parameters.AddWithValue("?blob1", bytes);
+ cmd.Parameters.AddWithValue("?text1", inStr);
int count = cmd.ExecuteNonQuery();
Assert.AreEqual( 1, count );
@@ -354,11 +354,11 @@
dt = dt.AddMilliseconds( dt.Millisecond * -1 );
byte[] xpDOSG_Avatar = Utils.CreateBlob( 13000 );
- cmd.Parameters.Add( "?name", "Ceci est un nom");
+ cmd.Parameters.AddWithValue("?name", "Ceci est un nom");
- cmd.Parameters.Add( "?desc", "Ceci est une description facile - cmd.Parameters.Add( "?avatar",xpDOSG_Avatar);
- cmd.Parameters.Add( "?dt", dt);
+ cmd.Parameters.AddWithValue("?desc", "Ceci est une description facile + cmd.Parameters.AddWithValue("?avatar",xpDOSG_Avatar);
+ cmd.Parameters.AddWithValue("?dt", dt);
int count = cmd.ExecuteNonQuery();
Assert.AreEqual( 1, count );
@@ -603,19 +603,22 @@
command.Connection = (MySqlConnection)conn;
command.Prepare();
- command.Parameters.Add("?id", (byte)127);
+ command.Parameters.AddWithValue("?id", (byte)127);
object count = command.ExecuteScalar();
Assert.AreEqual(1, count);
- command.Parameters.Add("?id", (byte)128);
+ command.Parameters.Clear();
+ command.Parameters.AddWithValue("?id", (byte)128);
count = command.ExecuteScalar();
Assert.AreEqual(1, count);
- command.Parameters.Add("?id", (byte)255);
+ command.Parameters.Clear();
+ command.Parameters.AddWithValue("?id", (byte)255);
count = command.ExecuteScalar();
Assert.AreEqual(1, count);
- command.Parameters.Add("?id", "255");
+ command.Parameters.Clear();
+ command.Parameters.AddWithValue("?id", "255");
count = command.ExecuteScalar();
Assert.AreEqual(1, count);
}
Modified: trunk/TestSuite/Properties/AssemblyInfo.cs
===================================================================
--- trunk/TestSuite/Properties/AssemblyInfo.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/Properties/AssemblyInfo.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -31,7 +31,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("MySQL AB")]
[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("Copyright 2004-2006, MySQL AB")]
+[assembly: AssemblyCopyright("Copyright 2004-2007, MySQL AB")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -46,7 +46,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
-[assembly: AssemblyVersion("5.0.3")]
+[assembly: AssemblyVersion("5.0.4")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
Modified: trunk/TestSuite/SimpleTransactions.cs
===================================================================
--- trunk/TestSuite/SimpleTransactions.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/SimpleTransactions.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/StoredProcedure.cs
===================================================================
--- trunk/TestSuite/StoredProcedure.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/StoredProcedure.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -88,7 +88,7 @@
//setup testing data
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?value", 2);
+ cmd.Parameters.AddWithValue("?value", 2);
int rowsAffected = cmd.ExecuteNonQuery();
Assert.AreEqual(1, rowsAffected);
@@ -185,7 +185,7 @@
{
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?p2", 1);
+ cmd.Parameters.AddWithValue("?p2", 1);
cmd.ExecuteNonQuery();
Assert.Fail("Should have thrown an exception");
}
@@ -202,7 +202,7 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?valin", "myvalue");
+ cmd.Parameters.AddWithValue("?valin", "myvalue");
object val = cmd.ExecuteScalar();
Assert.AreEqual("myvalue", val);
}
@@ -216,9 +216,9 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?strVal", "beginning");
- cmd.Parameters.Add("?numVal", 33);
- cmd.Parameters.Add("?outVal", MySqlDbType.Int32);
+ cmd.Parameters.AddWithValue("?strVal", "beginning");
+ cmd.Parameters.AddWithValue("?numVal", 33);
+ cmd.Parameters.AddWithValue("?outVal", MySqlDbType.Int32);
cmd.Parameters[0].Direction = ParameterDirection.InputOutput;
cmd.Parameters[1].Direction = ParameterDirection.InputOutput;
cmd.Parameters[2].Direction = ParameterDirection.Output;
@@ -253,7 +253,7 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?valin", "valuein");
+ cmd.Parameters.AddWithValue("?valin", "valuein");
cmd.Parameters.Add(new MySqlParameter("?valout", MySqlDbType.VarChar));
cmd.Parameters[1].Direction = ParameterDirection.Output;
object result = cmd.ExecuteScalar();
@@ -283,17 +283,18 @@
{
// create our procedure
execSQL("CREATE PROCEDURE spTest(OUT p INT) " +
- "BEGIN SELECT * FROM mysql.db; SET p=2; END");
+ "BEGIN SELECT 1; SET p=2; END");
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.Parameters.Add("?p", MySqlDbType.Int32);
cmd.Parameters[0].Direction = ParameterDirection.Output;
cmd.CommandType = CommandType.StoredProcedure;
- MySqlDataReader reader = cmd.ExecuteReader();
- Assert.AreEqual(true, reader.Read());
- Assert.AreEqual(false, reader.NextResult());
- Assert.AreEqual(false, reader.Read());
- reader.Close();
+ using (MySqlDataReader reader = cmd.ExecuteReader())
+ {
+ Assert.AreEqual(true, reader.Read());
+ Assert.AreEqual(false, reader.NextResult());
+ Assert.AreEqual(false, reader.Read());
+ }
Assert.AreEqual(2, cmd.Parameters[0].Value);
}
@@ -383,7 +384,7 @@
MySqlCommand cmd = new MySqlCommand("spTest", c2);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("@valin", "value");
+ cmd.Parameters.AddWithValue("@valin", "value");
cmd.Parameters.Add(new MySqlParameter("@valout", MySqlDbType.VarChar));
cmd.Parameters[1].Direction = ParameterDirection.Output;
object result = cmd.ExecuteScalar();
@@ -416,8 +417,8 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?valin", 20.4);
- cmd.Parameters.Add("?val2", 4);
+ cmd.Parameters.AddWithValue("?valin", 20.4);
+ cmd.Parameters.AddWithValue("?val2", 4);
decimal val = (decimal)cmd.ExecuteScalar();
Decimal d = new Decimal(20.4);
Assert.AreEqual(d, val);
@@ -436,14 +437,14 @@
/// Bug #10644 Cannot call a stored function directly from Connector/Net
/// Bug #25013 Return Value parameter not found
/// </summary>
- [Test]
+ [Test]
public void CallingStoredFunctionasProcedure()
{
execSQL("CREATE FUNCTION fnTest(valin int) RETURNS INT " +
" LANGUAGE SQL DETERMINISTIC BEGIN return valin * 2; END");
MySqlCommand cmd = new MySqlCommand("fnTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?valin", 22);
+ cmd.Parameters.AddWithValue("?valin", 22);
MySqlParameter retVal = cmd.CreateParameter();
retVal.ParameterName = "?retval";
retVal.MySqlDbType = MySqlDbType.Int32;
@@ -475,7 +476,7 @@
object val = cmd.ExecuteScalar();
Assert.AreEqual(4, val);
- cmd2.CommandText = "use mysql";
+ cmd2.CommandText = String.Format("use {0}", databases[1]);
cmd2.ExecuteNonQuery();
cmd.CommandText = String.Format("{0}.spTest", databases[0]);
@@ -621,7 +622,7 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?d", 21);
+ cmd.Parameters.AddWithValue("?d", 21);
decimal d = (decimal)cmd.ExecuteScalar();
Assert.AreEqual(21, d);
}
@@ -637,7 +638,7 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?P", "This is my value");
+ cmd.Parameters.AddWithValue("?P", "This is my value");
string p = (string)cmd.ExecuteScalar();
Assert.AreEqual("This is my value", p);
}
@@ -654,7 +655,7 @@
execSQL("CREATE PROCEDURE spTest(\"@Param1\" text) BEGIN SELECT \"@Param1\"; END");
MySqlCommand cmd = new MySqlCommand("spTest", conn);
- cmd.Parameters.Add("?@Param1", "This is my value");
+ cmd.Parameters.AddWithValue("?@Param1", "This is my value");
cmd.CommandType = CommandType.StoredProcedure;
string val = (string)cmd.ExecuteScalar();
@@ -678,7 +679,7 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?P", 33);
+ cmd.Parameters.AddWithValue("?P", 33);
cmd.Prepare();
int p = (int)cmd.ExecuteScalar();
@@ -698,12 +699,13 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?id", 1);
- cmd.Parameters.Add("?str", "First record");
+ cmd.Parameters.AddWithValue("?id", 1);
+ cmd.Parameters.AddWithValue("?str", "First record");
cmd.ExecuteNonQuery();
- cmd.Parameters.Add("?id", 2);
- cmd.Parameters.Add("?str", "Second record");
+ cmd.Parameters.Clear();
+ cmd.Parameters.AddWithValue("?id", 2);
+ cmd.Parameters.AddWithValue("?str", "Second record");
cmd.ExecuteNonQuery();
MySqlDataAdapter da = new MySqlDataAdapter("SELECT * FROM test", conn);
@@ -769,7 +771,7 @@
MySqlCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "spTest";
- cmd.Parameters.Add("?Name", "Item3");
+ cmd.Parameters.AddWithValue("?Name", "Item3");
cmd.Parameters.Add("?Table1Id", MySqlDbType.Int32);
cmd.Parameters["?Table1Id"].Direction = ParameterDirection.Output;
@@ -939,7 +941,7 @@
try
{
MySqlCommand cmd = new MySqlCommand("spTest", conn);
- cmd.Parameters.Add("?p_paramname", 2);
+ cmd.Parameters.AddWithValue("?p_paramname", 2);
cmd.CommandType = CommandType.StoredProcedure;
cmd.ExecuteScalar();
}
@@ -969,7 +971,7 @@
{
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?p_enum", "P");
+ cmd.Parameters.AddWithValue("?p_enum", "P");
cmd.Parameters["?p_enum"].Direction = ParameterDirection.Input;
using (MySqlDataReader reader = cmd.ExecuteReader())
{
@@ -1027,10 +1029,10 @@
MySqlCommand cmd = new MySqlCommand("spTest", c);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?id", 2);
- cmd.Parameters.Add("?outid", MySqlDbType.Int32);
+ cmd.Parameters.AddWithValue("?id", 2);
+ cmd.Parameters.AddWithValue("?outid", MySqlDbType.Int32);
cmd.Parameters[1].Direction = ParameterDirection.Output;
- cmd.Parameters.Add("?inoutid", 4);
+ cmd.Parameters.AddWithValue("?inoutid", 4);
cmd.Parameters[2].Direction = ParameterDirection.InputOutput;
cmd.ExecuteNonQuery();
@@ -1062,8 +1064,8 @@
MySqlCommand cmd = new MySqlCommand("fnTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.Parameters.Add("?p_kiosk", 2);
- cmd.Parameters.Add("?p_user", 4);
+ cmd.Parameters.AddWithValue("?p_kiosk", 2);
+ cmd.Parameters.AddWithValue("?p_user", 4);
try
{
cmd.ExecuteNonQuery();
@@ -1087,7 +1089,6 @@
MySqlCommand cmd = new MySqlCommand("spTest", conn);
cmd.CommandType = CommandType.StoredProcedure;
- cmd.CommandTimeout = 0;
MySqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly);
reader.Read();
@@ -1104,5 +1105,58 @@
}
}
+ /// <summary>
+ /// Bug #26139 MySqlCommand.LastInsertedId doesn't work for stored procedures
+ /// Currently this is borked on the server so we are marking this as notworking
+ /// until the server has this fixed.
+ /// </summary>
+ [Category("NotWorking")]
+ [Test]
+ public void LastInsertId()
+ {
+ execSQL("DROP TABLE IF EXISTS test");
+ execSQL("CREATE TABLE test (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(200))");
+ execSQL("INSERT INTO test VALUES (NULL, 'Test1')");
+ execSQL("CREATE PROCEDURE spTest() BEGIN " +
+ "INSERT INTO test VALUES (NULL, 'test'); END");
+
+ MySqlCommand cmd = new MySqlCommand("spTest", conn);
+ cmd.CommandType = CommandType.StoredProcedure;
+ cmd.ExecuteNonQuery();
+ Assert.AreEqual(2, cmd.LastInsertedId);
+ }
+
+ [Test]
+ public void NoAccessToProcedureBodies()
+ {
+ suExecSQL("DROP PROCEDURE IF EXISTS spTest");
+ suExecSQL("CREATE PROCEDURE spTest(in1 INT, INOUT inout1 INT, OUT out1 INT ) " +
+ "BEGIN SET inout1 = inout1+2; SET out1=inout1-3; SELECT in1; END");
+
+ string connStr = GetConnectionString(true) +"; use procedure bodies=false";
+ using (MySqlConnection c = new MySqlConnection(connStr))
+ {
+ try
+ {
+ c.Open();
+
+ MySqlCommand cmd = new MySqlCommand("spTest", c);
+ cmd.CommandType = CommandType.StoredProcedure;
+ cmd.Parameters.AddWithValue("?in1", 2);
+ cmd.Parameters.AddWithValue("?inout1", 4);
+ cmd.Parameters.Add("?out1", MySqlDbType.Int32);
+ cmd.Parameters[1].Direction = ParameterDirection.InputOutput;
+ cmd.Parameters[2].Direction = ParameterDirection.Output;
+ cmd.ExecuteNonQuery();
+
+ Assert.AreEqual(6, cmd.Parameters[1].Value);
+ Assert.AreEqual(3, cmd.Parameters[2].Value);
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail(ex.Message);
+ }
+ }
+ }
}
}
Modified: trunk/TestSuite/StressTests.cs
===================================================================
--- trunk/TestSuite/StressTests.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/StressTests.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/Syntax.cs
===================================================================
--- trunk/TestSuite/Syntax.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/Syntax.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
@@ -72,9 +72,9 @@
c.Open();
MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (?id, ?text, ?mt)", c);
- cmd.Parameters.Add("?id", 1);
- cmd.Parameters.Add("?text", "This is my;test ? string- cmd.Parameters.Add("?mt", "My MT string: + cmd.Parameters.AddWithValue("?id", 1);
+ cmd.Parameters.AddWithValue("?text", "This is my;test ? string+ cmd.Parameters.AddWithValue("?mt", "My MT string: ?");
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT * FROM Test";
@@ -85,7 +85,7 @@
Assert.IsTrue(reader.Read());
Assert.AreEqual(1, reader.GetInt32(0));
Assert.AreEqual("This is my;test ? string- Assert.AreEqual("My MT string: + Assert.AreEqual("My MT string: ?", reader.GetString(2));
}
catch (Exception ex)
{
@@ -107,9 +107,9 @@
"PRIMARY KEY(id))");
MySqlCommand cmd = new MySqlCommand("INSERT INTO Test VALUES (?id, ?text, ?mt)", conn);
- cmd.Parameters.Add("?id", 1);
- cmd.Parameters.Add("?text", "This is my;test ? string-'''\"\".");
- cmd.Parameters.Add("?mt", "My MT string: + cmd.Parameters.AddWithValue("?id", 1);
+ cmd.Parameters.AddWithValue("?text", "This is my;test ? string-'''\"\".");
+ cmd.Parameters.AddWithValue("?mt", "My MT string: ?");
cmd.ExecuteNonQuery();
cmd.CommandText = "SELECT * FROM Test";
@@ -120,7 +120,7 @@
Assert.IsTrue(reader.Read());
Assert.AreEqual(1, reader.GetInt32(0));
Assert.AreEqual("This is my;test ? string-'''\"\".", reader.GetString(1));
- Assert.AreEqual("My MT string: + Assert.AreEqual("My MT string: ?", reader.GetString(2));
}
catch (Exception ex)
{
Modified: trunk/TestSuite/Syntax2.cs
===================================================================
--- trunk/TestSuite/Syntax2.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/Syntax2.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/Threading.cs
===================================================================
--- trunk/TestSuite/Threading.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/Threading.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/TimeoutAndCancel.cs
===================================================================
--- trunk/TestSuite/TimeoutAndCancel.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/TimeoutAndCancel.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/Transactions.cs
===================================================================
--- trunk/TestSuite/Transactions.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/Transactions.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/UsageAdvisor.cs
===================================================================
--- trunk/TestSuite/UsageAdvisor.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/UsageAdvisor.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/TestSuite/Utils.cs
===================================================================
--- trunk/TestSuite/Utils.cs 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/TestSuite/Utils.cs 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
Modified: trunk/commercial-banner.txt
===================================================================
--- trunk/commercial-banner.txt 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/commercial-banner.txt 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB & MySQL Finland AB
+// Copyright (C) 2004-2007 MySQL AB & MySQL Finland AB
//
// This software is distributed with NO WARRANTY OF ANY KIND. No author or
// distributor accepts any responsibility for the consequences of using it, or
Modified: trunk/gpl-banner.txt
===================================================================
--- trunk/gpl-banner.txt 2007-03-01 20:06:50 UTC (rev 623)
+++ trunk/gpl-banner.txt 2007-03-01 21:03:34 UTC (rev 624)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2006 MySQL AB
+// Copyright (C) 2004-2007 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
| Thread |
|---|
| • Connector/NET commit: r624 - in trunk: . Driver/Properties Driver/Source Driver/Source/Types Driver/Source/common Driver/Source/docs Installer MySql.W... | rburnett | 1 Mar |