Synchronization code

This commit is contained in:
sunkaixuan
2025-04-02 22:46:38 +08:00
parent 44a15fdbfa
commit 5a1164e536
3 changed files with 32 additions and 5 deletions

View File

@@ -385,7 +385,16 @@ WHERE tgrelid = '"+tableName+"'::regclass");
}
var oldDatabaseName = this.Context.Ado.Connection.Database;
var connection = this.Context.CurrentConnectionConfig.ConnectionString;
if (Regex.Matches(connection, oldDatabaseName).Count > 1)
{
var builder = new Npgsql.NpgsqlConnectionStringBuilder(connection);
builder.Database = "postgres";
connection = builder.ConnectionString;
}
else
{
connection = connection.Replace(oldDatabaseName, "postgres");
}
var newDb = new SqlSugarClient(new ConnectionConfig()
{
DbType = this.Context.CurrentConnectionConfig.DbType,

View File

@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -93,6 +94,10 @@ namespace SqlSugar
{
return FormatDateTimeOffset(it.Value);
}
else if (it.Value is decimal v)
{
return v.ToString(CultureInfo.InvariantCulture);
}
else if (it.IsArray&&it.Value!=null)
{
return FormatValue(it.Value,it.PropertyName,i,it);
@@ -172,6 +177,10 @@ namespace SqlSugar
{
return "'" + value.ToString().ToSqlFilter() + "'";
}
else if (value is decimal v)
{
return v.ToString(CultureInfo.InvariantCulture);
}
else
{
return "'" + value.ToString() + "'";
@@ -229,6 +238,10 @@ namespace SqlSugar
{
return N + "'" + Convert.ToDouble(value).ToString() + "'";
}
else if (value is decimal v)
{
return v.ToString(CultureInfo.InvariantCulture);
}
else
{
return N + "'" + value.ToString() + "'";

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
@@ -86,6 +87,10 @@ namespace SqlSugar
{
return "'" + value.ToString().ToSqlFilter() + "'";
}
else if (value is decimal v)
{
return v.ToString(CultureInfo.InvariantCulture);
}
else
{
return "'" + value.ToString() + "'";