Class: Intersys::Database
- Inherits:
-
Object
- Object
- Intersys::Database
- Defined in:
- lib/intersys.rb
Overview
Class representing Cache database connection
Instance Method Summary collapse
-
#affected_rows ⇒ Object
TODO: /csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_variables Somehow, I should extract from Cache %ROWCOUNT and %ROWID.
- #create_query(query) ⇒ Object
- #execute(query, params = []) ⇒ Object
- #insert_id ⇒ Object
-
#query(query, params = []) ⇒ Object
This method creates SQL query, runs it, restores data and closes query.
Instance Method Details
#affected_rows ⇒ Object
TODO: /csp/docbook/DocBook.UI.Page.cls?KEY=RSQL_variables Somehow, I should extract from Cache %ROWCOUNT and %ROWID
132 133 134 |
# File 'lib/intersys.rb', line 132 def affected_rows query("select %ROWCOUNT") end |
#create_query(query) ⇒ Object
106 107 108 109 110 111 112 113 |
# File 'lib/intersys.rb', line 106 def create_query(query) @limit = strip_param(query, "LIMIT") @offset = strip_param(query, "OFFSET") q = Query.new(self, query) q.limit = @limit if @limit q.offset = @offset if @offset q end |
#execute(query, params = []) ⇒ Object
126 127 128 |
# File 'lib/intersys.rb', line 126 def execute(query, params = []) create_query(query).bind_params(params).execute.close end |
#insert_id ⇒ Object
136 137 138 |
# File 'lib/intersys.rb', line 136 def insert_id 0 end |
#query(query, params = []) ⇒ Object
This method creates SQL query, runs it, restores data and closes query
117 118 119 120 121 122 123 124 |
# File 'lib/intersys.rb', line 117 def query(query, params = []) data = [] q = create_query(query).bind_params(params).execute.fill(data).close #1.upto(data.first.size) do |i| # puts q.column_name(i) #end data end |