mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 22:11:36 +08:00
Update demo
This commit is contained in:
parent
15616575dc
commit
a095ed39a6
@ -6,6 +6,7 @@ using System.Data.SQLite;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
@ -264,6 +265,16 @@ namespace SqlSugar
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override bool CreateDatabase(string databaseName, string databaseDirectory = null)
|
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.Open();
|
||||||
this.Context.Ado.Connection.Close();
|
this.Context.Ado.Connection.Close();
|
||||||
return true;
|
return true;
|
||||||
@ -289,6 +300,7 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
private List<DbColumnInfo> GetColumnsByTableName(string tableName)
|
private List<DbColumnInfo> GetColumnsByTableName(string tableName)
|
||||||
{
|
{
|
||||||
|
tableName = SqlBuilder.GetTranslationTableName(tableName);
|
||||||
string sql = "select * from " + tableName + " limit 0,1";
|
string sql = "select * from " + tableName + " limit 0,1";
|
||||||
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
|
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
|
||||||
this.Context.Ado.IsEnableLogEvent = false;
|
this.Context.Ado.IsEnableLogEvent = false;
|
||||||
|
BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite
Normal file
BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite
Normal file
Binary file not shown.
BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite
Normal file
BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite
Normal file
Binary file not shown.
BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite
Normal file
BIN
Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite
Normal file
Binary file not shown.
@ -123,7 +123,7 @@ namespace OrmTest
|
|||||||
Console.WriteLine("");
|
Console.WriteLine("");
|
||||||
Console.WriteLine("#### SqlFunc Start ####");
|
Console.WriteLine("#### SqlFunc Start ####");
|
||||||
var db = GetInstance();
|
var db = GetInstance();
|
||||||
var index= db.Queryable<Order>().Select(it => SqlFunc.CharIndex("a", "cccacc")).First();
|
var index= db.Queryable<Order>().Select(it => SqlFunc.Contains("a", "cccacc")).First();
|
||||||
|
|
||||||
Console.WriteLine("#### SqlFunc End ####");
|
Console.WriteLine("#### SqlFunc End ####");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user