Class: Sequel::DBI::Dataset
Constant Summary
Sequel::Dataset::AND_SEPARATOR, Sequel::Dataset::BOOL_FALSE, Sequel::Dataset::BOOL_TRUE, Sequel::Dataset::COLUMN_CHANGE_OPTS, Sequel::Dataset::COLUMN_REF_RE1, Sequel::Dataset::COLUMN_REF_RE2, Sequel::Dataset::COLUMN_REF_RE3, Sequel::Dataset::COMMA_SEPARATOR, Sequel::Dataset::COUNT_FROM_SELF_OPTS, Sequel::Dataset::COUNT_OF_ALL_AS_COUNT, Sequel::Dataset::DATASET_CLASSES, Sequel::Dataset::DATE_FORMAT, Sequel::Dataset::MUTATION_METHODS, Sequel::Dataset::NOTIMPL_MSG, Sequel::Dataset::NULL, Sequel::Dataset::N_ARITY_OPERATORS, Sequel::Dataset::QUESTION_MARK, Sequel::Dataset::STOCK_COUNT_OPTS, Sequel::Dataset::STOCK_TRANSFORMS, Sequel::Dataset::TIMESTAMP_FORMAT, Sequel::Dataset::TWO_ARITY_OPERATORS, Sequel::Dataset::WILDCARD
Instance Attribute Summary
#db, #opts, #quote_identifiers, #row_proc
Instance Method Summary
collapse
#<<, #[], #[]=, #aliased_expression_sql, #all, #and, #as, #avg, #case_expression_sql, #clone, #column_all_sql, #columns, #columns!, #complex_expression_sql, #count, #create_or_replace_view, #create_view, dataset_classes, #def_mutation_method, def_mutation_method, #delete_sql, #each, #each_page, #empty?, #except, #exclude, #exists, #filter, #first, #first_source, #from, #from_self, #function_sql, #get, #graph, #grep, #group, #group_and_count, #having, inherited, #initialize, #insert_multiple, #insert_sql, #inspect, #intersect, #interval, #invert, #irregular_function_sql, #join_clause_sql, #join_on_clause_sql, #join_table, #join_using_clause_sql, #last, #limit, #map, #max, #min, #model_classes, #multi_insert, #multi_insert_sql, #naked, #or, #order, #order_more, #ordered_expression_sql, #paginate, #polymorphic_key, #print, #qualified_identifier_sql, #query, #quote_identifier, #quote_identifiers?, #quoted_identifier, #range, #reverse_order, #select, #select_all, #select_more, #select_sql, #set, #set_graph_aliases, #set_model, #single_record, #single_value, #subscript_sql, #sum, #symbol_to_column_ref, #table_exists?, #to_csv, #to_hash, #transform, #transform_load, #transform_save, #unfiltered, #union, #uniq, #unordered, #update_sql
Methods included from Enumerable
#send_each
Instance Method Details
#delete(opts = nil) ⇒ Object
122
123
124
|
# File 'lib/sequel_core/adapters/dbi.rb', line 122
def delete(opts = nil)
@db.do delete_sql(opts)
end
|
#fetch_rows(sql, &block) ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'lib/sequel_core/adapters/dbi.rb', line 92
def fetch_rows(sql, &block)
@db.synchronize do
s = @db.execute sql
begin
@columns = s.column_names.map do |c|
@db.lowercase ? c.downcase.to_sym : c.to_sym
end
s.fetch {|r| yield hash_row(s, r)}
ensure
s.finish rescue nil
end
end
self
end
|
#hash_row(stmt, row) ⇒ Object
107
108
109
110
111
112
|
# File 'lib/sequel_core/adapters/dbi.rb', line 107
def hash_row(stmt, row)
@columns.inject({}) do |m, c|
m[c] = row.shift
m
end
end
|
#insert(*values) ⇒ Object
114
115
116
|
# File 'lib/sequel_core/adapters/dbi.rb', line 114
def insert(*values)
@db.do insert_sql(*values)
end
|
#literal(v) ⇒ Object
81
82
83
84
85
86
87
88
89
90
|
# File 'lib/sequel_core/adapters/dbi.rb', line 81
def literal(v)
case v
when Time
literal(v.iso8601)
when Date, DateTime
literal(v.to_s)
else
super
end
end
|
#update(*args, &block) ⇒ Object
118
119
120
|
# File 'lib/sequel_core/adapters/dbi.rb', line 118
def update(*args, &block)
@db.do update_sql(*args, &block)
end
|