class Sequel::TinyTDS::Dataset
Constants
- PreparedStatementMethods
Public Instance Methods
fetch_rows(sql) { |h| ... }
click to toggle source
# File lib/sequel/adapters/tinytds.rb 201 def fetch_rows(sql) 202 execute(sql) do |result| 203 # Mutating an array in the result is questionable, but supported 204 # by tiny_tds developers (tiny_tds issue #57) 205 columns = result.fields.map!{|c| output_identifier(c)} 206 if columns.empty? 207 args = [] 208 args << {:timezone=>:utc} if db.timezone == :utc 209 cols = nil 210 result.each(*args) do |r| 211 unless cols 212 cols = result.fields.map{|c| [c, output_identifier(c)]} 213 self.columns = columns = cols.map(&:last) 214 end 215 h = {} 216 cols.each do |s, sym| 217 h[sym] = r[s] 218 end 219 yield h 220 end 221 else 222 self.columns = columns 223 if db.timezone == :utc 224 result.each(:timezone=>:utc){|r| yield r} 225 else 226 result.each{|r| yield r} 227 end 228 end 229 end 230 self 231 end
Private Instance Methods
literal_string_append(sql, v)
click to toggle source
Properly escape the given string
# File lib/sequel/adapters/tinytds.rb 236 def literal_string_append(sql, v) 237 sql << (mssql_unicode_strings ? "N'" : "'") 238 sql << db.synchronize(@opts[:server]){|c| c.escape(v)}.gsub(/\\((?:\r\n)|\n)/, '\\\\\\\\\\1\\1') << "'" 239 end
prepared_statement_modules()
click to toggle source
# File lib/sequel/adapters/tinytds.rb 241 def prepared_statement_modules 242 [PreparedStatementMethods] 243 end