class Sequel::SqlAnywhere::Database

  1. lib/sequel/adapters/sqlanywhere.rb
Superclass: Sequel::Database

Attributes

api [RW]

Public Instance methods

connect(server)
[show source]
   # File lib/sequel/adapters/sqlanywhere.rb
60 def connect(server)
61   opts = server_opts(server)
62   unless conn_string = opts[:conn_string]
63     conn_string = []
64     conn_string << "Host=#{opts[:host]}#{":#{opts[:port]}" if opts[:port]}" if opts[:host]
65     conn_string << "DBN=#{opts[:database]}" if opts[:database]
66     conn_string << "UID=#{opts[:user]}" if opts[:user]
67     conn_string << "Password=#{opts[:password]}" if opts[:password]
68     conn_string << "CommLinks=#{opts[:commlinks]}" if opts[:commlinks]
69     conn_string << "ConnectionName=#{opts[:connection_name]}" if opts[:connection_name]
70     conn_string << "CharSet=#{opts[:encoding]}" if opts[:encoding]
71     conn_string << "Idle=0" # Prevent the server from disconnecting us if we're idle for >240mins (by default)
72     conn_string << nil
73     conn_string = conn_string.join(';')
74   end
75 
76   conn = @api.sqlany_new_connection
77   raise LoadError, "Could not connect" unless conn && @api.sqlany_connect(conn, conn_string) == 1
78 
79   if Sequel.application_timezone == :utc
80     @api.sqlany_execute_immediate(conn, "SET TEMPORARY OPTION time_zone_adjustment=0")
81   end
82 
83   conn
84 end
disconnect_connection(c)
[show source]
   # File lib/sequel/adapters/sqlanywhere.rb
86 def disconnect_connection(c)
87   @api.sqlany_disconnect(c)
88 end
execute(sql, opts=OPTS, &block)
[show source]
    # File lib/sequel/adapters/sqlanywhere.rb
 96 def execute(sql, opts=OPTS, &block)
 97   synchronize(opts[:server]) do |conn|
 98     _execute(conn, :select, sql, opts, &block)
 99   end
100 end
execute_dui(sql, opts=OPTS)
[show source]
   # File lib/sequel/adapters/sqlanywhere.rb
90 def execute_dui(sql, opts=OPTS)
91   synchronize(opts[:server]) do |conn|
92     _execute(conn, :rows, sql, opts)
93   end
94 end
execute_insert(sql, opts=OPTS)
[show source]
    # File lib/sequel/adapters/sqlanywhere.rb
102 def execute_insert(sql, opts=OPTS)
103   synchronize(opts[:server]) do |conn|
104     _execute(conn, :insert, sql, opts)
105   end
106 end
freeze()
[show source]
    # File lib/sequel/adapters/sqlanywhere.rb
108 def freeze
109   @conversion_procs.freeze
110   super
111 end