Browse Source

Update Sqlite

pull/12/MERGE
sunkaixuan 7 years ago
parent
commit
d9866b8064
  1. 3
      Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs
  2. 24
      Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs

3
Src/Asp.Net/SqlSugar/Abstract/DbMaintenanceProvider/Methods.cs

@ -109,7 +109,10 @@ namespace SqlSugar
string sql = this.CheckSystemTablePermissionsSql; string sql = this.CheckSystemTablePermissionsSql;
try try
{ {
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
this.Context.Ado.IsEnableLogEvent = false;
this.Context.Ado.ExecuteCommand(sql); this.Context.Ado.ExecuteCommand(sql);
this.Context.Ado.IsEnableLogEvent = oldIsEnableLog;
return true; return true;
} }
catch catch

24
Src/Asp.Net/SqlSugar/Realization/Sqlite/DbMaintenance/SqliteDbMaintenance.cs

@ -39,14 +39,14 @@ namespace SqlSugar
{ {
get get
{ {
return "ALTER TABLE {0} ADD PRIMARY KEY({2}) /*{1}*/"; throw new NotSupportedException();
} }
} }
protected override string AddColumnToTableSql protected override string AddColumnToTableSql
{ {
get get
{ {
return "ALTER TABLE {0} ADD {1} {2}{3} {4} {5} {6}"; throw new NotSupportedException();
} }
} }
protected override string AlterColumnToTableSql protected override string AlterColumnToTableSql
@ -54,21 +54,21 @@ namespace SqlSugar
get get
{ {
// return "ALTER TABLE {0} ALTER COLUMN {1} {2}{3} {4} {5} {6}"; // return "ALTER TABLE {0} ALTER COLUMN {1} {2}{3} {4} {5} {6}";
return "alter table {0} change column {1} {1} {2}{3} {4} {5} {6}"; throw new NotSupportedException();
} }
} }
protected override string BackupDataBaseSql protected override string BackupDataBaseSql
{ {
get get
{ {
return "mysqldump.exe {0} -uroot -p > {1} "; throw new NotSupportedException();
} }
} }
protected override string CreateTableSql protected override string CreateTableSql
{ {
get get
{ {
return "CREATE TABLE {0}(\r\n{1} $PrimaryKey)"; return "CREATE TABLE {0}(\r\n{1} )";
} }
} }
protected override string CreateTableColumn protected override string CreateTableColumn
@ -89,7 +89,7 @@ namespace SqlSugar
{ {
get get
{ {
return "SELECT * INTO {1} FROM {2} limit 0,{0}"; throw new NotSupportedException();
} }
} }
protected override string DropTableSql protected override string DropTableSql
@ -103,7 +103,7 @@ namespace SqlSugar
{ {
get get
{ {
return "ALTER TABLE {0} DROP COLUMN {1}"; throw new NotSupportedException();
} }
} }
protected override string DropConstraintSql protected override string DropConstraintSql
@ -117,7 +117,7 @@ namespace SqlSugar
{ {
get get
{ {
return "exec sp_rename '{0}.{1}','{2}','column';"; throw new NotSupportedException();
} }
} }
#endregion #endregion
@ -137,7 +137,7 @@ namespace SqlSugar
{ {
get get
{ {
return "DEFAULT NULL"; return "NULL";
} }
} }
protected override string CreateTableNotNull protected override string CreateTableNotNull
@ -158,7 +158,7 @@ namespace SqlSugar
{ {
get get
{ {
return "AUTO_INCREMENT"; return "AUTOINCREMENT";
} }
} }
#endregion #endregion
@ -175,10 +175,14 @@ namespace SqlSugar
}, (cm, key) => }, (cm, key) =>
{ {
string sql = "select * from " + tableName + " limit 0,1"; string sql = "select * from " + tableName + " limit 0,1";
var oldIsEnableLog = this.Context.Ado.IsEnableLogEvent;
this.Context.Ado.IsEnableLogEvent = false;
using (DbDataReader reader = (SQLiteDataReader)this.Context.Ado.GetDataReader(sql)) using (DbDataReader reader = (SQLiteDataReader)this.Context.Ado.GetDataReader(sql))
{ {
this.Context.Ado.IsEnableLogEvent = oldIsEnableLog;
return AdoCore.GetColumnInfosByTableName(tableName, reader); return AdoCore.GetColumnInfosByTableName(tableName, reader);
} }
}); });
} }

Loading…
Cancel
Save