module Sequel::JDBC::Cubrid::DatabaseMethods

Public Instance Methods

supports_savepoints?() click to toggle source
# File lib/sequel/adapters/jdbc/cubrid.rb, line 24
def supports_savepoints?
  false
end

Private Instance Methods

execute_prepared_statement_insert(stmt) click to toggle source

Use execute instead of executeUpdate.

# File lib/sequel/adapters/jdbc/cubrid.rb, line 47
def execute_prepared_statement_insert(stmt)
  stmt.execute
end
execute_statement_insert(stmt, sql) click to toggle source

Return generated keys for insert statements, and use execute intead of executeUpdate as CUBRID doesn't return generated keys in executeUpdate.

# File lib/sequel/adapters/jdbc/cubrid.rb, line 54
def execute_statement_insert(stmt, sql)
  stmt.execute(sql, JavaSQL::Statement.RETURN_GENERATED_KEYS)
end
last_insert_id(conn, opts=OPTS) click to toggle source

Get the last inserted id using LAST_INSERT_ID().

# File lib/sequel/adapters/jdbc/cubrid.rb, line 31
def last_insert_id(conn, opts=OPTS)
  if stmt = opts[:stmt]
    rs = stmt.getGeneratedKeys
    begin
      if rs.next
        rs.getLong(1)
      end
    rescue NativeException
      nil
    ensure
      rs.close
    end
  end
end
prepare_jdbc_statement(conn, sql, opts) click to toggle source

Return generated keys for insert statements.

Calls superclass method
# File lib/sequel/adapters/jdbc/cubrid.rb, line 59
def prepare_jdbc_statement(conn, sql, opts)
  opts[:type] == :insert ? conn.prepareStatement(sql, JavaSQL::Statement.RETURN_GENERATED_KEYS) : super
end