Class Sequel::TinyTDS::Database
In: lib/sequel/adapters/tinytds.rb
Parent: Sequel::Database

Methods

Included Modules

Sequel::MSSQL::DatabaseMethods

Public Instance methods

Transfer the :host and :user options to the :dataserver and :username options.

[Source]

    # File lib/sequel/adapters/tinytds.rb, line 12
12:       def connect(server)
13:         opts = server_opts(server)
14:         opts[:dataserver] = opts[:host]
15:         opts[:username] = opts[:user]
16:         set_mssql_unicode_strings
17:         TinyTds::Client.new(opts)
18:       end

Return instance of Sequel::TinyTDS::Dataset with the given options.

[Source]

    # File lib/sequel/adapters/tinytds.rb, line 21
21:       def dataset(opts = nil)
22:         TinyTDS::Dataset.new(self, opts)
23:       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.

[Source]

    # File lib/sequel/adapters/tinytds.rb, line 31
31:       def execute(sql, opts={})
32:         synchronize(opts[:server]) do |c|
33:           begin
34:             m = opts[:return]
35:             r = nil
36:             log_yield(sql) do
37:               r = c.execute(sql)
38:               return r.send(m) if m
39:             end
40:             yield(r) if block_given?
41:           rescue TinyTds::Error => e
42:             raise_error(e, :disconnect=>(c.closed? || (c.respond_to?(:dead?) && c.dead?)))
43:           ensure
44:            r.cancel if r && c.sqlsent?
45:           end
46:         end
47:       end

Execute the DDL sql on the database and return nil.

[Source]

    # File lib/sequel/adapters/tinytds.rb, line 61
61:       def execute_ddl(sql, opts={})
62:         execute(sql, opts.merge(:return=>:each))
63:         nil
64:       end

Return the number of rows modified by the given sql.

[Source]

    # File lib/sequel/adapters/tinytds.rb, line 50
50:       def execute_dui(sql, opts={})
51:         execute(sql, opts.merge(:return=>:do))
52:       end

Return the value of the autogenerated primary key (if any) for the row inserted by the given sql.

[Source]

    # File lib/sequel/adapters/tinytds.rb, line 56
56:       def execute_insert(sql, opts={})
57:         execute(sql, opts.merge(:return=>:insert))
58:       end

[Validate]