Skip to content

Commit 2f128b3

Browse files
committed
Make SqlFunctionTypeTranslations struct
1 parent a667837 commit 2f128b3

File tree

1 file changed

+4
-6
lines changed
  • Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v8_0

1 file changed

+4
-6
lines changed

Orm/Xtensive.Orm.PostgreSql/Sql.Drivers.PostgreSql/v8_0/Translator.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Xtensive.Sql.Drivers.PostgreSql.v8_0
1818
{
1919
internal class Translator : SqlTranslator
2020
{
21-
protected class SqlFunctionTypeTranslations
21+
protected struct SqlFunctionTypeTranslations
2222
{
2323
private readonly string[] translations;
2424

@@ -43,15 +43,13 @@ public string Get(in SqlFunctionType enumValue)
4343
return translations[index];
4444
}
4545

46-
public SqlFunctionTypeTranslations()
46+
public SqlFunctionTypeTranslations(int count)
4747
{
48-
// this is still fast but keeps reference to remind the reader
49-
// to keep array size in accordance with max enum value
50-
translations = new string[(int)SqlFunctionType.RoundDoubleToZero];
48+
translations = new string[count];
5149
}
5250
}
5351

54-
protected readonly SqlFunctionTypeTranslations FunctionTypeTranslations = new();
52+
protected readonly SqlFunctionTypeTranslations FunctionTypeTranslations = new((int) SqlFunctionType.RoundDoubleToZero);
5553

5654
/// <inheritdoc/>
5755
public override string DateTimeFormatString => @"\'yyyyMMdd HHmmss.ffffff\''::timestamp(6)'";

0 commit comments

Comments
 (0)