diff --git a/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs b/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs index b20c133ad..50a31e5da 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs +++ b/Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs @@ -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 /// 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 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; diff --git a/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite new file mode 100644 index 000000000..510a047f2 Binary files /dev/null and b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite differ diff --git a/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite new file mode 100644 index 000000000..17ccd3b1e Binary files /dev/null and b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite differ diff --git a/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite new file mode 100644 index 000000000..b0eb4c19b Binary files /dev/null and b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite differ diff --git a/Src/Asp.Net/SqliteTest/Demo/Demo1_Queryable.cs b/Src/Asp.Net/SqliteTest/Demo/Demo1_Queryable.cs index b61cb30b0..372fe8586 100644 --- a/Src/Asp.Net/SqliteTest/Demo/Demo1_Queryable.cs +++ b/Src/Asp.Net/SqliteTest/Demo/Demo1_Queryable.cs @@ -123,7 +123,7 @@ namespace OrmTest Console.WriteLine(""); Console.WriteLine("#### SqlFunc Start ####"); var db = GetInstance(); - var index= db.Queryable().Select(it => SqlFunc.CharIndex("a", "cccacc")).First(); + var index= db.Queryable().Select(it => SqlFunc.Contains("a", "cccacc")).First(); Console.WriteLine("#### SqlFunc End ####"); }