Skip to content
Open
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
2 changes: 1 addition & 1 deletion frameworks/CSharp/appmpower/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This includes tests for plaintext, json, db, queries, updates and fortune.

**Language**

* C# 7.0
* C# 14

**Platforms**

Expand Down
2 changes: 1 addition & 1 deletion frameworks/CSharp/appmpower/appmpower-ado-my.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY src .
RUN dotnet publish -c Release -o out /p:AOTEXE=true /p:Database=mysql /p:Driver=ado

# Construct the actual image that will run
FROM mcr.microsoft.com/dotnet/aspnet:10.0.1 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0.3 AS runtime

RUN apt-get update
RUN apt-get install -y unixodbc-dev unixodbc wget curl
Expand Down
2 changes: 1 addition & 1 deletion frameworks/CSharp/appmpower/appmpower-ado-pg.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN dotnet publish -c Release -o out /p:AOTEXE=true /p:Database=postgresql /p:Dr


# Construct the actual image that will run
FROM mcr.microsoft.com/dotnet/aspnet:10.0.1 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0.3 AS runtime

RUN apt-get update
RUN apt-get install -y unixodbc-dev unixodbc wget curl
Expand Down
2 changes: 1 addition & 1 deletion frameworks/CSharp/appmpower/appmpower-odbc-my.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY src .
RUN dotnet publish -c Release -o out /p:AOTEXE=true /p:Database=mysql /p:Driver=odbc

# Construct the actual image that will run
FROM mcr.microsoft.com/dotnet/aspnet:10.0.1 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0.3 AS runtime

RUN apt-get update
RUN apt-get install -y unixodbc-dev unixodbc wget curl
Expand Down
2 changes: 1 addition & 1 deletion frameworks/CSharp/appmpower/appmpower-odbc-pg.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COPY src .
RUN dotnet publish -c Release -o out /p:AOTEXE=true /p:Database=postgresql /p:Driver=odbc

# Construct the actual image that will run
FROM mcr.microsoft.com/dotnet/aspnet:10.0.1 AS runtime
FROM mcr.microsoft.com/dotnet/aspnet:10.0.3 AS runtime

RUN apt-get update
RUN apt-get install -y unixodbc-dev unixodbc odbc-postgresql
Expand Down
26 changes: 26 additions & 0 deletions frameworks/CSharp/appmpower/src/appMpower.Orm/RawDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,13 @@ public static async Task<List<Fortune>> LoadFortunesRowsAsync()
fortunes.Add(new Fortune
(
id: dataReader.GetInt32(0),
//MariaDB ODBC connector does not correctly support Japanese characters in combination with default ADO.NET;
//as a solution we custom read this string
#if ODBC && MYSQL
message: ReadColumn(dataReader, 1))
#else
message: dataReader.GetString(1))
#endif
);
}

Expand All @@ -209,6 +215,26 @@ public static async Task<List<Fortune>> LoadFortunesRowsAsync()
return fortunes;
}

#if ODBC && MYSQL
public static string ReadColumn(IDataReader dataReader, int column)
{
long size = dataReader.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 += dataReader.GetBytes(column, currentPosition, values, currentPosition, bufferSize);
currentPosition += bufferSize;
}

return System.Text.Encoding.Default.GetString(values);
}
#endif

private static (DbCommand dbCommand, IDbDataParameter dbDataParameter) CreateReadCommand(DbConnection pooledConnection)
{
#if ADO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<ItemGroup>
<!-- ODBC -->
<PackageReference Include="System.Data.Odbc" Version="10.0.1"
<PackageReference Include="System.Data.Odbc" Version="10.0.3"
Condition="'$(Driver)' == 'odbc'" />
<!-- ADO + PostgreSQL -->
<PackageReference Include="Npgsql" Version="10.0.1"
Expand Down
Loading