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