Class: QuickBase::Objects::Query
- Inherits:
-
Object
- Object
- QuickBase::Objects::Query
- Defined in:
- lib/QuickBaseObjects.rb
Overview
Definition of a Query built from the XML schema for a Table.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
Instance Method Summary collapse
- #build(query_xml, qbc) ⇒ Object
-
#run ⇒ Object
Run the Query and get the Records returned.
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
116 117 118 |
# File 'lib/QuickBaseObjects.rb', line 116 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
116 117 118 |
# File 'lib/QuickBaseObjects.rb', line 116 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
116 117 118 |
# File 'lib/QuickBaseObjects.rb', line 116 def properties @properties end |
Instance Method Details
#build(query_xml, qbc) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/QuickBaseObjects.rb', line 117 def build(query_xml,qbc) @qbc = qbc @dbid = qbc.dbid.dup @id = query_xml.attributes["id"] @properties = Properties.new queryProc = proc { |element| if element.is_a?(REXML::Element) @properties[element.name] = element.has_text? ? element.text : nil end } @qbc.processChildElements(query_xml,true,queryProc) @properties.each{|key,value| self.class.send(:define_method,key){@properties[key]} } @name = @properties["qyname"] end |
#run ⇒ Object
Run the Query and get the Records returned.
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/QuickBaseObjects.rb', line 134 def run ridFieldName = @qbc.lookupFieldNameFromID( "3") records = Records.new @qbc.iterateRecords(@dbid,@qbc.getFieldNames(@dbid),nil,@id,nil,qyclst()){|qb_record| record = Record.new record.build(@qbc,ridFieldName, qb_record) records << record } records end |