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.



139
140
141
# File 'lib/sql/statement.rb', line 139

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

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



143
144
145
# File 'lib/sql/statement.rb', line 143

def field
  @field
end

#tableObject (readonly)

Returns the value of attribute table.



143
144
145
# File 'lib/sql/statement.rb', line 143

def table
  @table
end

Instance Method Details

#placeheldObject



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

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.



153
154
155
# File 'lib/sql/statement.rb', line 153

def to_s
   to_sqlpart
end

#to_sqlpartObject



145
146
147
# File 'lib/sql/statement.rb', line 145

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