Beispiel #1
0
 public void Update(TableInfo info)
 {
     if (TableName == null)
     {
         TableName = info.Table;
     }
     else
     {
         info.Table = TableName;
     }
    
     var auto = Columns.Find(d => d.IsIdentity);
     if (auto != null)
     {
         info.IdentityColumn = auto.PropertyName;
     }
 }
Beispiel #2
0
 public void DropTableIfExists(DbConnection db, TableName table)
 {
     var name = _utils.EscapeTableName(table);
     db.Execute($"IF OBJECT_ID('{name}', 'U') IS NOT NULL DROP TABLE {name}");
 }
Beispiel #3
0
 public bool TableExists(DbConnection cnx, TableName table)
 {
     var name = _utils.EscapeTableName(table);
     return cnx.GetValue<int?>(c => c.Sql($"select OBJECT_ID (N'{name}', N'U')")).HasValue;
 }
Beispiel #4
0
 public void DropTableIfExists(DbConnection db, TableName table)
 {
     db.Execute($"drop table if exists {_utils.EscapeTableName(table)}");
 }
Beispiel #5
0
 public bool TableExists(DbConnection cnx, TableName table)
 {
     return cnx.GetValue<bool?>($"SELECT 1 FROM sqlite_master WHERE type='table' AND name=@0", table.Name)??false;
 }
Beispiel #6
0
 public string EscapeTableName(TableName table)
 {
     table.Name.MustNotBeEmpty();
     return table.Name;
 }