lib/sequel/adapters/tinytds.rb in sequel-3.48.0 vs lib/sequel/adapters/tinytds.rb in sequel-4.0.0

- old
+ new

@@ -26,11 +26,11 @@ # 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. - def execute(sql, opts={}) + def execute(sql, opts=OPTS) synchronize(opts[:server]) do |c| begin m = opts[:return] r = nil if (args = opts[:arguments]) && !args.empty? @@ -68,22 +68,22 @@ end end end # Return the number of rows modified by the given +sql+. - def execute_dui(sql, opts={}) + def execute_dui(sql, opts=OPTS) execute(sql, opts.merge(:return=>:do)) end # Return the value of the autogenerated primary key (if any) # for the row inserted by the given +sql+. - def execute_insert(sql, opts={}) + def execute_insert(sql, opts=OPTS) execute(sql, opts.merge(:return=>:insert)) end # Execute the DDL +sql+ on the database and return nil. - def execute_ddl(sql, opts={}) + def execute_ddl(sql, opts=OPTS) execute(sql, opts.merge(:return=>:each)) nil end private @@ -209,21 +209,21 @@ private # Run execute_select on the database with the given SQL and the stored # bind arguments. - def execute(sql, opts={}, &block) + def execute(sql, opts=OPTS, &block) super(prepared_sql, {:arguments=>bind_arguments}.merge(opts), &block) end # Same as execute, explicit due to intricacies of alias and super. - def execute_dui(sql, opts={}, &block) + def execute_dui(sql, opts=OPTS, &block) super(prepared_sql, {:arguments=>bind_arguments}.merge(opts), &block) end # Same as execute, explicit due to intricacies of alias and super. - def execute_insert(sql, opts={}, &block) + def execute_insert(sql, opts=OPTS, &block) super(prepared_sql, {:arguments=>bind_arguments}.merge(opts), &block) end end # Yield hashes with symbol keys, attempting to optimize for @@ -255,10 +255,10 @@ private # Properly escape the given string +v+. def literal_string_append(sql, v) sql << (mssql_unicode_strings ? UNICODE_STRING_START : APOS) - sql << db.synchronize{|c| c.escape(v)}.gsub(BACKSLASH_CRLF_RE, BACKSLASH_CRLF_REPLACE) << APOS + sql << db.synchronize(@opts[:server]){|c| c.escape(v)}.gsub(BACKSLASH_CRLF_RE, BACKSLASH_CRLF_REPLACE) << APOS end end end end