mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 21:56:03 +08:00
Update questdb
This commit is contained in:
parent
04b6b388ba
commit
bb9b6c07ab
@ -8,6 +8,7 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
@ -21,6 +22,7 @@ namespace SqlSugar
|
|||||||
{
|
{
|
||||||
internal string url = string.Empty;
|
internal string url = string.Empty;
|
||||||
internal string authorization = string.Empty;
|
internal string authorization = string.Empty;
|
||||||
|
internal static Random random = new Random();
|
||||||
ISqlSugarClient db;
|
ISqlSugarClient db;
|
||||||
public QuestDbRestAPI(ISqlSugarClient db)
|
public QuestDbRestAPI(ISqlSugarClient db)
|
||||||
{
|
{
|
||||||
@ -69,7 +71,7 @@ namespace SqlSugar
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<int> BulkCopyAsync<T>(List<T> insertList, string dateFormat = "yyyy/M/d H:mm:ss") where T : class
|
public async Task<int> BulkCopyAsync<T>(List<T> insertList, string dateFormat = "yyyy/M/d H:mm:ss") where T : class
|
||||||
{
|
{
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(url))
|
if (string.IsNullOrWhiteSpace(url))
|
||||||
{
|
{
|
||||||
throw new Exception("BulkCopy功能需要启用RestAPI,程序启动时执行:RestAPIExtension.UseQuestDbRestAPI(\"localhost:9000\", \"username\", \"password\")");
|
throw new Exception("BulkCopy功能需要启用RestAPI,程序启动时执行:RestAPIExtension.UseQuestDbRestAPI(\"localhost:9000\", \"username\", \"password\")");
|
||||||
@ -82,8 +84,12 @@ namespace SqlSugar
|
|||||||
var client = new HttpClient();
|
var client = new HttpClient();
|
||||||
var boundary = "---------------" + DateTime.Now.Ticks.ToString("x");
|
var boundary = "---------------" + DateTime.Now.Ticks.ToString("x");
|
||||||
var list = new List<Hashtable>();
|
var list = new List<Hashtable>();
|
||||||
var name = db.EntityMaintenance.GetEntityInfo<T>().DbTableName; //获取表名
|
var name = db.EntityMaintenance.GetEntityInfo<T>().DbTableName;
|
||||||
db.DbMaintenance.GetColumnInfosByTableName(name).ForEach(d =>
|
|
||||||
|
var key ="QuestDbBulkCopy"+ typeof(T).FullName + typeof(T).GetHashCode();
|
||||||
|
var columns = new ReflectionInoCacheService().GetOrCreate(key, () =>
|
||||||
|
db.CopyNew().DbMaintenance.GetColumnInfosByTableName(name));
|
||||||
|
columns.ForEach(d =>
|
||||||
{
|
{
|
||||||
if (d.DataType == "TIMESTAMP")
|
if (d.DataType == "TIMESTAMP")
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user