Class: SQLStatement::SQL_Field

Inherits:
Object
  • Object
show all
Defined in:
lib/sql/statement.rb

Overview

SQL_Field is used for representing field names qualified by table names. Their text expansion looks like `tablename`.`fieldname`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table, field) ⇒ SQL_Field

Returns a new instance of SQL_Field.



119
120
121
# File 'lib/sql/statement.rb', line 119

def initialize(table,field)
   @table,@field=table,field
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



123
124
125
# File 'lib/sql/statement.rb', line 123

def field
  @field
end

#tableObject (readonly)

Returns the value of attribute table.



123
124
125
# File 'lib/sql/statement.rb', line 123

def table
  @table
end

Instance Method Details

#placeheldObject



137
# File 'lib/sql/statement.rb', line 137

def placeheld; []; end

#to_sObject

This is used when performing #… substitions although technically, it should be made to work like the Symbol.to_s (which gives unquoted results), this works just fine giving quoted results.



133
134
135
# File 'lib/sql/statement.rb', line 133

def to_s
   to_sqlpart
end

#to_sqlpartObject



125
126
127
# File 'lib/sql/statement.rb', line 125

def to_sqlpart
   @table.to_sqlpart+"."+@field.to_sqlpart
end