Class: LanguageParser::SQLTable

Inherits:
Object
  • Object
show all
Defined in:
lib/cgialib/lp/SQLLanguageScanner.rb

Overview

class : SQLTable

Represents an SQL table definition

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSQLTable

initialize()

Constructor



65
66
67
68
69
70
71
72
# File 'lib/cgialib/lp/SQLLanguageScanner.rb', line 65

def initialize()
  
  @name = ""
  @fields = []
  @field_hash = {}
  @comment = ""
  
end

Instance Attribute Details

#commentObject

The comment associated with the table



76
77
78
# File 'lib/cgialib/lp/SQLLanguageScanner.rb', line 76

def comment
  @comment
end

#fieldsObject (readonly)

The fields of the table



75
76
77
# File 'lib/cgialib/lp/SQLLanguageScanner.rb', line 75

def fields
  @fields
end

#nameObject

The name of the table



74
75
76
# File 'lib/cgialib/lp/SQLLanguageScanner.rb', line 74

def name
  @name
end

Instance Method Details

#add_field(field) ⇒ Object

add_field( field )

field - The field object

Adds a field to the table



84
85
86
87
88
89
# File 'lib/cgialib/lp/SQLLanguageScanner.rb', line 84

def add_field( field )
  
  @fields.push( field )
  @field_hash[ field.name.to_s.downcase ] = field
  
end

#get_field(name) ⇒ Object

get_field( name )

name - The name of the field

Fetchs a field object based on it’s name



97
98
99
# File 'lib/cgialib/lp/SQLLanguageScanner.rb', line 97

def get_field( name )
  @field_hash[ name.downcase ]
end