mirror of
https://github.com/dotnetcore/FreeSql.git
synced 2026-02-13 11:50:56 +08:00
- 调整 resources 转换成 static class 静态类;#1917
This commit is contained in:
@@ -16,11 +16,11 @@ namespace FreeSql.Custom
|
||||
{
|
||||
}
|
||||
|
||||
public override List<T1> ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
public override List<T1> ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
|
||||
#if net40
|
||||
#else
|
||||
public override Task<List<T1>> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
public override Task<List<T1>> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace FreeSql.Custom
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected override List<T1> RawExecuteInserted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
protected override List<T1> RawExecuteInserted() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
|
||||
#if net40
|
||||
#else
|
||||
@@ -107,7 +107,7 @@ namespace FreeSql.Custom
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
protected override Task<List<T1>> RawExecuteInsertedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
protected override Task<List<T1>> RawExecuteInsertedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace FreeSql.Custom
|
||||
if (_limit > 0 && _utils.Adapter.SelectTopStyle == CustomAdapter.SelecTopStyle.Top) sb.Append("TOP ").Append(_skip + _limit).Append(" ");
|
||||
sb.Append(field);
|
||||
if (_skip > 0 && _utils.Adapter.SelectTopStyle == CustomAdapter.SelecTopStyle.Top)
|
||||
throw new NotImplementedException(CoreStrings.S_NotImplementSkipOffset("Custom"));
|
||||
throw new NotImplementedException(CoreErrorStrings.S_NotImplementSkipOffset("Custom"));
|
||||
|
||||
sb.Append(" \r\nFROM ");
|
||||
var tbsjoin = _tables.Where(a => a.Type != SelectTableInfoType.From).ToArray();
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace FreeSql.Custom
|
||||
public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255);
|
||||
protected override List<TReturn> ExecuteUpdated<TReturn>(IEnumerable<ColumnInfo> columns) => base.SplitExecuteUpdated<TReturn>(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, columns);
|
||||
|
||||
protected override List<TReturn> RawExecuteUpdated<TReturn>(IEnumerable<ColumnInfo> columns) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
protected override List<TReturn> RawExecuteUpdated<TReturn>(IEnumerable<ColumnInfo> columns) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
|
||||
protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys)
|
||||
{
|
||||
@@ -65,7 +65,7 @@ namespace FreeSql.Custom
|
||||
public override Task<int> ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, cancellationToken);
|
||||
protected override Task<List<TReturn>> ExecuteUpdatedAsync<TReturn>(IEnumerable<ColumnInfo> columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync<TReturn>(_batchRowsLimit > 0 ? _batchRowsLimit : _utils.Adapter.UpdateBatchSplitLimit, _batchParameterLimit > 0 ? _batchParameterLimit : 255, columns, cancellationToken);
|
||||
|
||||
protected override Task<List<TReturn>> RawExecuteUpdatedAsync<TReturn>(IEnumerable<ColumnInfo> columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
protected override Task<List<TReturn>> RawExecuteUpdatedAsync<TReturn>(IEnumerable<ColumnInfo> columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace FreeSql.Custom
|
||||
_CreateParameterCommand = CreateCommand();
|
||||
return;
|
||||
}
|
||||
throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
}
|
||||
CustomAdapter Adapter => (_util == null ? FreeSqlCustomAdapterGlobalExtensions.DefaultAdapter : _util._orm.GetCustomAdapter());
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace FreeSql.Custom
|
||||
cmd.Connection = null;
|
||||
return cmd;
|
||||
}
|
||||
throw new Exception(CoreStrings.S_CustomAdapter_Cannot_Use_CreateCommand);
|
||||
throw new Exception(CoreErrorStrings.S_CustomAdapter_Cannot_Use_CreateCommand);
|
||||
}
|
||||
public DbParameter CreateParameter()
|
||||
{
|
||||
|
||||
@@ -90,6 +90,6 @@ namespace FreeSql.Custom
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] objects) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
protected override string GetComparisonDDLStatements(params TypeSchemaAndName[] objects) => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
}
|
||||
}
|
||||
@@ -18,9 +18,9 @@ namespace FreeSql.Custom
|
||||
public override IInsert<T1> CreateInsertProvider<T1>() => new CustomInsert<T1>(this, this.InternalCommonUtils, this.InternalCommonExpression);
|
||||
public override IUpdate<T1> CreateUpdateProvider<T1>(object dywhere) => new CustomUpdate<T1>(this, this.InternalCommonUtils, this.InternalCommonExpression, dywhere);
|
||||
public override IDelete<T1> CreateDeleteProvider<T1>(object dywhere) => new CustomDelete<T1>(this, this.InternalCommonUtils, this.InternalCommonExpression, dywhere);
|
||||
public override IInsertOrUpdate<T1> CreateInsertOrUpdateProvider<T1>() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
public override IInsertOrUpdate<T1> CreateInsertOrUpdateProvider<T1>() => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
|
||||
public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreStrings.S_Not_Implemented_Feature}");
|
||||
public override IDbFirst DbFirst => throw new NotImplementedException($"FreeSql.Provider.Custom {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
|
||||
public CustomProvider(string masterConnectionString, string[] slaveConnectionString, Func<DbConnection> connectionFactory = null)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace FreeSql.Custom.MySql
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName));
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.Entity_Must_Primary_Key("fsql.InsertOrUpdate + IfExistsDoNothing + MySql ", _table.CsName));
|
||||
sql = insert.ToSqlValuesOrSelectUnionAll();
|
||||
if (sql?.StartsWith("INSERT INTO ") == true)
|
||||
sql = $"INSERT IGNORE INTO {sql.Substring(12)}";
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace FreeSql.Custom.MySql
|
||||
public CustomMySqlOnDuplicateKeyUpdate(IInsert<T1> insert)
|
||||
{
|
||||
_mysqlInsert = insert as CustomMySqlInsert<T1>;
|
||||
if (_mysqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnDuplicateKeyUpdate", "Odbc/MySql"));
|
||||
if (_mysqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnDuplicateKeyUpdate", "Odbc/MySql"));
|
||||
if (_mysqlInsert._noneParameterFlag == "c") _mysqlInsert._noneParameterFlag = "cu";
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace FreeSql.Custom.MySql
|
||||
MasterPool = pool;
|
||||
return;
|
||||
}
|
||||
throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
}
|
||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||
{
|
||||
|
||||
@@ -89,8 +89,8 @@ namespace FreeSql.Custom.MySql
|
||||
{
|
||||
if (sb.Length > 0) sb.Append("\r\n");
|
||||
var tb = obj.tableSchema;
|
||||
if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
var tbname = _commonUtils.SplitTableName(tb.DbName);
|
||||
if (tbname?.Length == 1) tbname = new[] { database, tbname[0] };
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace FreeSql.Custom.MySql
|
||||
return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null);
|
||||
return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
|
||||
case "Format":
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
if (exp.Arguments.Count == 1) return ExpressionLambdaToSql(exp.Arguments[0], tsc);
|
||||
var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
|
||||
(exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
|
||||
|
||||
@@ -16,11 +16,11 @@ namespace FreeSql.Custom.Oracle
|
||||
{
|
||||
}
|
||||
|
||||
public override List<T1> ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}");
|
||||
public override List<T1> ExecuteDeleted() => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
|
||||
#if net40
|
||||
#else
|
||||
public override Task<List<T1>> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreStrings.S_Not_Implemented_Feature}");
|
||||
public override Task<List<T1>> ExecuteDeletedAsync(CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Odbc.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace FreeSql.Custom.Oracle
|
||||
|
||||
string getMergeSql(List<T1> data)
|
||||
{
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName));
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName));
|
||||
|
||||
var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity);
|
||||
var sb = new StringBuilder().Append("MERGE INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append(" t1 \r\nUSING (");
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace FreeSql.Custom.Oracle
|
||||
public override int ExecuteAffrows() => base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999);
|
||||
protected override List<TReturn> ExecuteUpdated<TReturn>(IEnumerable<ColumnInfo> columns) => base.SplitExecuteUpdated<TReturn>(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns);
|
||||
|
||||
protected override List<TReturn> RawExecuteUpdated<TReturn>(IEnumerable<ColumnInfo> columns) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreStrings.S_Not_Implemented_Feature}");
|
||||
protected override List<TReturn> RawExecuteUpdated<TReturn>(IEnumerable<ColumnInfo> columns) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
|
||||
protected override void ToSqlCase(StringBuilder caseWhen, ColumnInfo[] primarys)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace FreeSql.Custom.Oracle
|
||||
public override Task<int> ExecuteAffrowsAsync(CancellationToken cancellationToken = default) => base.SplitExecuteAffrowsAsync(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, cancellationToken);
|
||||
protected override Task<List<TReturn>> ExecuteUpdatedAsync<TReturn>(IEnumerable<ColumnInfo> columns, CancellationToken cancellationToken = default) => base.SplitExecuteUpdatedAsync<TReturn>(_batchRowsLimit > 0 ? _batchRowsLimit : 200, _batchParameterLimit > 0 ? _batchParameterLimit : 999, columns, cancellationToken);
|
||||
|
||||
protected override Task<List<TReturn>> RawExecuteUpdatedAsync<TReturn>(IEnumerable<ColumnInfo> columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreStrings.S_Not_Implemented_Feature}");
|
||||
protected override Task<List<TReturn>> RawExecuteUpdatedAsync<TReturn>(IEnumerable<ColumnInfo> columns, CancellationToken cancellationToken = default) => throw new NotImplementedException($"FreeSql.Custom.Oracle {CoreErrorStrings.S_Not_Implemented_Feature}");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace FreeSql.Custom.Oracle
|
||||
UserId = CustomOracleAdo.GetUserId(conn.Value.ConnectionString);
|
||||
return;
|
||||
}
|
||||
throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
}
|
||||
|
||||
internal string UserId { get; set; }
|
||||
|
||||
@@ -91,8 +91,8 @@ namespace FreeSql.Custom.Oracle
|
||||
{
|
||||
if (sb.Length > 0) sb.Append("\r\n");
|
||||
var tb = obj.tableSchema;
|
||||
if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
var tbname = _commonUtils.SplitTableName(tb.DbName);
|
||||
if (tbname?.Length == 1) tbname = new[] { userId, tbname[0] };
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace FreeSql.Custom.Oracle
|
||||
//codefirst 不支持表名中带 .
|
||||
|
||||
if (string.Compare(tbname[0], userId) != 0 && _orm.Ado.ExecuteScalar(CommandType.Text, _commonUtils.FormatSql(" select 1 from sys.dba_users where username={0}", tbname[0])) == null) //创建数据库
|
||||
throw new NotImplementedException(CoreStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0]));
|
||||
throw new NotImplementedException(CoreErrorStrings.S_Oracle_NotSupport_TablespaceSchemas(tbname[0]));
|
||||
|
||||
var sbalter = new StringBuilder();
|
||||
var istmpatler = false; //创建临时表,导入数据,删除旧表,修改
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace FreeSql.Custom.Oracle
|
||||
if (dbfull != null) _dicDbToCs.TryAdd(dbfull, _dicDbToCs["nvarchar2(255)"]);
|
||||
return DbType.String;
|
||||
}
|
||||
throw new NotImplementedException(CoreStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull));
|
||||
throw new NotImplementedException(CoreErrorStrings.S_TypeMappingNotImplemented(column.DbTypeTextFull));
|
||||
}
|
||||
|
||||
static ConcurrentDictionary<string, DbToCs> _dicDbToCs = new ConcurrentDictionary<string, DbToCs>(StringComparer.CurrentCultureIgnoreCase);
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace FreeSql.Custom.Oracle
|
||||
return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null);
|
||||
return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
|
||||
case "Format":
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
|
||||
(exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
|
||||
//3个 {} 时,Arguments 解析出来是分开的
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace FreeSql.Custom.PostgreSQL
|
||||
public CustomPostgreSQLOnConflictDoUpdate(IInsert<T1> insert, Expression<Func<T1, object>> columns = null)
|
||||
{
|
||||
_pgsqlInsert = insert as CustomPostgreSQLInsert<T1>;
|
||||
if (_pgsqlInsert == null) throw new Exception(CoreStrings.S_Features_Unique("OnConflictDoUpdate", "Custom/PostgreSQL"));
|
||||
if (_pgsqlInsert == null) throw new Exception(CoreErrorStrings.S_Features_Unique("OnConflictDoUpdate", "Custom/PostgreSQL"));
|
||||
if (_pgsqlInsert._noneParameterFlag == "c") _pgsqlInsert._noneParameterFlag = "cu";
|
||||
|
||||
if (columns != null)
|
||||
@@ -38,7 +38,7 @@ namespace FreeSql.Custom.PostgreSQL
|
||||
}
|
||||
if (_tempPrimarys == null || _tempPrimarys.Any() == false)
|
||||
_tempPrimarys = _pgsqlInsert.InternalTable.Primarys;
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.S_OnConflictDoUpdate_MustIsPrimary);
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.S_OnConflictDoUpdate_MustIsPrimary);
|
||||
}
|
||||
|
||||
protected void ClearData()
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace FreeSql.Custom.PostgreSQL
|
||||
MasterPool = pool;
|
||||
return;
|
||||
}
|
||||
throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
}
|
||||
|
||||
public override object AddslashesProcessParam(object param, Type mapType, ColumnInfo mapColumn)
|
||||
|
||||
@@ -92,8 +92,8 @@ namespace FreeSql.Custom.PostgreSQL
|
||||
{
|
||||
if (sb.Length > 0) sb.Append("\r\n");
|
||||
var tb = obj.tableSchema;
|
||||
if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
var tbname = _commonUtils.SplitTableName(tb.DbName);
|
||||
if (tbname?.Length == 1) tbname = new[] { "public", tbname[0] };
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ namespace FreeSql.Custom.PostgreSQL
|
||||
return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), null);
|
||||
return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), null);
|
||||
case "Format":
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
var expArgsHack = exp.Arguments.Count == 2 && exp.Arguments[1].NodeType == ExpressionType.NewArrayInit ?
|
||||
(exp.Arguments[1] as NewArrayExpression).Expressions : exp.Arguments.Where((a, z) => z > 0);
|
||||
//3个 {} 时,Arguments 解析出来是分开的
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace FreeSql.Custom.SqlServer
|
||||
}
|
||||
var sql = sb.ToString();
|
||||
var validx = sql.IndexOf(" WHERE ");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE"));
|
||||
sql = sb.Clear().Append(sql.Substring(0, validx))
|
||||
.Append(sbret)
|
||||
.Append(sql.Substring(validx)).ToString();
|
||||
@@ -97,7 +97,7 @@ namespace FreeSql.Custom.SqlServer
|
||||
}
|
||||
var sql = sb.ToString();
|
||||
var validx = sql.IndexOf(" WHERE ");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE"));
|
||||
sql = sb.Clear().Append(sql.Substring(0, validx))
|
||||
.Append(sbret)
|
||||
.Append(sql.Substring(validx)).ToString();
|
||||
|
||||
@@ -69,14 +69,14 @@ namespace FreeSql.Custom.SqlServer
|
||||
if ((_commonUtils as CustomSqlServerUtils).ServerVersion > 10)
|
||||
{
|
||||
var validx = sql.IndexOf(") VALUES");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES"));
|
||||
sb.Insert(0, sql.Substring(0, validx + 1));
|
||||
sb.Append(sql.Substring(validx + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
var validx = sql.IndexOf(") SELECT ");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT"));
|
||||
sb.Insert(0, sql.Substring(0, validx + 1));
|
||||
sb.Append(sql.Substring(validx + 1));
|
||||
}
|
||||
@@ -153,14 +153,14 @@ namespace FreeSql.Custom.SqlServer
|
||||
if ((_commonUtils as CustomSqlServerUtils).ServerVersion > 10)
|
||||
{
|
||||
var validx = sql.IndexOf(") VALUES");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("VALUES"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("VALUES"));
|
||||
sb.Insert(0, sql.Substring(0, validx + 1));
|
||||
sb.Append(sql.Substring(validx + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
var validx = sql.IndexOf(") SELECT ");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("SELECT"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("SELECT"));
|
||||
sb.Insert(0, sql.Substring(0, validx + 1));
|
||||
sb.Append(sql.Substring(validx + 1));
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace FreeSql.Custom.SqlServer
|
||||
|
||||
string getMergeSql(List<T1> data)
|
||||
{
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName));
|
||||
if (_tempPrimarys.Any() == false) throw new Exception(CoreErrorStrings.InsertOrUpdate_Must_Primary_Key(_table.CsName));
|
||||
|
||||
var tempPrimaryIsIdentity = _tempPrimarys.Any(b => b.Attribute.IsIdentity);
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace FreeSql.Custom.SqlServer
|
||||
}
|
||||
var sql = sb.ToString();
|
||||
var validx = sql.IndexOf(" \r\nWHERE ");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE"));
|
||||
sql = sb.Clear().Append(sql.Substring(0, validx))
|
||||
.Append(sbret)
|
||||
.Append(sql.Substring(validx)).ToString();
|
||||
@@ -140,7 +140,7 @@ namespace FreeSql.Custom.SqlServer
|
||||
}
|
||||
var sql = sb.ToString();
|
||||
var validx = sql.IndexOf(" \r\nWHERE ");
|
||||
if (validx == -1) throw new ArgumentException(CoreStrings.S_NotFound_Name("WHERE"));
|
||||
if (validx == -1) throw new ArgumentException(CoreErrorStrings.S_NotFound_Name("WHERE"));
|
||||
sql = sb.Clear().Append(sql.Substring(0, validx))
|
||||
.Append(sbret)
|
||||
.Append(sql.Substring(validx)).ToString();
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace FreeSql.Custom.SqlServer
|
||||
MasterPool = pool;
|
||||
return;
|
||||
}
|
||||
throw new Exception(CoreStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
throw new Exception(CoreErrorStrings.S_CustomAdapter_OnlySuppport_UseConnectionFactory);
|
||||
}
|
||||
|
||||
string[] ncharDbTypes = new[] { "NVARCHAR", "NCHAR", "NTEXT" };
|
||||
|
||||
@@ -149,8 +149,8 @@ ELSE
|
||||
{
|
||||
if (sb.Length > 0) sb.Append("\r\n");
|
||||
var tb = obj.tableSchema;
|
||||
if (tb == null) throw new Exception(CoreStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
if (tb == null) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable(obj.tableSchema.Type.FullName));
|
||||
if (tb.Columns.Any() == false) throw new Exception(CoreErrorStrings.S_Type_IsNot_Migrable_0Attributes(obj.tableSchema.Type.FullName));
|
||||
var tbname = _commonUtils.SplitTableName(tb.DbName);
|
||||
if (tbname?.Length == 1) tbname = new[] { database, "dbo", tbname[0] };
|
||||
if (tbname?.Length == 2) tbname = new[] { database, tbname[0], tbname[1] };
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace FreeSql.Custom.SqlServer
|
||||
return _common.StringConcat(concatNewArrExp.Expressions.Select(a => getExp(a)).ToArray(), concatNewArrExp.Expressions.Select(a => a.Type).ToArray());
|
||||
return _common.StringConcat(exp.Arguments.Select(a => getExp(a)).ToArray(), exp.Arguments.Select(a => a.Type).ToArray());
|
||||
case "Format":
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
if (exp.Arguments[0].NodeType != ExpressionType.Constant) throw new Exception(CoreErrorStrings.Not_Implemented_Expression_ParameterUseConstant(exp,exp.Arguments[0]));
|
||||
var expArgs0 = ExpressionLambdaToSql(exp.Arguments[0], tsc);
|
||||
if (exp.Arguments.Count == 1) return expArgs0;
|
||||
var nchar = expArgs0.StartsWith("N'") ? "N" : "";
|
||||
|
||||
Reference in New Issue
Block a user