mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
commit
6843beeabe
@ -46,7 +46,7 @@ namespace FreeSql.QuestDb.Curd
|
|||||||
{
|
{
|
||||||
if (execAsync.Contains("401"))
|
if (execAsync.Contains("401"))
|
||||||
{
|
{
|
||||||
throw new Exception("请确认QuestDb设置的RestAPI账号是否正确.");
|
throw new Exception("请确认new FreeSqlBuilder().UseQuestDbRestAPI()中设置的用户名密码是否正确.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var ddl = resultHash["ddl"]?.ToString();
|
var ddl = resultHash["ddl"]?.ToString();
|
||||||
|
@ -33,7 +33,6 @@ namespace FreeSql.QuestDb.Curd
|
|||||||
|
|
||||||
private int InternelExecuteAffrows()
|
private int InternelExecuteAffrows()
|
||||||
{
|
{
|
||||||
//如果设置了RestAPI的Url则走HTTP
|
|
||||||
var sql = ToSql();
|
var sql = ToSql();
|
||||||
var execAsync = RestAPIExtension.ExecAsync(sql).GetAwaiter().GetResult();
|
var execAsync = RestAPIExtension.ExecAsync(sql).GetAwaiter().GetResult();
|
||||||
var resultHash = new Hashtable();
|
var resultHash = new Hashtable();
|
||||||
@ -45,7 +44,7 @@ namespace FreeSql.QuestDb.Curd
|
|||||||
{
|
{
|
||||||
if (execAsync.Contains("401"))
|
if (execAsync.Contains("401"))
|
||||||
{
|
{
|
||||||
throw new Exception("请确认QuestDb设置的RestAPI账号是否正确.");
|
throw new Exception("请确认new FreeSqlBuilder().UseQuestDbRestAPI()中设置的用户名密码是否正确.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var ddl = resultHash["ddl"]?.ToString();
|
var ddl = resultHash["ddl"]?.ToString();
|
||||||
@ -55,6 +54,7 @@ namespace FreeSql.QuestDb.Curd
|
|||||||
|
|
||||||
public override int ExecuteAffrows()
|
public override int ExecuteAffrows()
|
||||||
{
|
{
|
||||||
|
//如果设置了RestAPI中Url则走HTTP
|
||||||
if (string.IsNullOrWhiteSpace(RestAPIExtension.BaseUrl))
|
if (string.IsNullOrWhiteSpace(RestAPIExtension.BaseUrl))
|
||||||
{
|
{
|
||||||
return base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 500,
|
return base.SplitExecuteAffrows(_batchRowsLimit > 0 ? _batchRowsLimit : 500,
|
||||||
|
@ -7,8 +7,9 @@ namespace FreeSql.Provider.QuestDb
|
|||||||
{
|
{
|
||||||
internal class QuestDbContainer
|
internal class QuestDbContainer
|
||||||
{
|
{
|
||||||
|
//作用于HttpClientFatory
|
||||||
private static IServiceCollection Services;
|
private static IServiceCollection Services;
|
||||||
public static IServiceProvider ServiceProvider { get; private set; }
|
internal static IServiceProvider ServiceProvider { get; private set; }
|
||||||
|
|
||||||
internal static void Initialize(Action<IServiceCollection> service)
|
internal static void Initialize(Action<IServiceCollection> service)
|
||||||
{
|
{
|
||||||
|
@ -55,8 +55,6 @@ public static partial class QuestDbGlobalExtensions
|
|||||||
lines.Add(line);
|
lines.Add(line);
|
||||||
line = sr.ReadLine();
|
line = sr.ReadLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +69,10 @@ public static partial class QuestDbGlobalExtensions
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that) where T : class
|
public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that) where T : class
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(RestAPIExtension.BaseUrl))
|
||||||
|
{
|
||||||
|
throw new Exception("BulkCopy功能需要启用RestAPI,启用方式:new FreeSqlBuilder().UseQuestDbRestAPI(\"localhost:9000\", \"username\", \"password\")");
|
||||||
|
}
|
||||||
var result = 0;
|
var result = 0;
|
||||||
var fileName = $"{Guid.NewGuid()}.csv";
|
var fileName = $"{Guid.NewGuid()}.csv";
|
||||||
var filePath = Path.Combine(AppContext.BaseDirectory, fileName);
|
var filePath = Path.Combine(AppContext.BaseDirectory, fileName);
|
||||||
@ -89,7 +91,7 @@ public static partial class QuestDbGlobalExtensions
|
|||||||
{
|
{
|
||||||
{ "name", d.Name },
|
{ "name", d.Name },
|
||||||
{ "type", d.DbTypeText },
|
{ "type", d.DbTypeText },
|
||||||
{ "pattern", "yyyy/M/dd HH:mm:ss" }
|
{ "pattern", "yyyy/M/d H:mm:ss" }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -136,14 +138,13 @@ public static partial class QuestDbGlobalExtensions
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine(e);
|
throw e;
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File.Delete(filePath);
|
// File.Delete(filePath);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user