Ejemplo n.º 1
0
 public TableDescription(string table, ColumnDescription primaryKey, params ColumnDescription[] columns)
 {
     this.table = table;
     this.primaryKey = primaryKey;
     this.columns = columns;
 }
Ejemplo n.º 2
0
 public TableDescription(string table, ColumnDescription primaryKey, IEnumerable<ColumnDescription> columns)
     : this(table, primaryKey, columns.ToArray())
 {
 }
Ejemplo n.º 3
0
 public string CreateColumn(ColumnDescription description)
 {
     return _AlterTableStatement(description.column.tableName, _AddColumnDefinition(description));
 }
Ejemplo n.º 4
0
 public string ModifyColumnPostgresStyle(ColumnDescription description)
 {
     return _AlterTableStatement(description.column.tableName, _ModifyColumnDefinitionPostgresStyle(description));
 }
Ejemplo n.º 5
0
 private string _ModifyColumnDefinitionPostgresStyle(ColumnDescription description)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// It seems that this feature is not mentioned in any SQL standart and is only implemented in Oracle and MySQL.
 /// However, it is similar to other SQL language structures, so it should be implemented in SQLQueryManager, not OracleDBTraits
 /// </summary>
 private string _ModifyColumnDefinitionOracleStyle(ColumnDescription description)
 {
     return string.Format(
         "modify ({0})",
         _ColumnDefinition(description, ColumnSpecific.None, Specific.OracleNullExtension)
     );
 }
Ejemplo n.º 7
0
 /// <summary>
 /// SQL-92, page 262<br/>
 /// Note that setting oracleNullExtension to true will make the query non-compliant
 /// </summary>
 private string _ColumnDefinition(ColumnDescription description, ColumnSpecific columnSpecific, Specific specific)
 {
     return string.Format(
         "{0} {1} {2} {3} {4}",
         nameEscaper(description.column.columnName), //column name
         description.options.type, //data type | domain name
         (description.options.defaultValue != null) ? "DEFAULT " + description.options.defaultValue : "", //NOTE possible SQL injection here! //default clause
         String.Join(
             " ",
             Enumerable.Empty<string>()
             .ConcatScalar(description.options.isNotNull ? "NOT NULL" : ((specific & Specific.OracleNullExtension) == Specific.OracleNullExtension ? "NULL" : null))
             .ConcatScalar((columnSpecific & ColumnSpecific.PrimaryKey) == ColumnSpecific.PrimaryKey ? "PRIMARY KEY" : null)
             .ToArray()
         ), //column constraint definition
         "" //collate clause
     );
 }
Ejemplo n.º 8
0
 /// <summary>
 /// SQL-92, page 284
 /// </summary>
 private string _AddColumnDefinition(ColumnDescription description)
 {
     return string.Format(
         "add {0}",
         _ColumnDefinition(description, ColumnSpecific.None, Specific.None)
     );
 }
Ejemplo n.º 9
0
 public void CreateColumn(ColumnDescription description)
 {
     this.traits.CreateColumn(this.CreateTextCommand, description);
 }