From a095ed39a68f461ad4999ee89d8e0395a5f4d636 Mon Sep 17 00:00:00 2001
From: sunkaixuan <610262374@qq.com>
Date: Tue, 4 Jun 2019 16:03:25 +0800
Subject: [PATCH] Update demo
---
.../Sqlite/DbMaintenance/SqliteDbMaintenance.cs | 12 ++++++++++++
.../SqliteTest/DataBase/SqlSugar4xTest.sqlite | Bin 0 -> 45056 bytes
.../SqliteTest/DataBase/SqlSugar4xTest2.sqlite | Bin 0 -> 16384 bytes
.../SqliteTest/DataBase/SqlSugar4xTest3.sqlite | Bin 0 -> 12288 bytes
Src/Asp.Net/SqliteTest/Demo/Demo1_Queryable.cs | 2 +-
5 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite
create mode 100644 Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite
create mode 100644 Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite
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 0000000000000000000000000000000000000000..510a047f27eb07e611df08f545f1df53a5df39da
GIT binary patch
literal 45056
zcmeI*Pi)&%90%}cJAa%s&MO;T=r*Zd|ER4x2mg(e?f^;XVbFHnmI`)2lashzSpRHU
zihx_j1+*hq4qOJejq3ylq#Y(9ZXhvf5}ZLCr%7xQ;@N4_Bu%<#6I#W-QU1KY{=N6{
zb0x=ad;aWvrRK^jo7HuvCL3gsa2$D4mI)yX>@~n%I}ed10y`P@$+e_=B^QYD_h*uH
zgG8e@302|`;zar)c1wCYc5LA0!0W6K4+ua20uX=z1Rwwb2y_b6!_jbJWQ41~Uvr9U
zZZ@~zT)9%&SZyW-^5^EVg*my9&CSorqs{WsDJeRdJzXA^D;qU;)vd~lXA1J-^8CEK
zbnf&*_S^;eow*BgcDZoo^dj5F!rWrvBa2
z!^2!%^XHh~x>nm&{xs()T8iueuJ~zZLHYDYI0Kr5cB@KfeY-+k){9Z?;&L
z_)ubIhP&WTY8zr|RE3{3vqjGA49i1mx&*}OS7fy_gao1OOvEE`!v9jj#
zG?IMVwnkfO8hkZ(y=}C8{Xp`!(zTn9u=I?8^0efwxIsebZ}dAai3bEA009U<00Izz
z00bZa0SG_<0tZUq1Ro@vm=|?b%P49}QB7G(&8qsWkx3eQO3xT6nG2GLnD1zz&02QS
zN~vkhwj_Fw1nC`tKA?ZlALt$W(}9{J1_J>IKmY;|fB*y_009U<00Izrxdnm&fpR%M
zD6o$#Pal(DL<$NcT=U*1KEeqJ&cAWsIHRJxFxJRz-=@IILXm9q`u_v^E&ZGp=_z_B
z{#X2N{LA=O{A_$m`bWAi{V07e-IBhNK9LHNAtho@V!y}k#=eQ&h?QUNoq*Xx00Izz
z00bZa0SG_<0-XXA$3tXD%##nC(&dgzk@~D@BvTnxH&yNEu@Ir6A(mBD)fE3JtLm)(
zJbJWISL#+b+^8#dt9z|c=X9$}?9=Z^?|vggAu`Oyx#`_2uXWk*_^TmuOgy#SK-V&=
z+A*CZ>otD3wUySRRqT)#jF3jK*eh+hK|i-0Cq`Ry>7lhb#L3mfM
zZB5VUnTbeW%_c>E5|IYcp0I3tx@j7!W{rn?o2W+8QVrX*?8(r+Caj@qskW6eCxShP
z=U-t@sb*SBTN8o)nhE_iSl>JW8#;WW65=NJ`x^w>DdCVdY0SG_<
z0uX=z1Rwwb2tWV=5P-n{N5DJ(=jqpk{>
z3QP&hTtD9f@RP!Fq@V8qyzBo#_BR0OBl-*dll>Qfd%MAqf&c^{009U<00Izz00bZa
z0SG|gKnV;S36No~bg8mdHh7T_u)nua-Q282W2`vh7wgf1W?B=uofeJz{~r?im_9sE
zGs0jX009U<00Izz00bZa0SG_<0uXpEfdDTMnhkK?JI?=~ixQn7009U<00Izz00bZa
z0SG_<0tZ&WKmX79=l{9J`TrwApU_7KcEA`I1Rwwb2tWV=5P$##AOHafKmY>IARw?i
L03rgr0U+`(Xqdyn
literal 0
HcmV?d00001
diff --git a/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest2.sqlite
new file mode 100644
index 0000000000000000000000000000000000000000..17ccd3b1e89b352f2a70738085173efd990957fd
GIT binary patch
literal 16384
zcmeI&Jx|*}7zgk>C*q|Nn9X8)@oOb=7luP^1r^XsS2re#>|iF_bNd^00Izz00bZa0SG_<0uX?}KM=U-rk1Tt
zhTopc;B+K9@leE{g$%;cvuwKAa~r-(e&bWyCHq;4on8B2x1@+#Lz}{}6z3u)uj7+<
z)NWI^*E($U`t-%^Q{%|*v^>?(q3iiOs#VgE%eRZ%?M;@=A;cV&OJ5H?f7n>^O+Tj%t~^Ip)ij
zW$`=n2`PDfW3K&dN;8sIb9ibno34X+a1q4WqT}Qi=KNL=joG}K%E|mU(%(m6>9x6G
z{$S>Vx*#9`0SG_<0uX=z1Rwwb2tWV=5cm%Swu~jVxzb#j=-)JjqEpzz
literal 0
HcmV?d00001
diff --git a/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest3.sqlite
new file mode 100644
index 0000000000000000000000000000000000000000..b0eb4c19b41a67ae876ce5cffc417a49b62dc8c0
GIT binary patch
literal 12288
zcmeI&zfZzI6bJCT;*V&8H7+I&=A{z^NQ#8T$x3QMECulxn8*pIHbDsGFs?fJ$N6VC
z@(;Lqg`ly64o)QB%eB3izI%85Y?t)>_9{7~X&5h)PDw>)3=N{iqO1{h%HEZL6x`^Vb7Rd_b
zRA~LE>7?E|x$Le}A2<|^w7OFZFB!F1Nv%Yb6dIV3HlyXrMET@w&h2+*IvNBZ009U<
z00Izz00bZa0SG_<0&6UA#5b93SEO`Zw_I9ua^2HKU!MQx%$~3D2V(0GfB*y_009U<
Y00Izz00bZa0SJ5v9PmtGC-qyxClSwg761SM
literal 0
HcmV?d00001
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 ####");
}