Class Index [+]

Quicksearch

Sequel::JDBC::MySQL::DatabaseMethods

Database instance methods for MySQL databases accessed via JDBC.

Constants

LAST_INSERT_ID

Private Instance Methods

database_name() click to toggle source

The database name for the given database. Need to parse it out of the connection string, since the JDBC does no parsing on the given connection string by default.

    # File lib/sequel/adapters/jdbc/mysql.rb, line 18
18:         def database_name
19:           u = URI.parse(uri.sub(/\Ajdbc:/, ''))
20:           (m = /\/(.*)/.match(u.path)) && m[1]
21:         end
last_insert_id(conn, opts={}) click to toggle source

Get the last inserted id using LAST_INSERT_ID().

    # File lib/sequel/adapters/jdbc/mysql.rb, line 24
24:         def last_insert_id(conn, opts={})
25:           if stmt = opts[:stmt]
26:             rs = stmt.getGeneratedKeys
27:             begin
28:               if rs.next
29:                 rs.getInt(1)
30:               else
31:                 0
32:               end
33:             ensure
34:               rs.close
35:             end
36:           else
37:             statement(conn) do |stmt|
38:               rs = stmt.executeQuery(LAST_INSERT_ID)
39:               rs.next
40:               rs.getInt(1)
41:             end
42:           end
43:         end
requires_return_generated_keys?() click to toggle source

MySQL 5.1.12 JDBC adapter requires this to be true, and previous versions don’t mind.

    # File lib/sequel/adapters/jdbc/mysql.rb, line 47
47:         def requires_return_generated_keys?
48:           true
49:         end
schema_column_type(db_type) click to toggle source

Convert tinyint(1) type to boolean

    # File lib/sequel/adapters/jdbc/mysql.rb, line 52
52:         def schema_column_type(db_type)
53:           db_type == 'tinyint(1)' ? :boolean : super
54:         end
setup_connection(conn) click to toggle source

Run the default connection setting SQL statements. Apply the connectiong setting SQLs for every new connection.

    # File lib/sequel/adapters/jdbc/mysql.rb, line 58
58:         def setup_connection(conn)
59:           mysql_connection_setting_sqls.each{|sql| statement(conn){|s| log_yield(sql){s.execute(sql)}}}
60:           super
61:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.