This commit is contained in:
2881099 2021-04-28 18:04:12 +08:00
commit 86088ed2c3
3 changed files with 23 additions and 8 deletions

View File

@ -40,7 +40,7 @@ jobs:
- name: Remove FreeSql.Tests
run: dotnet sln FreeSql.sln remove (ls -r FreeSql.Tests/**/*.csproj)
- name: Install dependencies
run: dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org --configfile $env:APPDATA\NuGet\NuGet.Config && dotnet restore
run: dotnet restore
- name: Setup DocFX
uses: crazy-max/ghaction-chocolatey@v1
with:

4
.gitignore vendored
View File

@ -245,3 +245,7 @@ ModelManifest.xml
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml

View File

@ -7,6 +7,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading;
@ -65,12 +66,22 @@ namespace FreeSql.PostgreSQL
{
var pgdics = isdic ? param as Dictionary<string, string> :
param as IEnumerable<KeyValuePair<string, string>>;
if (pgdics == null) return string.Concat("''::hstore");
var pghstore = new StringBuilder();
pghstore.Append("'");
foreach (var dic in pgdics)
pghstore.Append("\"").Append(dic.Key.Replace("'", "''")).Append("\"=>")
.Append(dic.Key.Replace("'", "''")).Append(",");
var pghstore = new StringBuilder("'");
var pairs = pgdics.ToArray();
for (var i = 0; i < pairs.Length; i++)
{
if (i != 0) pghstore.Append(",");
pghstore.AppendFormat("\"{0}\"=>", pairs[i].Key.Replace("'", "''"));
if (pairs[i].Value == null)
pghstore.Append("NULL");
else
pghstore.AppendFormat("\"{0}\"", pairs[i].Value.Replace("'", "''"));
}
return pghstore.Append("'::hstore");
}
else if (param is IEnumerable)