Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 47fb303

Browse files
committed
Update MySql defaults
1 parent d65432e commit 47fb303

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/ServiceStack.OrmLite.MySql/Converters/MySqlStringConverters.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace ServiceStack.OrmLite.MySql.Converters
55
{
66
public class MySqlStringConverter : StringConverter
77
{
8-
public MySqlStringConverter() : base(255) {}
8+
public MySqlStringConverter() : base(8000) {}
99

1010
//https://stackoverflow.com/a/37721151/85785
1111
public override int MaxVarCharLength => UseUnicode ? 16383 : 21844;
@@ -15,7 +15,24 @@ public MySqlStringConverter() : base(255) {}
1515

1616
public class MySqlCharArrayConverter : CharArrayConverter
1717
{
18-
public MySqlCharArrayConverter() : base(255) { }
18+
public MySqlCharArrayConverter() : base(8000) { }
19+
20+
public override string MaxColumnDefinition => "LONGTEXT";
21+
}
22+
23+
public class MySql55StringConverter : StringConverter
24+
{
25+
public MySql55StringConverter() : base(255) {}
26+
27+
//https://stackoverflow.com/a/37721151/85785
28+
public override int MaxVarCharLength => UseUnicode ? 16383 : 21844;
29+
30+
public override string MaxColumnDefinition => "LONGTEXT";
31+
}
32+
33+
public class MySql55CharArrayConverter : CharArrayConverter
34+
{
35+
public MySql55CharArrayConverter() : base(255) { }
1936

2037
public override string MaxColumnDefinition => "LONGTEXT";
2138
}

src/ServiceStack.OrmLite.MySql/MySqlDialectProvider.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public override IDbConnection CreateConnection(string connectionString, Dictiona
4242
public MySql55DialectProvider()
4343
{
4444
RegisterConverter<DateTime>(new MySql55DateTimeConverter());
45+
RegisterConverter<string>(new MySql55StringConverter());
46+
RegisterConverter<char[]>(new MySql55CharArrayConverter());
4547
}
4648

4749
public override IDbDataParameter CreateParam()

0 commit comments

Comments
 (0)