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