mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update GBase database
This commit is contained in:
parent
0c0653dc74
commit
295e2b4ba6
@ -16,7 +16,7 @@ namespace OrmTest
|
|||||||
/// Account have permission to create database
|
/// Account have permission to create database
|
||||||
/// 用有建库权限的数据库账号
|
/// 用有建库权限的数据库账号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string ConnectionString = "Driver={GBase ODBC DRIVER (64-Bit)};Host=localhost;Service=19088;Server=gbase01;Database=testdb;Protocol=onsoctcp;Uid=gbasedbt;Pwd=GBase123;Db_locale=zh_CN.utf8;Client_locale=zh_CN.utf8";
|
public static string ConnectionString = "Driver={GBase ODBC DRIVER (64-Bit)};Host=localhost;Service=19088;Server=gbase01;Database=testdb1;Protocol=onsoctcp;Uid=gbasedbt;Pwd=GBase123;Db_locale=zh_CN.utf8;Client_locale=zh_CN.utf8";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Account have permission to create database
|
/// Account have permission to create database
|
||||||
/// 用有建库权限的数据库账号
|
/// 用有建库权限的数据库账号
|
||||||
|
@ -68,10 +68,16 @@ namespace OrmTest
|
|||||||
});
|
});
|
||||||
|
|
||||||
//If no exist create datebase
|
//If no exist create datebase
|
||||||
db.DbMaintenance.CreateDatabase();
|
//db.DbMaintenance.CreateDatabase();
|
||||||
|
|
||||||
//Use db query
|
//Use db query
|
||||||
var dt = db.Ado.GetDataTable("select 1");
|
var dt = db.Ado.GetDataTable(@"
|
||||||
|
select
|
||||||
|
trim(a.tabname) as name,
|
||||||
|
trim(b.comments) as comment
|
||||||
|
from systables a
|
||||||
|
left join syscomments b on b.tabname = a.tabname
|
||||||
|
where a.tabtype in ('T', 'V') and not (a.tabname like 'sys%') AND a.tabname <>'dual'");
|
||||||
|
|
||||||
//Create tables
|
//Create tables
|
||||||
db.CodeFirst.InitTables(typeof(OrderItem),typeof(Order));
|
db.CodeFirst.InitTables(typeof(OrderItem),typeof(Order));
|
||||||
|
@ -6,6 +6,10 @@ namespace SqlSugar.GBase
|
|||||||
{
|
{
|
||||||
public class GBaseCodeFirst:CodeFirstProvider
|
public class GBaseCodeFirst:CodeFirstProvider
|
||||||
{
|
{
|
||||||
|
protected override void ExistLogicEnd(List<EntityColumnInfo> dbColumns)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
protected override string GetTableName(EntityInfo entityInfo)
|
protected override string GetTableName(EntityInfo entityInfo)
|
||||||
{
|
{
|
||||||
var table= this.Context.EntityMaintenance.GetTableName(entityInfo.EntityName);
|
var table= this.Context.EntityMaintenance.GetTableName(entityInfo.EntityName);
|
||||||
@ -14,16 +18,8 @@ namespace SqlSugar.GBase
|
|||||||
if (tableArray.Length > 1 && noFormat)
|
if (tableArray.Length > 1 && noFormat)
|
||||||
{
|
{
|
||||||
var dbMain = new GBaseDbMaintenance() { Context = this.Context };
|
var dbMain = new GBaseDbMaintenance() { Context = this.Context };
|
||||||
var schmes = dbMain.GetSchemas();
|
|
||||||
if (!schmes.Any(it => it.EqualCase(tableArray.First())))
|
|
||||||
{
|
|
||||||
return tableArray.Last();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return dbMain.SqlBuilder.GetTranslationTableName(table);
|
return dbMain.SqlBuilder.GetTranslationTableName(table);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return table;
|
return table;
|
||||||
|
@ -34,39 +34,28 @@ namespace SqlSugar.GBase
|
|||||||
}
|
}
|
||||||
public static List<KeyValuePair<string, CSharpDataType>> MappingTypesConst = new List<KeyValuePair<string, CSharpDataType>>()
|
public static List<KeyValuePair<string, CSharpDataType>> MappingTypesConst = new List<KeyValuePair<string, CSharpDataType>>()
|
||||||
{
|
{
|
||||||
new KeyValuePair<string, CSharpDataType>("int",CSharpDataType.@int),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("varchar",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("nvarchar",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("sql_variant",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("text",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("char",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("ntext",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("nchar",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("hierarchyid",CSharpDataType.@string),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("bigint",CSharpDataType.@long),
|
new KeyValuePair<string, CSharpDataType>("bigint",CSharpDataType.@long),
|
||||||
new KeyValuePair<string, CSharpDataType>("bit",CSharpDataType.@bool),
|
new KeyValuePair<string, CSharpDataType>("blob",CSharpDataType.byteArray),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("boolean",CSharpDataType.@bool),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("byte",CSharpDataType.@byte),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("char",CSharpDataType.@string),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("clob",CSharpDataType.@string),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("DATETIME YEAR TO FRACTION(3)", CSharpDataType.DateTime),
|
||||||
new KeyValuePair<string, CSharpDataType>("datetime", CSharpDataType.DateTime),
|
new KeyValuePair<string, CSharpDataType>("datetime", CSharpDataType.DateTime),
|
||||||
new KeyValuePair<string, CSharpDataType>("time",CSharpDataType.DateTime),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("smalldatetime",CSharpDataType.DateTime),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("timestamp",CSharpDataType.byteArray),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("datetime2",CSharpDataType.DateTime),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("date", CSharpDataType.DateTime),
|
new KeyValuePair<string, CSharpDataType>("date", CSharpDataType.DateTime),
|
||||||
new KeyValuePair<string, CSharpDataType>("decimal", CSharpDataType.@decimal),
|
new KeyValuePair<string, CSharpDataType>("decimal", CSharpDataType.@decimal),
|
||||||
new KeyValuePair<string, CSharpDataType>("single",CSharpDataType.@decimal),
|
new KeyValuePair<string, CSharpDataType>("float", CSharpDataType.@float),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("int", CSharpDataType.@int),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("integer", CSharpDataType.@int),
|
||||||
new KeyValuePair<string, CSharpDataType>("money", CSharpDataType.@decimal),
|
new KeyValuePair<string, CSharpDataType>("money", CSharpDataType.@decimal),
|
||||||
|
new KeyValuePair<string, CSharpDataType>("nchar", CSharpDataType.@string),
|
||||||
new KeyValuePair<string, CSharpDataType>("numeric", CSharpDataType.@decimal),
|
new KeyValuePair<string, CSharpDataType>("numeric", CSharpDataType.@decimal),
|
||||||
new KeyValuePair<string, CSharpDataType>("smallmoney",CSharpDataType.@decimal),
|
new KeyValuePair<string, CSharpDataType>("nvarchar", CSharpDataType.@string),
|
||||||
new KeyValuePair<string, CSharpDataType>("float",CSharpDataType.@double),
|
new KeyValuePair<string, CSharpDataType>("varchar", CSharpDataType.@string),
|
||||||
new KeyValuePair<string, CSharpDataType>("float",CSharpDataType.Single),
|
new KeyValuePair<string, CSharpDataType>("text", CSharpDataType.@string),
|
||||||
new KeyValuePair<string, CSharpDataType>("real",CSharpDataType.@float),
|
new KeyValuePair<string, CSharpDataType>("smallfloat", CSharpDataType.@decimal),
|
||||||
new KeyValuePair<string, CSharpDataType>("smallint",CSharpDataType.@short),
|
new KeyValuePair<string, CSharpDataType>("serial", CSharpDataType.@int),
|
||||||
new KeyValuePair<string, CSharpDataType>("tinyint",CSharpDataType.@byte),
|
};
|
||||||
new KeyValuePair<string, CSharpDataType>("uniqueidentifier",CSharpDataType.Guid),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("binary",CSharpDataType.byteArray),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("image",CSharpDataType.byteArray),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("varbinary",CSharpDataType.byteArray),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("datetimeoffset", CSharpDataType.DateTimeOffset),
|
|
||||||
new KeyValuePair<string, CSharpDataType>("datetimeoffset", CSharpDataType.DateTime)};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace SqlSugar.GBase
|
namespace SqlSugar.GBase
|
||||||
{
|
{
|
||||||
@ -12,7 +13,7 @@ namespace SqlSugar.GBase
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "SELECT NAME FROM master.dbo.sysdatabases ORDER BY NAME";
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string GetColumnInfosByTableNameSql
|
protected override string GetColumnInfosByTableNameSql
|
||||||
@ -67,18 +68,24 @@ namespace SqlSugar.GBase
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
|
return @"select
|
||||||
FROM sysobjects s
|
trim(a.tabname) as name,
|
||||||
LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 AND (tbp.Name='MS_Description' OR tbp.Name is null) WHERE s.xtype IN('U') ";
|
trim(b.comments) as Description
|
||||||
|
from systables a
|
||||||
|
left join syscomments b on b.tabname = a.tabname
|
||||||
|
where a.tabtype in ('T') and not (a.tabname like 'sys%') AND a.tabname <>'dual' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected override string GetViewInfoListSql
|
protected override string GetViewInfoListSql
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return @"SELECT s.Name,Convert(varchar(max),tbp.value) as Description
|
return @"select
|
||||||
FROM sysobjects s
|
trim(a.tabname) as name,
|
||||||
LEFT JOIN sys.extended_properties as tbp ON s.id=tbp.major_id and tbp.minor_id=0 AND (tbp.Name='MS_Description' OR tbp.Name is null) WHERE s.xtype IN('V') ";
|
trim(b.comments) as Description
|
||||||
|
from systables a
|
||||||
|
left join syscomments b on b.tabname = a.tabname
|
||||||
|
where a.tabtype in ('V') and not (a.tabname like 'sys%') AND a.tabname <>'dual' ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -275,7 +282,7 @@ namespace SqlSugar.GBase
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "select top 1 id from sysobjects";
|
return "SELECT TOP 1 * FROM Systables";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -313,94 +320,39 @@ namespace SqlSugar.GBase
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Methods
|
#region Methods
|
||||||
public override bool IsAnyTable(string tableName, bool isCache = true)
|
protected override string GetCreateTableSql(string tableName, List<DbColumnInfo> columns)
|
||||||
{
|
{
|
||||||
if (tableName.Contains("."))
|
List<string> columnArray = new List<string>();
|
||||||
|
Check.Exception(columns.IsNullOrEmpty(), "No columns found ");
|
||||||
|
foreach (var item in columns)
|
||||||
{
|
{
|
||||||
var schemas = GetSchemas();
|
string columnName = this.SqlBuilder.GetTranslationTableName(item.DbColumnName);
|
||||||
var first =this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').First());
|
string dataType = item.DataType;
|
||||||
var schemaInfo= schemas.FirstOrDefault(it=>it.EqualCase(first));
|
string dataSize = GetSize(item);
|
||||||
if (schemaInfo == null)
|
string nullType = item.IsNullable ? this.CreateTableNull : CreateTableNotNull;
|
||||||
|
if (item.IsIdentity&&item.IsPrimarykey)
|
||||||
{
|
{
|
||||||
return base.IsAnyTable(tableName, isCache);
|
dataSize = "";
|
||||||
|
dataType = "serial primary key";
|
||||||
}
|
}
|
||||||
else
|
else if (item.IsIdentity)
|
||||||
{
|
{
|
||||||
var result= this.Context.Ado.GetInt($"select object_id('{tableName}')");
|
dataSize = "";
|
||||||
return result > 0;
|
dataType = "serial";
|
||||||
}
|
}
|
||||||
}
|
else if (item.IsPrimarykey)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
return base.IsAnyTable(tableName, isCache);
|
dataType = (dataType + " primary key");
|
||||||
}
|
}
|
||||||
|
//string identity = item.IsIdentity ? this.CreateTableIdentity : null;
|
||||||
|
string addItem = string.Format(this.CreateTableColumn, columnName, dataType, dataSize, nullType, "", "");
|
||||||
|
columnArray.Add(addItem);
|
||||||
}
|
}
|
||||||
public List<string> GetSchemas()
|
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName), string.Join(",\r\n", columnArray));
|
||||||
{
|
return tableString;
|
||||||
return this.Context.Ado.SqlQuery<string>("SELECT name FROM sys.schemas where name <> 'dbo'");
|
|
||||||
}
|
|
||||||
public override bool DeleteTableRemark(string tableName)
|
|
||||||
{
|
|
||||||
string sql = string.Format(this.DeleteTableRemarkSql, tableName);
|
|
||||||
if (tableName.Contains("."))
|
|
||||||
{
|
|
||||||
var schemas = GetSchemas();
|
|
||||||
var tableSchemas = this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').First());
|
|
||||||
if (schemas.Any(y => y.EqualCase(tableSchemas)))
|
|
||||||
{
|
|
||||||
sql = string.Format(this.DeleteTableRemarkSql, this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').Last()));
|
|
||||||
if (tableSchemas.EqualCase("user"))
|
|
||||||
{
|
|
||||||
sql = sql.Replace("'user'", "'SCHEMA'").Replace("dbo", $"'{tableSchemas}'");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sql = sql.Replace(",dbo,", $",{tableSchemas},").Replace("'user'", "'SCHEMA'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public override bool IsAnyTableRemark(string tableName)
|
|
||||||
{
|
|
||||||
string sql = string.Format(this.IsAnyTableRemarkSql, tableName);
|
|
||||||
if (tableName.Contains("."))
|
|
||||||
{
|
|
||||||
var schemas = GetSchemas();
|
|
||||||
var tableSchemas = this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').First());
|
|
||||||
if (schemas.Any(y => y.EqualCase(tableSchemas)))
|
|
||||||
{
|
|
||||||
sql = string.Format(this.IsAnyTableRemarkSql, this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').Last()));
|
|
||||||
sql = sql.Replace("'dbo'", $"'{tableSchemas}'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var dt = this.Context.Ado.GetDataTable(sql);
|
|
||||||
return dt.Rows != null && dt.Rows.Count > 0;
|
|
||||||
}
|
|
||||||
public override bool AddTableRemark(string tableName, string description)
|
|
||||||
{
|
|
||||||
string sql = string.Format(this.AddTableRemarkSql, tableName, description);
|
|
||||||
if (tableName.Contains("."))
|
|
||||||
{
|
|
||||||
var schemas = GetSchemas();
|
|
||||||
var tableSchemas =this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').First());
|
|
||||||
if (schemas.Any(y => y.EqualCase(tableSchemas)))
|
|
||||||
{
|
|
||||||
sql = string.Format(this.AddTableRemarkSql, this.SqlBuilder.GetNoTranslationColumnName(tableName.Split('.').Last()), description);
|
|
||||||
if (tableSchemas.EqualCase("user"))
|
|
||||||
{
|
|
||||||
sql = sql.Replace("N'user', N'dbo'", $"N'user', '{tableSchemas}'").Replace("N'user'", "N'SCHEMA'");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sql = sql.Replace("N'dbo'", $"N'{tableSchemas}'").Replace("N'user'", "N'SCHEMA'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override bool AddDefaultValue(string tableName, string columnName, string defaultValue)
|
public override bool AddDefaultValue(string tableName, string columnName, string defaultValue)
|
||||||
{
|
{
|
||||||
if (defaultValue == "''")
|
if (defaultValue == "''")
|
||||||
@ -424,65 +376,7 @@ namespace SqlSugar.GBase
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override bool CreateDatabase(string databaseName, string databaseDirectory = null)
|
public override bool CreateDatabase(string databaseName, string databaseDirectory = null)
|
||||||
{
|
{
|
||||||
if (databaseDirectory != null)
|
throw new NotSupportedException();
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!FileHelper.IsExistDirectory(databaseDirectory))
|
|
||||||
{
|
|
||||||
FileHelper.CreateDirectory(databaseDirectory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
//Databases and sites are not in the same service
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var oldDatabaseName = this.Context.Ado.Connection.Database;
|
|
||||||
var connection = this.Context.CurrentConnectionConfig.ConnectionString;
|
|
||||||
connection = connection.Replace(oldDatabaseName, "master");
|
|
||||||
var newDb = new SqlSugarClient(new ConnectionConfig()
|
|
||||||
{
|
|
||||||
DbType = this.Context.CurrentConnectionConfig.DbType,
|
|
||||||
IsAutoCloseConnection = true,
|
|
||||||
ConnectionString = connection
|
|
||||||
});
|
|
||||||
if (!GetDataBaseList(newDb).Any(it => it.Equals(databaseName, StringComparison.CurrentCultureIgnoreCase)))
|
|
||||||
{
|
|
||||||
var sql = CreateDataBaseSql;
|
|
||||||
if (databaseDirectory.HasValue())
|
|
||||||
{
|
|
||||||
sql += @"on primary
|
|
||||||
(
|
|
||||||
name = N'{0}',
|
|
||||||
filename = N'{1}\{0}.mdf',
|
|
||||||
size = 10mb,
|
|
||||||
maxsize = 100mb,
|
|
||||||
filegrowth = 1mb
|
|
||||||
),
|
|
||||||
(
|
|
||||||
name = N'{0}_ndf',
|
|
||||||
filename = N'{1}\{0}.ndf',
|
|
||||||
size = 10mb,
|
|
||||||
maxsize = 100mb,
|
|
||||||
filegrowth = 10 %
|
|
||||||
)
|
|
||||||
log on
|
|
||||||
(
|
|
||||||
name = N'{0}_log',
|
|
||||||
filename = N'{1}\{0}.ldf',
|
|
||||||
size = 100mb,
|
|
||||||
maxsize = 1gb,
|
|
||||||
filegrowth = 10mb
|
|
||||||
); ";
|
|
||||||
}
|
|
||||||
if (databaseName.Contains("."))
|
|
||||||
{
|
|
||||||
databaseName = $"[{databaseName}]";
|
|
||||||
}
|
|
||||||
newDb.Ado.ExecuteCommand(string.Format(sql, databaseName, databaseDirectory));
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
public override bool CreateTable(string tableName, List<DbColumnInfo> columns, bool isCreatePrimaryKey = true)
|
public override bool CreateTable(string tableName, List<DbColumnInfo> columns, bool isCreatePrimaryKey = true)
|
||||||
{
|
{
|
||||||
@ -497,21 +391,21 @@ namespace SqlSugar.GBase
|
|||||||
}
|
}
|
||||||
string sql = GetCreateTableSql(tableName, columns);
|
string sql = GetCreateTableSql(tableName, columns);
|
||||||
this.Context.Ado.ExecuteCommand(sql);
|
this.Context.Ado.ExecuteCommand(sql);
|
||||||
if (isCreatePrimaryKey)
|
//if (isCreatePrimaryKey)
|
||||||
{
|
//{
|
||||||
var pkColumns = columns.Where(it => it.IsPrimarykey).ToList();
|
// var pkColumns = columns.Where(it => it.IsPrimarykey).ToList();
|
||||||
if (pkColumns.Count > 1)
|
// if (pkColumns.Count > 1)
|
||||||
{
|
// {
|
||||||
this.Context.DbMaintenance.AddPrimaryKeys(tableName, pkColumns.Select(it => it.DbColumnName).ToArray());
|
// this.Context.DbMaintenance.AddPrimaryKeys(tableName, pkColumns.Select(it => it.DbColumnName).ToArray());
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
foreach (var item in pkColumns)
|
// foreach (var item in pkColumns)
|
||||||
{
|
// {
|
||||||
this.Context.DbMaintenance.AddPrimaryKey(tableName, item.DbColumnName);
|
// this.Context.DbMaintenance.AddPrimaryKey(tableName, item.DbColumnName);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public override List<DbColumnInfo> GetColumnInfosByTableName(string tableName, bool isCache = true)
|
public override List<DbColumnInfo> GetColumnInfosByTableName(string tableName, bool isCache = true)
|
||||||
|
@ -9,7 +9,12 @@ namespace SqlSugar.GBase
|
|||||||
{
|
{
|
||||||
public class GBaseBuilder : SqlBuilderProvider
|
public class GBaseBuilder : SqlBuilderProvider
|
||||||
{
|
{
|
||||||
public override string SqlTranslationLeft { get { return "["; } }
|
public override string SqlTranslationLeft { get { return ""; } }
|
||||||
public override string SqlTranslationRight { get { return "]"; } }
|
public override string SqlTranslationRight { get { return ""; } }
|
||||||
|
public override string GetNoTranslationColumnName(string name)
|
||||||
|
{
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user