Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
Change-Id: Ic77d125f0377bf524927014a043685728b9938f6
  • Loading branch information
omachavez committed Jul 5, 2023
1 parent 0280e24 commit cb19459
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011, 2020 Oracle and/or its affiliates.
// Copyright (c) 2011, 2023 Oracle and/or its affiliates.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, version 2.0, as
Expand Down Expand Up @@ -89,12 +89,12 @@ public void CanCreateDBScriptWithDateTimePrecision()
DataTable schema = Connection.GetSchema("COLUMNS", new string[] { null, Connection.Database, "widgets" });

DataRow row = schema.Rows[3];
Assert.AreEqual("datetime", row.Field<string>("DATA_TYPE"));
Assert.AreEqual("NO", row.Field<string>("IS_NULLABLE"));
Assert.AreEqual("datetime", (string)row["DATA_TYPE"]);
Assert.AreEqual("NO", (string)row["IS_NULLABLE"]);
if (Version < new Version(8, 0))
Assert.AreEqual((uint)6, row.Field<UInt64>("DATETIME_PRECISION"));
Assert.AreEqual((uint)6, (UInt64)row["DATETIME_PRECISION"]);
else
Assert.AreEqual((uint)6, row.Field<UInt32>("DATETIME_PRECISION"));
Assert.AreEqual((uint)6, (UInt32)row["DATETIME_PRECISION"]);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>MySql.Data.EntityFramework.CodeFirTests</Description>
<Copyright>Copyright (c) 2016, 2023, Oracle and/or its affiliates.</Copyright>
<NeutralLanguage>en-US</NeutralLanguage>
<Version>8.1.0</Version>
<Authors>Oracle</Authors>
<TargetFrameworks>net462</TargetFrameworks>
<TargetFrameworks>net7.0</TargetFrameworks>
<AssemblyName>MySql.EntityFramework.Basic.Tests</AssemblyName>
<PackageId>MySql.EntityFramework.Basic.Tests</PackageId>
<PackageTags>MySql;.NET Connector;MySql Connector/NET</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<NeutralLanguage>en-US</NeutralLanguage>
<Version>8.1.0</Version>
<Authors>Oracle</Authors>
<TargetFrameworks>net462</TargetFrameworks>
<TargetFrameworks>net7.0</TargetFrameworks>
<AssemblyName>MySql.EntityFramework.CodeFirst.Tests</AssemblyName>
<PackageId>MySql.EntityFramework.CodeFirst.Tests</PackageId>
<PackageTags>MySql;.NET Connector;MySql Connector/NET</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>MySql.Data.EntityFramework.Migrations.Tests</Description>
<Copyright>Copyright (c) 2016, 2023, Oracle and/or its affiliates.</Copyright>
<NeutralLanguage>en-US</NeutralLanguage>
<Version>8.1.0</Version>
<Authors>Oracle</Authors>
<TargetFrameworks>net462</TargetFrameworks>
<TargetFrameworks>net7.0</TargetFrameworks>
<AssemblyName>MySql.EntityFramework.Migrations.Tests</AssemblyName>
<PackageId>MySql.EntityFramework.Migrations.Tests</PackageId>
<PackageTags>MySql;.NET Connector;MySql Connector/NET</PackageTags>
Expand All @@ -26,10 +26,6 @@
<NoWarn>CA2100</NoWarn>
</PropertyGroup>

<ItemGroup>
<None Include="App.config" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\MySQL.Data\src\MySql.Data.csproj" />
<ProjectReference Include="..\..\src\MySql.Data.EntityFramework.csproj" />
Expand All @@ -46,4 +42,19 @@
<ItemGroup Condition="'$(TargetFramework)'=='net462'">
<Reference Include="System.Configuration" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ConnString" xml:space="preserve">
<value>server=localhost;User Id=root;database=test;port=11240</value>
</data>
<data name="ConnStringMacOS" xml:space="preserve">
<value>server=localhost;User Id=root;database=test;port=11140</value>
</data>
</root>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2013, 2020 Oracle and/or its affiliates.
// Copyright (c) 2013, 2023 Oracle and/or its affiliates.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, version 2.0, as
Expand Down Expand Up @@ -26,13 +26,16 @@
// along with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

using MySql.Data.EntityFramework.Properties;
using MySql.Data.EntityFramework.Tests;
using NUnit.Framework;
using System;
using System.Configuration;
using System.Data;
using System.Data.Entity.Migrations;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;

namespace MySql.Data.EntityFramework.Migrations.Tests
{
Expand All @@ -46,8 +49,8 @@ public class SetUpMigrationsTests : DefaultFixture
[OneTimeSetUp]
public new void OneTimeSetup()
{
ConnectionStringBlogContext = $"{ConfigurationManager.ConnectionStrings["BlogsContext"].ConnectionString}port={Port}";

ConnectionStringBlogContext = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? MySql.EntityFramework.Migrations.Tests.Properties.Resources.ConnStringMacOS : MySql.EntityFramework.Migrations.Tests.Properties.Resources.ConnString;
configuration = new Configuration();
DataSet dataSet = ConfigurationManager.GetSection("system.data") as System.Data.DataSet;
if (dataSet != null)
Expand Down
2 changes: 1 addition & 1 deletion MySQL.Data/src/MySql.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="ZstdSharp.Port" Version="0.7.1" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="7.0.2" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
</ItemGroup>

<ItemGroup>
Expand All @@ -72,7 +73,6 @@

<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0' or '$(TargetFramework)'=='netstandard2.1' or '$(TargetFramework)'=='net6.0' or '$(TargetFramework)'=='net7.0'">
<Compile Remove="Framework/net462/*" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
<PackageReference Include="System.Security.Permissions" Version="4.7.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.4.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
Expand Down
3 changes: 1 addition & 2 deletions MySQL.Data/src/MySqlConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ internal async Task AbortAsync(bool execAsync, CancellationToken cancellationTok
}
}

//await driver.CloseAsync(execAsync).ConfigureAwait(false);
await driver.CloseAsync(execAsync).ConfigureAwait(false);
}
catch (Exception ex)
{
Expand All @@ -744,7 +744,6 @@ internal async Task AbortAsync(bool execAsync, CancellationToken cancellationTok
finally
{
this.IsInUse = false;
await driver.CloseAsync(execAsync).ConfigureAwait(false);
}
SetState(ConnectionState.Closed, true);
}
Expand Down
7 changes: 3 additions & 4 deletions MySQL.Data/src/StoredProcedure.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2004, 2022, Oracle and/or its affiliates.
// Copyright (c) 2004, 2023, Oracle and/or its affiliates.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License, version 2.0, as
Expand Down Expand Up @@ -177,11 +177,10 @@ private MySqlParameter GetAndFixParameter(string spName, MySqlSchemaRow param, b
string datatype = (string)param["DATA_TYPE"];
bool unsigned = GetFlags(param["DTD_IDENTIFIER"].ToString()).IndexOf("UNSIGNED") != -1;

if (param["ORDINAL_POSITION"].Equals(UInt64.MinValue))
if (Convert.ToUInt64(param["ORDINAL_POSITION"]) == 0)
{
if (returnParameter == null)
throw new InvalidOperationException(
String.Format(Resources.RoutineRequiresReturnParameter, spName));
throw new InvalidOperationException(String.Format(Resources.RoutineRequiresReturnParameter, spName));
pName = returnParameter.ParameterName;
}

Expand Down

0 comments on commit cb19459

Please sign in to comment.