From 1636b3accbd1d613e499646b23ee208e23507136 Mon Sep 17 00:00:00 2001 From: Soar360 Date: Tue, 10 Sep 2024 16:31:35 +0800 Subject: [PATCH] =?UTF-8?q?[fix]pgsql=20=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=EF=BC=8C=E5=85=A5=E5=BA=93=E6=97=B6=E8=A6=81?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E8=BD=AC=E4=B9=89=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- XCode/DataAccessLayer/Database/PostgreSQL.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/XCode/DataAccessLayer/Database/PostgreSQL.cs b/XCode/DataAccessLayer/Database/PostgreSQL.cs index ca39714e8..25042b126 100644 --- a/XCode/DataAccessLayer/Database/PostgreSQL.cs +++ b/XCode/DataAccessLayer/Database/PostgreSQL.cs @@ -93,15 +93,12 @@ public override String FormatValue(IDataColumn field, Object? value) if (field.DataType == typeof(String)) { if (value == null) return field.Nullable ? "null" : "''"; - //云飞扬:这里注释掉,应该返回``而不是null字符 - //if (String.IsNullOrEmpty(value.ToString()) && field.Nullable) return "null"; - return "'" + value + "'"; + return "'" + value.ToString().Replace("'", "''") + "'"; } else if (field.DataType == typeof(Boolean)) { return (Boolean)value ? "true" : "false"; } - return base.FormatValue(field, value); }