Exemplo n.º 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;
     }
 }
Exemplo n.º 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}");
 }
Exemplo n.º 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;
 }
Exemplo n.º 4
0
 public void DropTableIfExists(DbConnection db, TableName table)
 {
     db.Execute($"drop table if exists {_utils.EscapeTableName(table)}");
 }
Exemplo n.º 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;
 }
Exemplo n.º 6
0
 public string EscapeTableName(TableName table)
 {
     table.Name.MustNotBeEmpty();
     return table.Name;
 }