Update ClickHouse

This commit is contained in:
sunkaixuan 2022-08-13 17:25:34 +08:00
parent bf853eac7b
commit 7f257fbc51
5 changed files with 10 additions and 14 deletions

View File

@ -24,14 +24,14 @@ namespace SqlSugar.ClickHouse
{ {
get get
{ {
return "current_date"; return "now()";
} }
} }
public override string FullSqlDateNow public override string FullSqlDateNow
{ {
get get
{ {
return "select current_date"; return "select now()";
} }
} }

View File

@ -3,5 +3,6 @@
public class ClickHouseDeleteBuilder : DeleteBuilder public class ClickHouseDeleteBuilder : DeleteBuilder
{ {
public override string SqlTemplate => "ALTER TABLE {0} DELETE {1}";
} }
} }

View File

@ -20,17 +20,10 @@ namespace SqlSugar.ClickHouse
public override string UpdateSql { get; set; } = @"UPDATE {1} SET {0} FROM {2} AS TE WHERE {3} public override string UpdateSql { get; set; } = @"UPDATE {1} SET {0} FROM {2} AS TE WHERE {3}
"; ";
//public virtual async Task<int> UpdateByTempAsync(string tableName, string tempName, string[] updateColumns, string[] whereColumns)
//{
// Check.ArgumentNullException(!updateColumns.Any(), "update columns count is 0");
// Check.ArgumentNullException(!whereColumns.Any(), "where columns count is 0");
// var sets = string.Join(",", updateColumns.Select(it => $"TM.{it}=TE.{it}"));
// var wheres = string.Join(",", whereColumns.Select(it => $"TM.{it}=TE.{it}"));
// string sql = string.Format(UpdateSql, sets, tableName, tempName, wheres);
// return await this.Context.Ado.ExecuteCommandAsync(sql);
//}
public async Task<int> ExecuteBulkCopyAsync(DataTable dt) public async Task<int> ExecuteBulkCopyAsync(DataTable dt)
{ {
await Task.FromResult(0);
throw new NotSupportedException("NotSupportedException"); throw new NotSupportedException("NotSupportedException");
} }
@ -39,5 +32,6 @@ namespace SqlSugar.ClickHouse
throw new NotSupportedException("NotSupportedException"); throw new NotSupportedException("NotSupportedException");
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace SqlSugar.ClickHouse
{ {
base.AppendFilter(); base.AppendFilter();
string oldOrderValue = this.OrderByValue; string oldOrderValue = this.OrderByValue;
string result = null; string result = "";
sql = new StringBuilder(); sql = new StringBuilder();
sql.AppendFormat(SqlTemplate, GetSelectValue, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, (Skip != null || Take != null) ? null : GetOrderByString); sql.AppendFormat(SqlTemplate, GetSelectValue, GetTableNameString, GetWhereValueString, GetGroupByString + HavingInfos, (Skip != null || Take != null) ? null : GetOrderByString);
if (IsCount) { return sql.ToString(); } if (IsCount) { return sql.ToString(); }

View File

@ -7,6 +7,7 @@ namespace SqlSugar.ClickHouse
{ {
public class ClickHouseUpdateBuilder : UpdateBuilder public class ClickHouseUpdateBuilder : UpdateBuilder
{ {
public override string SqlTemplate => "ALTER TABLE {0} UPDATE {1} {2}";
public override string SqlTemplateBatch public override string SqlTemplateBatch
{ {
get get