class DataMetaDom::OraLexer::SqlOutput

Encapsulates 4 parts of DDL related SQL output:

Attributes

couple[R]

Open output file into the couple SQL DDL statements, creating foreign keys

crSeqs[R]

Sequences and triggers - create

create[R]

Open output file into create SQL DDL statements (CREATE TABLE)

drSeqs[R]

Sequences and triggers - drop

drop[R]

Open output file into drop SQL DDL statements (DROP TABLE)

ixes[R]

Indexes

uncouple[R]

Open output file into the uncouple SQL DDL statements, dropping foreign keys

Public Class Methods

new(sqlTargetDir) click to toggle source

Creates an instance into the given target directory in which all 4 parts of the SQL DDL process will be created.

# File lib/dataMetaDom/ora.rb, line 91
        def initialize(sqlTargetDir)
            @selTargetDir = sqlTargetDir
            @create = File.new("#{sqlTargetDir}/DDL-createTables.sql", 'wb')
            @crSeqs = File.new("#{sqlTargetDir}/DDL-createSeqs.sql", 'wb')
            @drSeqs = File.new("#{sqlTargetDir}/DDL-dropSeqs.sql", 'wb')
            @ixes = File.new("#{sqlTargetDir}/DDL-indexes.sql", 'wb')
            @drop = File.new("#{sqlTargetDir}/DDL-drop.sql", 'wb')
            @couple = File.new("#{sqlTargetDir}/DDL-couple.sql", 'wb')
            @uncouple = File.new("#{sqlTargetDir}/DDL-uncouple.sql", 'wb')
            @allScriptFiles = [@create, @drop, @couple, @uncouple, @drSeqs, @crSeqs, @ixes]
            @dropScripts = [@uncouple, @drop]
            @allScriptFiles.each { |f|
                f.puts %q</* Generated by DataMeta DOM Oracle utility
DO NOT EDIT MANUALLY, update the DataMeta DOM source and regen.
*/
>
            }
            @dropScripts.each { |ds|
                ds.puts %q<
/* Oracle does not have this feature: Disable all checks for safe dropping without any errors */

>
            }
        end

Public Instance Methods

close() click to toggle source

Safely closes all the output files.

# File lib/dataMetaDom/ora.rb, line 119
        def close
            @dropScripts.each { |ds|
                ds.puts %q<

/* Placeholder for a drop footer */
>
            }
            @allScriptFiles.each { |f|
                begin
                    f.close
                rescue Exception => x;
                    $stderr.puts x.message
                end
            }
        end