/** * Allow for the field order to be matched if required. * This is required for custom SQL. */ public void matchFieldOrder(ResultSet resultSet, DatabaseAccessor accessor, AbstractSession session) { if ((getFields() != null) && (!isFieldMatchingRequired())) { return; } setFields(accessor.buildSortedFields(getFields(), resultSet, session)); }
/** * Connect to the database. * Exceptions are caught and re-thrown as TopLink exceptions. * Must set the transaction isolation. */ protected void connect(Login login) throws DatabaseException { super.connect(login); checkTransactionIsolation(); }
/** * Commit a transaction on the database. First flush any batched statements. */ public void commitTransaction(AbstractSession session) throws DatabaseException { this.writesCompleted(session); super.commitTransaction(session); }
public void prepare(DatabasePlatform platform) { if (isCursor()) { jdbcType = platform.getCursorCode();// Oracle code for cursors } else { jdbcType = platform.getJDBCType(getOutputField()); isTypeNameRequired = platform.requiresTypeNameToRegisterOutputParameter(); if (isTypeNameRequired) { typeName = platform.getJdbcTypeName(jdbcType); } } }
/** * Close the accessor's connection. * This is used only for external connection pooling * when it is intended for the connection to be reconnected in the future. */ public void closeConnection() { // Unfortunately do not have the session to pass, fortunately it is not used. clearStatementCache(null); super.closeConnection(); }
/** * Disconnect from the datasource. * Added for bug 3046465 to ensure the statement cache is cleared */ public void disconnect(AbstractSession session) throws DatabaseException { clearStatementCache(session); super.disconnect(session); }
/** * Attempt to save some of the cost associated with getting a fresh connection. * Assume the DatabaseDriver has been cached, if appropriate. * Note: Connections that are participating in transactions will not be refreshd.^M * Added for bug 3046465 to ensure the statement cache is cleared */ protected void reconnect(AbstractSession session) { clearStatementCache(session); super.reconnect(session); }
public void set(DatabasePlatform platform, PreparedStatement statement, int index, AbstractSession session) throws SQLException { platform.setParameterValueInDatabaseCall(inParameter, statement, index, session); super.set(platform, statement, index, session); }
/** * Return a new field type with a required size defaulting to the defaultSize. */ public FieldTypeDefinition(String databaseTypeName, int defaultSize, int defaultSubSize) { this(); this.name = databaseTypeName; this.defaultSize = defaultSize; this.defaultSubSize = defaultSubSize; this.isSizeRequired = true; setMaxPrecision(defaultSize); setMaxScale(defaultSubSize); }
/** * Set this type to optionally have a size specification. */ public void setSizeOptional() { setIsSizeRequired(false); setIsSizeAllowed(true); }
/** * Bound calls can use prepared statement caching. */ public boolean shouldCacheStatement(DatabasePlatform databasePlatform) { //CR4272 If result set is scrollable, do not cache statement since scrollable cursor can not be used for cached statement if (isResultSetScrollable()) { return false; } if (shouldCacheStatement == FalseUndefinedTrue.Undefined) { return databasePlatform.shouldCacheAllStatements(); } else { return shouldCacheStatement == FalseUndefinedTrue.True; } }
/** * Cursor return is used for cursored streams. */ public void returnCursor() { setReturnType(RETURN_CURSOR); }
/** * INTERNAL * Override this method in case the platform needs to do something special for binding literals. * Note that instead of null value a DatabaseField * value may be passed (so that it's type could be used for binding null). */ protected void appendLiteralToCallWithBinding(Call call, Writer writer, Object literal) { ((DatabaseCall)call).appendLiteral(writer, literal); }
/** * Return the class type to database type mapping for the schema framework. */ public Hashtable getClassTypes() { if (classTypes == null) { classTypes = buildClassTypes(); } return classTypes; }
/** * This method is used to print the required output parameter token for the * specific platform. Used when stored procedures are created. */ public String getCreationInOutputProcedureToken() { return getInOutputProcedureToken(); }
/** * ADVANCED: * Allow for case in field names to be ignored as some databases are not case sensitive. * When using custom this can be an issue if the fields in the descriptor have a different case. */ public static void setShouldIgnoreCaseOnFieldComparisons(boolean shouldIgnoreCaseOnFieldComparisons) { DatabasePlatform.setShouldIgnoreCaseOnFieldComparisons(shouldIgnoreCaseOnFieldComparisons); }
/** * The return type is one of, NoReturn, ReturnOneRow or ReturnManyRows. */ public boolean isNothingReturned() { return getReturnType() == NO_RETURN; }
/** * INTERNAL: * Return the SQL string for the call. */ public String getCallString() { return getSQLString(); }
/** * Return the receiver's connection to its data source. A connection is used to execute queries on, * and retreive data from, a data source. * @see java.sql.Connection */ public Connection getConnection() throws DatabaseException { return (Connection)getDatasourceConnection(); }
/** * Many rows are returned for read-all queries. */ public void returnManyRows() { setReturnType(RETURN_MANY_ROWS); }