Ejemplo n.º 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);
        }