class Sequel::Trilogy::Database

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

Constants

LOCAL_TIME_QUERY_FLAGS = QUERY_FLAGS | ::Trilogy::QUERY_FLAGS_LOCAL_TIMEZONE  
QUERY_FLAGS = ::Trilogy::QUERY_FLAGS_CAST | ::Trilogy::QUERY_FLAGS_CAST_BOOLEANS  

Public Instance methods

connect(server)

Connect to the database. See Trilogy documentation for options.

[show source]
   # File lib/sequel/adapters/trilogy.rb
17 def connect(server)
18   opts = server_opts(server)
19   opts[:username] ||= opts.delete(:user)
20   opts[:found_rows] = true
21   conn = ::Trilogy.new(opts)
22   mysql_connection_setting_sqls.each{|sql| log_connection_yield(sql, conn){conn.query(sql)}}
23   conn
24 end
disconnect_connection(c)
[show source]
   # File lib/sequel/adapters/trilogy.rb
26 def disconnect_connection(c)
27   c.discard!
28 rescue ::Trilogy::Error
29   nil
30 end
execute(sql, opts)

Execute the given SQL on the given connection and yield the result.

[show source]
   # File lib/sequel/adapters/trilogy.rb
33 def execute(sql, opts)
34   r = synchronize(opts[:server]) do |conn|
35     log_connection_yield((log_sql = opts[:log_sql]) ? sql + log_sql : sql, conn) do
36       conn.query_with_flags(sql, timezone.nil? || timezone == :local ? LOCAL_TIME_QUERY_FLAGS : QUERY_FLAGS)
37     end
38   end
39   yield r
40 rescue ::Trilogy::Error => e
41   raise_error(e)
42 end
execute_dui(sql, opts=OPTS)
[show source]
   # File lib/sequel/adapters/trilogy.rb
44 def execute_dui(sql, opts=OPTS)
45   execute(sql, opts, &:affected_rows)
46 end
execute_insert(sql, opts=OPTS)
[show source]
   # File lib/sequel/adapters/trilogy.rb
48 def execute_insert(sql, opts=OPTS)
49   execute(sql, opts, &:last_insert_id)
50 end
freeze()
[show source]
   # File lib/sequel/adapters/trilogy.rb
52 def freeze
53   server_version
54   super
55 end
server_version(_server=nil)

Return the version of the MySQL server to which we are connecting.

[show source]
   # File lib/sequel/adapters/trilogy.rb
58 def server_version(_server=nil)
59   @server_version ||= super()
60 end