mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-01-22 02:51:58 +08:00
Update ClickHouse
This commit is contained in:
@@ -86,6 +86,7 @@ namespace SqlSugar.ClickHouse
|
||||
new KeyValuePair<string, CSharpDataType>("Datetime64",CSharpDataType.DateTime),
|
||||
new KeyValuePair<string, CSharpDataType>("Float64",CSharpDataType.@double),
|
||||
new KeyValuePair<string, CSharpDataType>("Float32",CSharpDataType.@float),
|
||||
new KeyValuePair<string, CSharpDataType>("nullable",CSharpDataType.@object),
|
||||
};
|
||||
public override List<string> StringThrow
|
||||
{
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace SqlSugar.ClickHouse
|
||||
{
|
||||
get
|
||||
{
|
||||
return "ALTER TABLE {0} ADD PRIMARY KEY({2}) /*{1}*/";
|
||||
return "";
|
||||
}
|
||||
}
|
||||
protected override string AddColumnToTableSql
|
||||
@@ -220,6 +220,10 @@ namespace SqlSugar.ClickHouse
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public override bool AddPrimaryKey(string tableName, string columnName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool AddDefaultValue(string tableName, string columnName, string defaultValue)
|
||||
{
|
||||
return base.AddDefaultValue(this.SqlBuilder.GetTranslationTableName(tableName), this.SqlBuilder.GetTranslationTableName(columnName), defaultValue);
|
||||
@@ -324,6 +328,7 @@ namespace SqlSugar.ClickHouse
|
||||
List<string> columnArray = new List<string>();
|
||||
Check.Exception(columns.IsNullOrEmpty(), "No columns found ");
|
||||
var pkName = "";
|
||||
var isLower = ((ClickHouseBuilder)this.SqlBuilder).isAutoToLower;
|
||||
foreach (var item in columns)
|
||||
{
|
||||
string columnName = item.DbColumnName;
|
||||
@@ -339,14 +344,14 @@ namespace SqlSugar.ClickHouse
|
||||
}
|
||||
string nullType = item.IsNullable ? this.CreateTableNull : CreateTableNotNull;
|
||||
string primaryKey = "";
|
||||
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName.ToLower()), dataType, dataSize, nullType, primaryKey, "");
|
||||
string addItem = string.Format(this.CreateTableColumn, this.SqlBuilder.GetTranslationColumnName(columnName.ToLower(isLower)), dataType, dataSize, nullType, primaryKey, "");
|
||||
columnArray.Add(addItem);
|
||||
if (pkName.IsNullOrEmpty()&&item.IsPrimarykey)
|
||||
{
|
||||
pkName = item.DbColumnName;
|
||||
}
|
||||
}
|
||||
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName.ToLower()), string.Join(",\r\n", columnArray));
|
||||
string tableString = string.Format(this.CreateTableSql, this.SqlBuilder.GetTranslationTableName(tableName.ToLower(isLower)), string.Join(",\r\n", columnArray));
|
||||
if (pkName.HasValue())
|
||||
{
|
||||
pkName = this.SqlBuilder.GetTranslationColumnName(pkName);
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace SqlSugar.ClickHouse
|
||||
{
|
||||
public class ClickHouseExpressionContext : ExpressionContext, ILambdaExpressions
|
||||
{
|
||||
public SqlSugarProvider Context { get; set; }
|
||||
public SqlSugarProvider Context { get; set; } = new SqlSugarProvider(new ConnectionConfig() { });
|
||||
public ClickHouseExpressionContext()
|
||||
{
|
||||
base.DbMehtods = new ClickHouseMethod();
|
||||
@@ -31,7 +31,7 @@ namespace SqlSugar.ClickHouse
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.PgSqlIsAutoToLower;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public override string GetTranslationTableName(string entityName, bool isMapping = true)
|
||||
|
||||
@@ -11,7 +11,11 @@ namespace SqlSugar.ClickHouse
|
||||
{
|
||||
public static string ToLower(this string value, bool isLower)
|
||||
{
|
||||
return value.ObjToString().ToLower();
|
||||
if (isLower)
|
||||
{
|
||||
return value.ObjToString().ToLower();
|
||||
}
|
||||
return value.ObjToString();
|
||||
}
|
||||
public static int ObjToInt(this object thisValue)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user