private void BuildAsqlCreateFooter(AsqlBuilder ab) { ab.WriteLine(")"); ab.DecIndent(); ab.SlashLine("tabspace = :oldtabloc"); ab.DecIndent(); ab.SlashLine("end if"); }
private void BuildAsqlCreateHeader(AsqlBuilder ab, string tableName) { ab.SlashLine("on error exit"); ab.SlashLine("define oldtabloc ident(50)"); ab.IndentWrite("if not exists "); ab.SlashLine(tableName); ab.IncIndent(); ab.SlashLine("begin sqlserver"); ab.IncIndent(); ab.IndentWriteLine("select distinct s.groupname into :oldtabloc"); ab.IncIndent(); ab.IndentWriteLine("from sysobjects t, sysindexes i, sysfilegroups s, syscolumns c"); ab.IndentWriteLine("where t.type = 'U'"); ab.IndentWriteLine("and t.id = c.id"); ab.IndentWriteLine("and t.id = i.id"); ab.IndentWriteLine("and (i.indid=0 OR i.indid=1)"); ab.IndentWriteLine("and i.groupid = s.groupid"); ab.IndentWrite("and t.name = '"); ab.Write(tableName); ab.WriteLine("'"); ab.DecIndent(); ab.SlashLine(); ab.DecIndent(); ab.SlashLine("end /* sqlserver */"); ab.SlashLine("begin oracle"); ab.IncIndent(); ab.IndentWriteLine("select tablespace_name into :oldtabloc"); ab.IncIndent(); ab.IndentWriteLine("from user_tables"); ab.IndentWrite("where LOWER(table_name) = '"); ab.Write(tableName); ab.WriteLine("'"); ab.DecIndent(); ab.SlashLine(); ab.DecIndent(); ab.SlashLine("end /* oracle */"); ab.IndentWrite("create table "); ab.Write(tableName); ab.WriteLine(" ("); ab.IncIndent(); }