Support database "Vastbase"

This commit is contained in:
sunkaixuan 2023-10-11 18:23:04 +08:00
parent fcf91c87fc
commit cf1802bdca
3 changed files with 17 additions and 2 deletions

View File

@ -421,7 +421,7 @@ namespace SqlSugar
}
return false;
}
private static void CheckDbDependency(ConnectionConfig config)
private void CheckDbDependency(ConnectionConfig config)
{
switch (config.DbType)
{
@ -491,6 +491,14 @@ namespace SqlSugar
case DbType.GaussDB:
config.DbType = DbType.PostgreSQL;
break;
case DbType.Vastbase:
config.DbType = DbType.PostgreSQL;
if (this.TempItems == null)
{
this.TempItems = new Dictionary<string, object>();
}
this.TempItems.Add("DbType.Vastbase", "DbType.Vastbase");
break;
case DbType.OceanBase:
config.DbType = DbType.MySql;
break;

View File

@ -28,6 +28,7 @@ namespace SqlSugar
GaussDB,
OceanBase,
Tidb,
Vastbase,
Custom =900
}
}

View File

@ -377,7 +377,13 @@ WHERE tgrelid = '"+tableName+"'::regclass");
});
if (!GetDataBaseList(newDb).Any(it => it.Equals(databaseName, StringComparison.CurrentCultureIgnoreCase)))
{
newDb.Ado.ExecuteCommand(string.Format(CreateDataBaseSql, this.SqlBuilder.SqlTranslationLeft+databaseName+this.SqlBuilder.SqlTranslationRight, databaseDirectory));
var isVast = this.Context?.TempItems?.ContainsKey("DbType.Vastbase")==true;
var dbcompatibility = "";
if (isVast)
{
dbcompatibility=" dbcompatibility = 'PG'";
}
newDb.Ado.ExecuteCommand(string.Format(CreateDataBaseSql, this.SqlBuilder.SqlTranslationLeft+databaseName+this.SqlBuilder.SqlTranslationRight, databaseDirectory)+ dbcompatibility);
}
return true;
}