From 0b5db835da1d1ca0671574885dfc41ca89c08544 Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sun, 9 Jul 2017 19:31:01 +0800 Subject: [PATCH] Update Sqlite --- .../Realization/Sqlite/SqliteProvider.cs | 1 - .../SqliteTest/DataBase/SqlSugar4xTest.sqlite | Bin 73728 -> 73728 bytes Src/Asp.Net/SqliteTest/UnitTest/Delete.cs | 6 +++--- Src/Asp.Net/SqliteTest/UnitTest/Insert.cs | 12 ++++++------ Src/Asp.Net/SqliteTest/UnitTest/Update.cs | 12 ++++++------ 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqliteProvider.cs b/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqliteProvider.cs index 78a991638..2caf44fb0 100644 --- a/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqliteProvider.cs +++ b/Src/Asp.Net/SqlSugar/Realization/Sqlite/SqliteProvider.cs @@ -85,7 +85,6 @@ namespace SqlSugar sqlParameter.Size = parameter.Size; sqlParameter.Value = parameter.Value; sqlParameter.DbType = parameter.DbType; - sqlParameter.Direction = parameter.Direction; result[index] = sqlParameter; if (sqlParameter.Direction == ParameterDirection.Output) { if (this.OutputParameters == null) this.OutputParameters = new List(); diff --git a/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite b/Src/Asp.Net/SqliteTest/DataBase/SqlSugar4xTest.sqlite index 7eb9de7bd0d7c6307493b67d5ce407a6d489098b..74bf1207e03e7da3b9f660a364587b6b7573f635 100644 GIT binary patch delta 1119 zcmZoTz|wGlWr8%L*+dyl&Eq8Udrx(#q7#%Fsy9%uqrIr@{4t_)L}%z^RcRuRcDU`gl?G0sW7h<|KG< zYUD=Mh^CJVr#?=+`sz7wYGlW&kqxIlR($$oSWspCQ2impj4F*L%Y;vsfq_A2^Cy3i p18g@L_@D9L1m^Fv{6gGJ%+id(C8a5;c_m5`jLhbolOOPk0szF{)^q>> delta 82 zcmV-Y0ImOkzyyH61dtm643Qi|1q=W!;wG_Voj(Zx0003G?f?(&vk@TV4+Iba1pu@1 oPZYog+5ivc58AU45Y7(~3IYQg2~%`+WMyu27y$z}36tOr73w+{umAu6 diff --git a/Src/Asp.Net/SqliteTest/UnitTest/Delete.cs b/Src/Asp.Net/SqliteTest/UnitTest/Delete.cs index 85746af02..ac61367cd 100644 --- a/Src/Asp.Net/SqliteTest/UnitTest/Delete.cs +++ b/Src/Asp.Net/SqliteTest/UnitTest/Delete.cs @@ -22,7 +22,7 @@ namespace OrmTest var db = GetInstance(); //by entity var t1= db.Deleteable().Where(new Student() { Id = 1 }).ToSql(); - base.Check(@"DELETE FROM `STudent` WHERE `ID` IN ('1') ", + base.Check(@"DELETE FROM `STudent` WHERE `Id` IN ('1') ", null, t1.Key, null, "Delte t1 error" @@ -37,14 +37,14 @@ namespace OrmTest //by primary key var t3 = db.Deleteable().In(1).ToSql(); - base.Check(@"DELETE FROM `STudent` WHERE `ID` IN ('1') ", + base.Check(@"DELETE FROM `STudent` WHERE `Id` IN ('1') ", null, t3.Key, null, "Delte tt error" ); //by primary key array var t4 = db.Deleteable().In(new int[] { 1,2}).ToSql(); - base.Check(@"DELETE FROM `STudent` WHERE `ID` IN ('1','2') ", null, t4.Key, null, "Update t4 error"); + base.Check(@"DELETE FROM `STudent` WHERE `Id` IN ('1','2') ", null, t4.Key, null, "Update t4 error"); //by expression var t5 = db.Deleteable().Where(it=>it.Id==1).ToSql(); diff --git a/Src/Asp.Net/SqliteTest/UnitTest/Insert.cs b/Src/Asp.Net/SqliteTest/UnitTest/Insert.cs index 920e217b3..910f96bd1 100644 --- a/Src/Asp.Net/SqliteTest/UnitTest/Insert.cs +++ b/Src/Asp.Net/SqliteTest/UnitTest/Insert.cs @@ -27,7 +27,7 @@ namespace OrmTest.UnitTest base.Check(@"INSERT INTO `STudent` (`SchoolId`,`Name`,`CreateTime`) VALUES - (@SchoolId,@Name,@CreateTime) ;SELECT LAST_INSERT_ID();", + (@SchoolId,@Name,@CreateTime) ;SELECT LAST_INSERT_ROWID();", new List() { new SugarParameter("@SchoolId",0), new SugarParameter("@CreateTime",Convert.ToDateTime("2010-1-1")), @@ -45,7 +45,7 @@ namespace OrmTest.UnitTest base.Check(@"INSERT INTO `STudent` (`Name`) VALUES - (@Name) ;SELECT LAST_INSERT_ID();", new List() { + (@Name) ;SELECT LAST_INSERT_ROWID();", new List() { new SugarParameter("@Name","jack") }, t3.Key, t3.Value, "Insert t3 error"); @@ -55,7 +55,7 @@ namespace OrmTest.UnitTest base.Check(@"INSERT INTO `STudent` (`SchoolId`,`CreateTime`) VALUES - (@SchoolId,@CreateTime) ;SELECT LAST_INSERT_ID();", + (@SchoolId,@CreateTime) ;SELECT LAST_INSERT_ROWID();", new List() { new SugarParameter("@SchoolId",0), new SugarParameter("@CreateTime",Convert.ToDateTime("2010-1-1")), @@ -67,7 +67,7 @@ namespace OrmTest.UnitTest base.Check(@"INSERT INTO `STudent` (`SchoolId`,`CreateTime`) VALUES - (@SchoolId,@CreateTime) ;SELECT LAST_INSERT_ID();", + (@SchoolId,@CreateTime) ;SELECT LAST_INSERT_ROWID();", new List() { new SugarParameter("@SchoolId",0), new SugarParameter("@CreateTime",Convert.ToDateTime("2010-1-1")), @@ -78,7 +78,7 @@ new List() { base.Check(@"INSERT INTO `STudent` (`SchoolId`,`Name`,`CreateTime`) VALUES - (@SchoolId,@Name,@CreateTime) ;SELECT LAST_INSERT_ID();", + (@SchoolId,@Name,@CreateTime) ;SELECT LAST_INSERT_ROWID();", new List() { new SugarParameter("@SchoolId",0), new SugarParameter("@CreateTime",Convert.ToDateTime("2010-1-1")), @@ -91,7 +91,7 @@ new List() { base.Check(@"INSERT INTO `STudent` (`ID`,`SchoolId`,`CreateTime`) VALUES - (@ID,@SchoolId,@CreateTime) ;SELECT LAST_INSERT_ID();", + (@ID,@SchoolId,@CreateTime) ;SELECT LAST_INSERT_ROWID();", new List() { new SugarParameter("@SchoolId", 0), new SugarParameter("@ID", 0), diff --git a/Src/Asp.Net/SqliteTest/UnitTest/Update.cs b/Src/Asp.Net/SqliteTest/UnitTest/Update.cs index 1397ba499..c31c009cd 100644 --- a/Src/Asp.Net/SqliteTest/UnitTest/Update.cs +++ b/Src/Asp.Net/SqliteTest/UnitTest/Update.cs @@ -26,7 +26,7 @@ namespace OrmTest.UnitTest var t1 = db.Updateable(updateObj).ToSql(); base.Check(@"UPDATE `STudent` SET - `SchoolId`=@SchoolId,`Name`=@Name,`CreateTime`=@CreateTime WHERE `ID`=@ID", new List() { + `SchoolId`=@SchoolId,`Name`=@Name,`CreateTime`=@CreateTime WHERE `Id`=@Id", new List() { new SugarParameter("@SchoolId",0), new SugarParameter("@ID",1), new SugarParameter("@CreateTime", Convert.ToDateTime("2017-05-21 09:56:12.610")), @@ -40,7 +40,7 @@ namespace OrmTest.UnitTest //Only update Name var t3 = db.Updateable(updateObj).UpdateColumns(it => new { it.Name }).ToSql(); base.Check(@"UPDATE `STudent` SET - `Name`=@Name WHERE `ID`=@ID", new List() { + `Name`=@Name WHERE `Id`=@Id", new List() { new SugarParameter("@ID",1), new SugarParameter("@Name", "jack") }, t3.Key, t3.Value, "Update t3 error"); @@ -48,7 +48,7 @@ namespace OrmTest.UnitTest //Ignore Name and TestId var t4 = db.Updateable(updateObj).IgnoreColumns(it => new { it.Name, it.TestId }).ToSql(); base.Check(@"UPDATE `STudent` SET - `SchoolId`=@SchoolId,`CreateTime`=@CreateTime WHERE `ID`=@ID", new List() { + `SchoolId`=@SchoolId,`CreateTime`=@CreateTime WHERE `Id`=@Id", new List() { new SugarParameter("@CreateTime",Convert.ToDateTime("2017-05-21 09:56:12.610")), new SugarParameter("@SchoolId", 0), new SugarParameter("@ID",1), @@ -57,7 +57,7 @@ namespace OrmTest.UnitTest //Ignore Name and TestId var t5 = db.Updateable(updateObj).IgnoreColumns(it => it == "Name" || it == "TestId").With(SqlWith.UpdLock).ToSql(); base.Check(@"UPDATE `STudent` SET - `SchoolId`=@SchoolId,`CreateTime`=@CreateTime WHERE `ID`=@ID", new List() { + `SchoolId`=@SchoolId,`CreateTime`=@CreateTime WHERE `Id`=@Id", new List() { new SugarParameter("@CreateTime",Convert.ToDateTime("2017-05-21 09:56:12.610")), new SugarParameter("@SchoolId", 0), new SugarParameter("@ID",1), @@ -67,7 +67,7 @@ namespace OrmTest.UnitTest //Use Lock var t6 = db.Updateable(updateObj).With(SqlWith.UpdLock).ToSql(); base.Check(@"UPDATE `STudent` SET - `SchoolId`=@SchoolId,`Name`=@Name,`CreateTime`=@CreateTime WHERE `ID`=@ID", new List() { + `SchoolId`=@SchoolId,`Name`=@Name,`CreateTime`=@CreateTime WHERE `Id`=@Id", new List() { new SugarParameter("@SchoolId",0), new SugarParameter("@ID",1), new SugarParameter("@CreateTime", Convert.ToDateTime("2017-05-21 09:56:12.610")), @@ -91,7 +91,7 @@ namespace OrmTest.UnitTest var t8 = db.Updateable(updateObj) .ReSetValue(it=>it.Name==(it.Name+1)).ToSql(); base.Check(@"UPDATE `STudent` SET - `SchoolId`=@SchoolId, `Name` =( `Name` + @Const0 ),`CreateTime`=@CreateTime WHERE `ID`=@ID", + `SchoolId`=@SchoolId, `Name` =( `Name` + @Const0 ),`CreateTime`=@CreateTime WHERE `Id`=@Id", new List() { new SugarParameter("@SchoolId",0), new SugarParameter("@ID",1),