|
@@ -1,7 +1,7 @@
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data;
|
|
-using System.Text;
|
|
|
|
|
|
+using System.Data.Common;
|
|
using System.Threading.Tasks;
|
|
using System.Threading.Tasks;
|
|
using appMpower.Db;
|
|
using appMpower.Db;
|
|
|
|
|
|
@@ -63,7 +63,13 @@ namespace appMpower
|
|
fortunes.Add(new Fortune
|
|
fortunes.Add(new Fortune
|
|
(
|
|
(
|
|
id: dataReader.GetInt32(0),
|
|
id: dataReader.GetInt32(0),
|
|
|
|
+#if MYSQL
|
|
|
|
+ //MariaDB ODBC connector does not correctly support Japanese characters in combination with default ADO.NET;
|
|
|
|
+ //as a solution we custom read this string
|
|
|
|
+ message: ReadColumn(dataReader, 1)
|
|
|
|
+#else
|
|
message: dataReader.GetString(1)
|
|
message: dataReader.GetString(1)
|
|
|
|
+#endif
|
|
));
|
|
));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -98,8 +104,10 @@ namespace appMpower
|
|
|
|
|
|
var ids = PlatformBenchmarks.BatchUpdateString.Ids;
|
|
var ids = PlatformBenchmarks.BatchUpdateString.Ids;
|
|
var randoms = PlatformBenchmarks.BatchUpdateString.Randoms;
|
|
var randoms = PlatformBenchmarks.BatchUpdateString.Randoms;
|
|
- // --- only for alternative update statement - will be used for MySQL
|
|
|
|
|
|
+
|
|
|
|
+#if !MYSQL
|
|
var jds = PlatformBenchmarks.BatchUpdateString.Jds;
|
|
var jds = PlatformBenchmarks.BatchUpdateString.Jds;
|
|
|
|
+#endif
|
|
|
|
|
|
for (int i = 0; i < count; i++)
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
{
|
|
@@ -111,11 +119,12 @@ namespace appMpower
|
|
worlds[i].RandomNumber = randomNumber;
|
|
worlds[i].RandomNumber = randomNumber;
|
|
}
|
|
}
|
|
|
|
|
|
- // --- only for alternative update statement - will be used for MySQL
|
|
|
|
|
|
+#if !MYSQL
|
|
for (int i = 0; i < count; i++)
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
{
|
|
updateCommand.CreateParameter(jds[i], DbType.Int32, worlds[i].Id);
|
|
updateCommand.CreateParameter(jds[i], DbType.Int32, worlds[i].Id);
|
|
}
|
|
}
|
|
|
|
+#endif
|
|
|
|
|
|
await updateCommand.ExecuteNonQueryAsync();
|
|
await updateCommand.ExecuteNonQueryAsync();
|
|
|
|
|
|
@@ -204,5 +213,23 @@ namespace appMpower
|
|
|
|
|
|
return worlds;
|
|
return worlds;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public static string ReadColumn(DbDataReader dbDataReader, int column)
|
|
|
|
+ {
|
|
|
|
+ long size = dbDataReader.GetBytes(column, 0, null, 0, 0); //get the length of data
|
|
|
|
+ byte[] values = new byte[size];
|
|
|
|
+
|
|
|
|
+ int bufferSize = 64;
|
|
|
|
+ long bytesRead = 0;
|
|
|
|
+ int currentPosition = 0;
|
|
|
|
+
|
|
|
|
+ while (bytesRead < size)
|
|
|
|
+ {
|
|
|
|
+ bytesRead += dbDataReader.GetBytes(column, currentPosition, values, currentPosition, bufferSize);
|
|
|
|
+ currentPosition += bufferSize;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return System.Text.Encoding.Default.GetString(values);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|