Transfer the :user option to the :username option.
# File lib/sequel/adapters/tinytds.rb, line 11 def connect(server) opts = server_opts(server) opts[:username] = opts[:user] c = TinyTds::Client.new(opts) c.query_options.merge!(:cache_rows=>false) if (ts = opts[:textsize]) sql = "SET TEXTSIZE #{typecast_value_integer(ts)}" log_yield(sql){c.execute(sql)} end c end
Execute the given sql on the server. If the :return option is present, its value should be a method symbol that is called on the TinyTds::Result object returned from executing the sql. The value of such a method is returned to the caller. Otherwise, if a block is given, it is yielded the result object. If no block is given and a :return is not present, nil is returned.
# File lib/sequel/adapters/tinytds.rb, line 31 def execute(sql, opts={}) synchronize(opts[:server]) do |c| begin m = opts[:return] r = nil if (args = opts[:arguments]) && !args.empty? types = [] values = [] args.each_with_index do |(k, v), i| v, type = ps_arg_type(v) types << "@#{k} #{type}" values << "@#{k} = #{v}" end case m when :do sql = "#{sql}; SELECT @@ROWCOUNT AS AffectedRows" single_value = true when :insert sql = "#{sql}; SELECT CAST(SCOPE_IDENTITY() AS bigint) AS Ident" single_value = true end sql = "EXEC sp_executesql N'#{c.escape(sql)}', N'#{c.escape(types.join(', '))}', #{values.join(', ')}" log_yield(sql) do r = c.execute(sql) r.each{|row| return row.values.first} if single_value end else log_yield(sql) do r = c.execute(sql) return r.send(m) if m end end yield(r) if block_given? rescue TinyTds::Error => e raise_error(e, :disconnect=>!c.active?) ensure r.cancel if r && c.sqlsent? end end end
Execute the DDL sql on the database and return nil.
# File lib/sequel/adapters/tinytds.rb, line 84 def execute_ddl(sql, opts={}) execute(sql, opts.merge(:return=>:each)) nil end
Generated with the Darkfish Rdoc Generator 2.