Class: ActiveRecord::ConnectionAdapters::DbslayerResult
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::DbslayerResult
- Defined in:
- lib/active_record/connection_adapters/dbslayer_connection.rb
Instance Method Summary collapse
- #affected_rows ⇒ Object
- #each ⇒ Object
- #each_hash ⇒ Object
- #hash_rows ⇒ Object
- #header ⇒ Object
-
#initialize(results_hash) ⇒ DbslayerResult
constructor
A new instance of DbslayerResult.
- #insert_id ⇒ Object
-
#num_rows ⇒ Object
Compatibility to the MySQL ones.
- #rows ⇒ Object
- #success? ⇒ Boolean
- #types ⇒ Object
Constructor Details
#initialize(results_hash) ⇒ DbslayerResult
Returns a new instance of DbslayerResult.
13 14 15 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 13 def initialize(results_hash) @hash = results_hash end |
Instance Method Details
#affected_rows ⇒ Object
33 34 35 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 33 def affected_rows @hash['AFFECTED_ROWS'] end |
#each ⇒ Object
47 48 49 50 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 47 def each return if rows.nil? rows.each {|r| yield r } end |
#each_hash ⇒ Object
64 65 66 67 68 69 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 64 def each_hash return if rows.nil? hash_rows.each do |row| yield row end end |
#hash_rows ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 52 def hash_rows return [] if rows.nil? rows.map do |row| hash = {} header.each_with_index do |head, i| hash[head] = row[i] end hash end end |
#header ⇒ Object
25 26 27 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 25 def header @hash['HEADER'] end |
#insert_id ⇒ Object
37 38 39 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 37 def insert_id @hash['INSERT_ID'] end |
#num_rows ⇒ Object
Compatibility to the MySQL ones
42 43 44 45 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 42 def num_rows return 0 if rows.nil? rows.size end |
#rows ⇒ Object
17 18 19 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 17 def rows @hash['ROWS'] end |
#success? ⇒ Boolean
29 30 31 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 29 def success? @hash['SUCCESS'] end |
#types ⇒ Object
21 22 23 |
# File 'lib/active_record/connection_adapters/dbslayer_connection.rb', line 21 def types @hash['TYPES'] end |