Skip to content

NH-4014 - upgrading SQLite test binaries to v1.0.105.1 #629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lib/teamcity/sqlite/x64/System.Data.SQLite.dll
Binary file not shown.
Binary file modified lib/teamcity/sqlite/x86/System.Data.SQLite.dll
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">

<class
<class
name="NHibernate.DomainModel.NHSpecific.ClassWithNullColumns, NHibernate.DomainModel"
table="usertype"
>

table="usertype">

<id name="Id" column="id">
<generator class="assigned" />
</id>

<property
name="FirstInt32"
type="NHibernate.DomainModel.NHSpecific.NullInt32UserType, NHibernate.DomainModel"
column="f_int32"
not-null="false"
/>

<property
name="SecondInt32"
type="NHibernate.DomainModel.NHSpecific.NullInt32UserType, NHibernate.DomainModel"
column="s_int32"
not-null="false"
/>

</class>
</hibernate-mapping>

70 changes: 43 additions & 27 deletions src/NHibernate.Test/NHSpecificTest/UserTypeFixture.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections;
using System.Data.Common;
using NHibernate.Connection;
using NHibernate.DomainModel.NHSpecific;
using NUnit.Framework;
Expand All @@ -14,8 +13,15 @@ namespace NHibernate.Test.NHSpecificTest
public class UserTypeFixture : TestCase
{
protected override IList Mappings
=> new [] {"NHSpecific.ClassWithNullColumns.hbm.xml"};

protected override void OnTearDown()
{
get { return new string[] {"NHSpecific.ClassWithNullColumns.hbm.xml"}; }
using (var s = OpenSession())
{
s.Delete("from ClassWithNullColumns");
s.Flush();
}
}

/// <summary>
Expand All @@ -25,40 +31,50 @@ protected override IList Mappings
[Test]
public void InsertNull()
{
using (ISession s = OpenSession())
using (var s = OpenSession())
{
ClassWithNullColumns userTypeClass = new ClassWithNullColumns();
userTypeClass.Id = 5;
userTypeClass.FirstInt32 = 4;
userTypeClass.SecondInt32 = 0; // with the user type should set value to null
var userTypeClass = new ClassWithNullColumns
{
Id = 5,
FirstInt32 = 4,
SecondInt32 = 0
};
// with the user type should set 0 value to null

s.Save(userTypeClass);
s.Flush();
}

// manually read from the db
IConnectionProvider provider = ConnectionProviderFactory.NewConnectionProvider(cfg.Properties);
var conn = provider.GetConnection();
var cmd = conn.CreateCommand();
cmd.Connection = conn;
cmd.CommandText = "select * from usertype";

var reader = cmd.ExecuteReader();

while (reader.Read())
using (var provider = ConnectionProviderFactory.NewConnectionProvider(cfg.Properties))
{
Assert.AreEqual(5, reader[0]);
Assert.AreEqual(4, reader[1]);
Assert.AreEqual(DBNull.Value, reader[2]);
break;
}

conn.Close();
var conn = provider.GetConnection();
try
{
using (var cmd = conn.CreateCommand())
{
cmd.Connection = conn;
cmd.CommandText = "select * from usertype";

using (ISession s = OpenSession())
{
s.Delete("from ClassWithNullColumns");
s.Flush();
using (var reader = cmd.ExecuteReader())
{
var idOrdinal = reader.GetOrdinal("id");
var firstOrdinal = reader.GetOrdinal("f_int32");
var secondOrdinal = reader.GetOrdinal("s_int32");
while (reader.Read())
{
Assert.AreEqual(5, reader[idOrdinal]);
Assert.AreEqual(4, reader[firstOrdinal]);
Assert.AreEqual(DBNull.Value, reader[secondOrdinal]);
break;
}
}
}
}
finally
{
provider.CloseConnection(conn);
}
}
}
}
Expand Down