protected abstract string ParseColumnAlter(TableColumnSchema mColumn, TableColumnSchema eColumn);
protected virtual string MakeDdlColumnDrop(TableColumnSchema column, TableSchema table) { return string.Format(@"ALTER TABLE {0} DROP COLUMN {1}", MakeDdlElementName(table.Name), MakeDdlElementName(column.Name)); }
protected abstract string ParseColumn(TableColumnSchema column);
private string MakeDdlColumnCreate(TableColumnSchema column, TableSchema table) { return string.Format(@"ALTER TABLE {0} ADD {1}", MakeDdlElementName(table.Name), ParseColumn(column)); }
protected virtual string MakeDdlColumnAlter(TableColumnSchema mColumn, TableColumnSchema eColumn, TableSchema table) { return string.Format(@"ALTER TABLE {0} ALTER COLUMN {1}", MakeDdlElementName(table.Name), ParseColumnAlter(mColumn, eColumn)); }
public virtual IDbDataParameter ConvertToDbParameter(TableColumnSchema column, IDbDataParameter parameter) { parameter.ParameterName = MakeParameterName(column); switch (column.Type) { case ColumnType.Integer: parameter.DbType = DbType.Int32; break; case ColumnType.NCharacterVaring: case ColumnType.BlobSubtypeNText: parameter.DbType = DbType.String; break; case ColumnType.Timestamp: parameter.DbType = DbType.DateTime; break; case ColumnType.Boolean: parameter.DbType = DbType.Boolean; break; case ColumnType.TinyInt: // Unsigned for some reason // parameter.DbType = DbType.Byte; break; case ColumnType.SmallInt: parameter.DbType = DbType.Int16; break; default: throw new NotSupportedException(@"Unsupported column type " + column.Type); } return parameter; }
protected virtual string MakeParameterName(TableColumnSchema column) { return @"@" + column.Name; }
protected virtual string MakeDdlColumnDrop(TableColumnSchema column, TableSchema table) { return(string.Format(@"ALTER TABLE {0} DROP COLUMN {1}", MakeDdlElementName(table.Name), MakeDdlElementName(column.Name))); }
protected virtual string MakeDdlColumnAlter(TableColumnSchema mColumn, TableColumnSchema eColumn, TableSchema table) { return(string.Format(@"ALTER TABLE {0} ALTER COLUMN {1}", MakeDdlElementName(table.Name), ParseColumnAlter(mColumn, eColumn))); }
private string MakeDdlColumnCreate(TableColumnSchema column, TableSchema table) { return(string.Format(@"ALTER TABLE {0} ADD {1}", MakeDdlElementName(table.Name), ParseColumn(column))); }
protected virtual string MakeParameterName(TableColumnSchema column) { return(@"@" + column.Name); }
public static bool IsExactColumn(this TableSchema table, TableColumnSchema inputColumn) { if (inputColumn == null) return false; var column = table.GetColumn(inputColumn.Name); return column != null && column.Equals(inputColumn); }