mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-23 12:33:44 +08:00
QuestDb Last On
This commit is contained in:
@@ -15,7 +15,11 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public override ISugarQueryable<T> PartitionBy(string groupFileds)
|
public override ISugarQueryable<T> PartitionBy(string groupFileds)
|
||||||
{
|
{
|
||||||
this.GroupBy(groupFileds);
|
if (this.QueryBuilder.Take == 1)
|
||||||
|
{
|
||||||
|
this.QueryBuilder.Take = null;
|
||||||
|
}
|
||||||
|
this.QueryBuilder.PartitionByValue=groupFileds;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -78,6 +78,11 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
result = result + TranLock;
|
result = result + TranLock;
|
||||||
}
|
}
|
||||||
|
if (this.PartitionByValue.HasValue())
|
||||||
|
{
|
||||||
|
var addSql = " LATEST ON " + UtilMethods.ReplaceFirstMatch(this.PartitionByValue, ",", " PARTITION BY ");
|
||||||
|
result =result+ addSql;
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
private string ToCountSqlString()
|
private string ToCountSqlString()
|
||||||
|
@@ -496,6 +496,11 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
return type.IsValueType ? Activator.CreateInstance(type) : null;
|
return type.IsValueType ? Activator.CreateInstance(type) : null;
|
||||||
}
|
}
|
||||||
|
public static string ReplaceFirstMatch(string input, string pattern, string replacement)
|
||||||
|
{
|
||||||
|
Regex regex = new Regex(pattern);
|
||||||
|
return regex.Replace(input, replacement, 1);
|
||||||
|
}
|
||||||
public static string ReplaceSqlParameter(string itemSql, SugarParameter itemParameter, string newName)
|
public static string ReplaceSqlParameter(string itemSql, SugarParameter itemParameter, string newName)
|
||||||
{
|
{
|
||||||
itemSql = Regex.Replace(itemSql, string.Format(@"{0} ", "\\" + itemParameter.ParameterName), newName + " ", RegexOptions.IgnoreCase);
|
itemSql = Regex.Replace(itemSql, string.Format(@"{0} ", "\\" + itemParameter.ParameterName), newName + " ", RegexOptions.IgnoreCase);
|
||||||
|
Reference in New Issue
Block a user