|
|
@ -6,6 +6,7 @@ using System.Data.SQLite; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Text; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
|
|
|
|
namespace SqlSugar |
|
|
|
{ |
|
|
@ -264,6 +265,16 @@ namespace SqlSugar |
|
|
|
/// <returns></returns>
|
|
|
|
public override bool CreateDatabase(string databaseName, string databaseDirectory = null) |
|
|
|
{ |
|
|
|
var connString=this.Context.CurrentConnectionConfig.ConnectionString; |
|
|
|
var path = Regex.Match(connString, @"[a-z,A-Z]\:\\.+\\").Value; |
|
|
|
if (path.IsNullOrEmpty()) |
|
|
|
{ |
|
|
|
path = Regex.Match(connString, @"[a-z,A-Z]\:\/.+\/").Value; |
|
|
|
} |
|
|
|
if (!FileHelper.IsExistDirectory(path)) |
|
|
|
{ |
|
|
|
FileHelper.CreateDirectory(path); |
|
|
|
} |
|
|
|
this.Context.Ado.Connection.Open(); |
|
|
|
this.Context.Ado.Connection.Close(); |
|
|
|
return true; |
|
|
@ -289,6 +300,7 @@ namespace SqlSugar |
|
|
|
} |
|
|
|
private List<DbColumnInfo> GetColumnsByTableName(string tableName) |
|
|
|
{ |
|
|
|
tableName = SqlBuilder.GetTranslationTableName(tableName); |
|
|
|
string sql = "select * from " + tableName + " limit 0,1"; |
|
|
|
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent; |
|
|
|
this.Context.Ado.IsEnableLogEvent = false; |
|
|
|