示例#1
0
        internal static void CreateTable(
            string generalTableName,
            string sourceTableName,
            Sqls.TableTypes tableType,
            IEnumerable <ColumnDefinition> columnDefinitionCollection,
            IEnumerable <IndexInfo> tableIndexCollection,
            EnumerableRowCollection <DataRow> rdsColumnCollection,
            string tableNameTemp = "")
        {
            Consoles.Write(sourceTableName, Consoles.Types.Info);
            if (tableNameTemp.IsNullOrEmpty())
            {
                tableNameTemp = sourceTableName;
            }
            var sqlStatement = new SqlStatement(
                Def.Sql.CreateTable,
                Sqls.SqlParamCollection());

            sqlStatement.CreateColumn(sourceTableName, columnDefinitionCollection);
            sqlStatement.CreatePk(sourceTableName, columnDefinitionCollection, tableIndexCollection);
            sqlStatement.CreateIx(generalTableName, sourceTableName, tableType, columnDefinitionCollection);
            sqlStatement.CreateDefault(tableNameTemp, columnDefinitionCollection);
            sqlStatement.DropConstraint(sourceTableName, tableIndexCollection);
            sqlStatement.CommandText = sqlStatement.CommandText.Replace("#TableName#", tableNameTemp);
            Def.SqlIoByAdmin(transactional: true).ExecuteNonQuery(sqlStatement);
        }
示例#2
0
 internal static void CreateIx(
     this SqlStatement sqlStatement,
     string generalTableName,
     string sourceTableName,
     bool old,
     IEnumerable <ColumnDefinition> columnDefinitionCollection)
 {
     IndexInfoCollection(generalTableName, sourceTableName, old)
     .Where(o => o.Type == IndexInfo.Types.Ix)
     .ForEach(tableIndex =>
              sqlStatement.CreateIx(sourceTableName, columnDefinitionCollection, tableIndex));
 }
示例#3
0
 internal static void CreateIx(
     this SqlStatement sqlStatement,
     ISqlObjectFactory factory,
     string generalTableName,
     string sourceTableName,
     Sqls.TableTypes tableType,
     IEnumerable <ColumnDefinition> columnDefinitionCollection)
 {
     IndexInfoCollection(factory: factory,
                         generalTableName: generalTableName,
                         sourceTableName: sourceTableName,
                         tableType: tableType)
     .Where(o => o.Type == IndexInfo.Types.Ix)
     .ForEach(tableIndex =>
              sqlStatement.CreateIx(sourceTableName, columnDefinitionCollection, tableIndex));
 }