mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-10-15 18:55:07 +08:00
Update Core
This commit is contained in:
@@ -106,7 +106,7 @@ namespace SqlSugar
|
|||||||
foreach (var columnInfo in columnInfos)
|
foreach (var columnInfo in columnInfos)
|
||||||
{
|
{
|
||||||
string fileName = columnInfo.DbColumnName ?? columnInfo.PropertyName;
|
string fileName = columnInfo.DbColumnName ?? columnInfo.PropertyName;
|
||||||
if (columnInfo.IsIgnore)
|
if (columnInfo.IsIgnore&& !this.ReaderKeys.Any(it=>it.Equals(fileName,StringComparison.CurrentCultureIgnoreCase)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ namespace SqlSugar
|
|||||||
public Result Get<Result>(Func<List<T>, Result> action)
|
public Result Get<Result>(Func<List<T>, Result> action)
|
||||||
{
|
{
|
||||||
GetIndex++;
|
GetIndex++;
|
||||||
string key = "Get" + GetIndex;
|
string key = "Get" +typeof(Result)+action.GetHashCode()+action.Method.Name;
|
||||||
if (caches.ContainsKey(key))
|
if (caches.ContainsKey(key))
|
||||||
{
|
{
|
||||||
return (Result)caches[key];
|
return (Result)caches[key];
|
||||||
|
@@ -146,7 +146,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "exec sp_rename '{0}.{1}','{2}','column';";
|
return "alter table {0} change column {1} {2}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -366,6 +366,38 @@ namespace SqlSugar
|
|||||||
return dataSize;
|
return dataSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool RenameColumn(string tableName, string oldColumnName, string newColumnName)
|
||||||
|
{
|
||||||
|
var columns=GetColumnInfosByTableName(tableName).Where(it=>it.DbColumnName.Equals(oldColumnName,StringComparison.CurrentCultureIgnoreCase));
|
||||||
|
if (columns != null && columns.Any())
|
||||||
|
{
|
||||||
|
var column = columns.First();
|
||||||
|
var appendSql = " " + column.DataType;
|
||||||
|
if (column.Length > 0 && column.Scale == 0)
|
||||||
|
{
|
||||||
|
appendSql += string.Format("({0}) ", column.Length);
|
||||||
|
}
|
||||||
|
else if (column.Scale > 0 && column.Length > 0)
|
||||||
|
{
|
||||||
|
appendSql += string.Format("({0},{1}) ", column.Length, column.Scale);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
appendSql += column.IsNullable ? " NULL" : "NOT NULL";
|
||||||
|
}
|
||||||
|
tableName = this.SqlBuilder.GetTranslationTableName(tableName);
|
||||||
|
oldColumnName = this.SqlBuilder.GetTranslationColumnName(oldColumnName);
|
||||||
|
newColumnName = this.SqlBuilder.GetTranslationColumnName(newColumnName);
|
||||||
|
string sql = string.Format(this.RenameColumnSql, tableName, oldColumnName, newColumnName+appendSql);
|
||||||
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override bool IsAnyConstraint(string constraintName)
|
public override bool IsAnyConstraint(string constraintName)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("MySql IsAnyConstraint NotSupportedException");
|
throw new NotSupportedException("MySql IsAnyConstraint NotSupportedException");
|
||||||
|
Reference in New Issue
Block a user