Yield hashes with symbol keys, attempting to optimize for various cases.
# File lib/sequel/adapters/tinytds.rb, line 204 204: def fetch_rows(sql) 205: execute(sql) do |result| 206: each_opts = {:cache_rows=>false} 207: each_opts[:timezone] = :utc if db.timezone == :utc 208: rn = row_number_column if offset = @opts[:offset] 209: columns = cols = result.fields.map{|c| output_identifier(c)} 210: if offset 211: rn = row_number_column 212: columns = columns.dup 213: columns.delete(rn) 214: end 215: @columns = columns 216: #if identifier_output_method 217: each_opts[:as] = :array 218: result.each(each_opts) do |r| 219: h = {} 220: cols.zip(r).each{|k, v| h[k] = v} 221: h.delete(rn) if rn 222: yield h 223: end 224: # Temporarily disable this optimization, as tiny_tds uses string keys # if result.fields is called before result.each(:symbolize_keys=>true). # See https://github.com/rails-sqlserver/tiny_tds/issues/57 else each_opts[:symbolize_keys] = true if offset result.each(each_opts) do |r| r.delete(rn) if rn yield r end else result.each(each_opts, &Proc.new) end end=end 225: end 226: self 227: end
Create a named prepared statement that is stored in the database (and connection) for reuse.
# File lib/sequel/adapters/tinytds.rb, line 246 246: def prepare(type, name=nil, *values) 247: ps = to_prepared_statement(type, values) 248: ps.extend(PreparedStatementMethods) 249: if name 250: ps.prepared_statement_name = name 251: db.set_prepared_statement(name, ps) 252: end 253: ps 254: end
Properly escape the given string v.
# File lib/sequel/adapters/tinytds.rb, line 259 259: def literal_string_append(sql, v) 260: sql << (mssql_unicode_strings ? UNICODE_STRING_START : APOS) 261: sql << db.synchronize{|c| c.escape(v)}.gsub(BACKSLASH_CRLF_RE, BACKSLASH_CRLF_REPLACE) << APOS 262: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.