Skip to content

Commit bf0e2d8

Browse files
Support Unicode in Firebird tests
1 parent 8e046fe commit bf0e2d8

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

lib/teamcity/firebird/firebird_installation.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ UserManager = Srp
2323
WireCrypt = Enabled
2424
11. Restart Firebird service.
2525

26-
For manual testing, take care of not creating it with inadequate acl on the file. This may happen
27-
if you use ISQL with a connection string causing it to create it in embedded mode, without actually
28-
using the server. Prefixing your path with "localhost:" should avoid that.
26+
For manual testing, take care of not creating the NHibernate database with inadequate acl on the file.
27+
This may happen if you use ISQL with a connection string causing it to create it in embedded mode,
28+
without actually using the server. Prefixing your path with "localhost:" should avoid that.
29+
Due to test constraints, make sure you create the database with a 16384 page size.
2930

3031
For tests performances, and since it is just an expandable test database, better disable forced writes.
3132
Since those tests drop/create schema constantly, they are quite heavy on writes and this single setting
@@ -35,4 +36,6 @@ b. From Firebird installation folder, run:
3536
gfix -w async nhibernate -user SYSDBA
3637
(Change "nhibernate" to your own alias or path as appropriate for your setup)
3738
c. Restart Firebird service.
38-
Note that the TestDatabaseSetup will drop and recreate the database when run, with forced writes disabled.
39+
Note that the TestDatabaseSetup will drop and recreate the database when run, with forced writes disabled
40+
and with a 16384 page size. So you may consider running the TestDatabaseSetup test instead for creating the
41+
NHibernate database.

src/NHibernate.Config.Templates/FireBird.cfg.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ for your own use before compile tests in VisualStudio.
2222
Database=nhibernate;
2323
User ID=SYSDBA;Password=masterkey;
2424
MaxPoolSize=200;
25+
charset=utf8;
2526
</property>
2627
<property name="show_sql">false</property>
2728
<property name="dialect">NHibernate.Dialect.FirebirdDialect</property>

src/NHibernate.TestDatabaseSetup/TestDatabaseSetup.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ private static void SetupFirebird(Cfg.Configuration cfg)
112112
{
113113
Console.WriteLine(e);
114114
}
115-
FbConnection.CreateDatabase(connStr, forcedWrites:false);
115+
// With UTF8 charset, string takes up to four times as many space, causing the
116+
// default page-size of 4096 to no more be enough for index key sizes. (Index key
117+
// size is limited to a quarter of the page size.)
118+
FbConnection.CreateDatabase(connStr, pageSize:16384, forcedWrites:false);
116119
}
117120

118121
private static void SetupSqlServerCe(Cfg.Configuration cfg)

teamcity.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@
7676
<target name="setup-teamcity-firebird32">
7777
<property name="nhibernate.connection.driver_class" value="NHibernate.Driver.FirebirdClientDriver" />
7878
<property name="nhibernate.dialect" value="NHibernate.Dialect.FirebirdDialect" />
79-
<property name="nhibernate.connection.connection_string" value="DataSource=localhost;Database=nhibernate;User ID=SYSDBA;Password=masterkey;MaxPoolSize=200;" />
79+
<property name="nhibernate.connection.connection_string" value="DataSource=localhost;Database=nhibernate;User ID=SYSDBA;Password=masterkey;MaxPoolSize=200;charset=utf8;" />
8080
</target>
8181

8282
<target name="setup-teamcity-firebird64">
8383
<property name="nunit-x64" value="true" />
8484
<property name="nhibernate.connection.driver_class" value="NHibernate.Driver.FirebirdClientDriver" />
8585
<property name="nhibernate.dialect" value="NHibernate.Dialect.FirebirdDialect" />
86-
<property name="nhibernate.connection.connection_string" value="DataSource=localhost;Database=nhibernate;User ID=SYSDBA;Password=masterkey;MaxPoolSize=200;" />
86+
<property name="nhibernate.connection.connection_string" value="DataSource=localhost;Database=nhibernate;User ID=SYSDBA;Password=masterkey;MaxPoolSize=200;charset=utf8;" />
8787
</target>
8888

8989
<target name="setup-teamcity-sqlite32">

0 commit comments

Comments
 (0)