/** * INTERNAL: * Returns the value for the mapping directly from the result-set. * PERF: Used for optimized object building. */ public Object valueFromResultSet(ResultSet resultSet, ObjectLevelReadQuery query, AbstractSession session, DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, DatabasePlatform platform) throws DatabaseException { return accessor.getObject(resultSet, this.field, metaData, columnNumber, platform, true, session); }
/** * Obtains all the value from resultSet and removes it. * resultSet must be non null. */ public void loadAllValuesFromResultSet() { int size = this.valuesArray.length; for (int index = 0; index < size; index++) { if (this.valuesArray[index] == null) { DatabaseField field = this.fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { this.valuesArray[index] = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); } } } this.resultSet = null; this.metaData = null; this.accessor = null; this.platform = null; this.session = null; }
/** * Obtains all the value from resultSet and removes it. * resultSet must be non null. */ public void loadAllValuesFromResultSet() { int size = this.valuesArray.length; for (int index = 0; index < size; index++) { if (this.valuesArray[index] == null) { DatabaseField field = this.fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { this.valuesArray[index] = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); } } } this.resultSet = null; this.metaData = null; this.accessor = null; this.platform = null; this.session = null; }
public void populateRow(DatabaseField[] fieldsArray, Object[] values, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session, int startIndex, int endIndex) throws DatabaseException { // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = startIndex; index < endIndex; index++) { DatabaseField field = fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { values[index] = getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session); } } }
public void populateRow(DatabaseField[] fieldsArray, Object[] values, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session, int startIndex, int endIndex) throws DatabaseException { // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = startIndex; index < endIndex; index++) { DatabaseField field = fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { values[index] = getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session); } } }
/** * Return a new DatabaseRow.<p> * Populate the row from the data in cursor. The fields representing the results * and the order of the results are stored in fields. * <p><b>NOTE</b>: * Make sure that the field name is set. An empty field name placeholder is * used in the sortFields() method when the number of fields defined does not * match the number of column names available on the database. * PERF: This method must be highly optimized. */ protected AbstractRecord fetchRow(Vector fields, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session) throws DatabaseException { int size = fields.size(); Vector values = NonSynchronizedVector.newInstance(size); // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = 0; index < size; index++) { DatabaseField field = (DatabaseField)fields.elementAt(index); // Field can be null for fetch groups. if (field != null) { values.add(getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session)); } else { values.add(null); } } // Row creation is optimized through sharing the same fields for the entire result set. return new DatabaseRecord(fields, values); }
/** * Return a new DatabaseRow.<p> * Populate the row from the data in cursor. The fields representing the results * and the order of the results are stored in fields. * <p><b>NOTE</b>: * Make sure that the field name is set. An empty field name placeholder is * used in the sortFields() method when the number of fields defined does not * match the number of column names available on the database. * PERF: This method must be highly optimized. */ protected AbstractRecord fetchRow(Vector fields, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session) throws DatabaseException { int size = fields.size(); Vector values = NonSynchronizedVector.newInstance(size); // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = 0; index < size; index++) { DatabaseField field = (DatabaseField)fields.elementAt(index); // Field can be null for fetch groups. if (field != null) { values.add(getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session)); } else { values.add(null); } } // Row creation is optimized through sharing the same fields for the entire result set. return new DatabaseRecord(fields, values); }
/** * Return a new DatabaseRow.<p> * Populate the row from the data in cursor. The fields representing the results * and the order of the results are stored in fields. * <p><b>NOTE</b>: * Make sure that the field name is set. An empty field name placeholder is * used in the sortFields() method when the number of fields defined does not * match the number of column names available on the database. * PERF: This method must be highly optimized. */ protected AbstractRecord fetchRow(Vector fields, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session) throws DatabaseException { int size = fields.size(); Vector values = NonSynchronizedVector.newInstance(size); // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = 0; index < size; index++) { DatabaseField field = (DatabaseField)fields.elementAt(index); // Field can be null for fetch groups. if (field != null) { values.add(getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session)); } else { values.add(null); } } // Row creation is optimized through sharing the same fields for the entire result set. return new DatabaseRecord(fields, values); }
protected Object getValueFromResultSet(int index, DatabaseField field) { if (this.shouldUseOptimization) { try { Class fieldType = field.getType(); if (fieldType == ClassConstants.STRING) { if(platform.shouldUseGetSetNString()){ return resultSet.getNString(index + 1); }else { return resultSet.getString(index + 1); } } else if (fieldType == ClassConstants.LONG) { return resultSet.getLong(index + 1); } else if (fieldType == ClassConstants.INTEGER) { return resultSet.getInt(index + 1); } } catch (SQLException exception) { DatabaseException commException = this.accessor.processExceptionForCommError(session, exception, null); if (commException != null) { throw commException; } throw DatabaseException.sqlException(exception, accessor, session, false); } } return this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); }
protected Object getValueFromResultSet(int index, DatabaseField field) { if (this.shouldUseOptimization) { try { Class fieldType = field.getType(); if (fieldType == ClassConstants.STRING) { if(platform.shouldUseGetSetNString()){ return resultSet.getNString(index + 1); }else { return resultSet.getString(index + 1); } } else if (fieldType == ClassConstants.LONG) { return resultSet.getLong(index + 1); } else if (fieldType == ClassConstants.INTEGER) { return resultSet.getInt(index + 1); } } catch (SQLException exception) { DatabaseException commException = this.accessor.processExceptionForCommError(session, exception, null); if (commException != null) { throw commException; } throw DatabaseException.sqlException(exception, accessor, session, false); } } return this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); }
/** * Return a new DatabaseRow.<p> * Populate the row from the data in cursor. The fields representing the results * and the order of the results are stored in fields. * <p><b>NOTE</b>: * Make sure that the field name is set. An empty field name placeholder is * used in the sortFields() method when the number of fields defined does not * match the number of column names available on the database. * PERF: This method must be highly optimized. */ public AbstractRecord fetchRow(Vector fields, DatabaseField[] fieldsArray, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session) throws DatabaseException { int size = fieldsArray.length; Object[] values = new Object[size]; // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = 0; index < size; index++) { DatabaseField field = fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { values[index] = getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session); } else { values[index] = null; } } // Row creation is optimized through sharing the same fields for the entire result set. return new ArrayRecord(fields, fieldsArray, values); } public void populateRow(DatabaseField[] fieldsArray, Object[] values, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session, int startIndex, int endIndex) throws DatabaseException {
/** * INTERNAL: * Returns the value for the mapping directly from the result-set. * PERF: Used for optimized object building. */ @Override public Object valueFromResultSet(ResultSet resultSet, ObjectBuildingQuery query, AbstractSession session, DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, DatabasePlatform platform) throws SQLException { if (this.attributeObjectClassification == ClassConstants.STRING) { Object val; if(platform.shouldUseGetSetNString()){ val = resultSet.getNString(columnNumber); }else { val = resultSet.getString(columnNumber); } return getObjectValueWithoutClassCheck(val, session); } else if (this.attributeObjectClassification == ClassConstants.LONG) { return getObjectValueWithoutClassCheck(resultSet.getLong(columnNumber), session); } else if (this.attributeObjectClassification == ClassConstants.INTEGER) { return getObjectValueWithoutClassCheck(resultSet.getInt(columnNumber), session); } Object fieldValue = accessor.getObject(resultSet, getField(), metaData, columnNumber, platform, true, session); return getObjectValue(fieldValue, session); }
/** * INTERNAL: * Returns the value for the mapping directly from the result-set. * PERF: Used for optimized object building. */ @Override public Object valueFromResultSet(ResultSet resultSet, ObjectBuildingQuery query, AbstractSession session, DatabaseAccessor accessor, ResultSetMetaData metaData, int columnNumber, DatabasePlatform platform) throws SQLException { if (this.attributeObjectClassification == ClassConstants.STRING) { Object val; if(platform.shouldUseGetSetNString()){ val = resultSet.getNString(columnNumber); }else { val = resultSet.getString(columnNumber); } return getObjectValueWithoutClassCheck(val, session); } else if (this.attributeObjectClassification == ClassConstants.LONG) { return getObjectValueWithoutClassCheck(resultSet.getLong(columnNumber), session); } else if (this.attributeObjectClassification == ClassConstants.INTEGER) { return getObjectValueWithoutClassCheck(resultSet.getInt(columnNumber), session); } Object fieldValue = accessor.getObject(resultSet, getField(), metaData, columnNumber, platform, true, session); return getObjectValue(fieldValue, session); }
/** * Return a new DatabaseRow.<p> * Populate the row from the data in cursor. The fields representing the results * and the order of the results are stored in fields. * <p><b>NOTE</b>: * Make sure that the field name is set. An empty field name placeholder is * used in the sortFields() method when the number of fields defined does not * match the number of column names available on the database. * PERF: This method must be highly optimized. */ public AbstractRecord fetchRow(Vector fields, DatabaseField[] fieldsArray, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session) throws DatabaseException { int size = fieldsArray.length; Object[] values = new Object[size]; // PERF: Pass platform and optimize data flag. DatabasePlatform platform = getPlatform(); boolean optimizeData = platform.shouldOptimizeDataConversion(); for (int index = 0; index < size; index++) { DatabaseField field = fieldsArray[index]; // Field can be null for fetch groups. if (field != null) { values[index] = getObject(resultSet, field, metaData, index + 1, platform, optimizeData, session); } else { values[index] = null; } } // Row creation is optimized through sharing the same fields for the entire result set. return new ArrayRecord(fields, fieldsArray, values); } public void populateRow(DatabaseField[] fieldsArray, Object[] values, ResultSet resultSet, ResultSetMetaData metaData, AbstractSession session, int startIndex, int endIndex) throws DatabaseException {
value = resultSet.getInt(index + 1); } else { value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session);
value = resultSet.getInt(index + 1); } else { value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session);
Object value = this.valuesArray[index]; if (value == null) { value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); this.valuesArray[index] = value; } else {
Object value = this.valuesArray[index]; if (value == null) { value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); this.valuesArray[index] = value; } else {
Object value = this.valuesArray[index]; if (value == null) { value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); this.valuesArray[index] = value; } else {
Object value = this.valuesArray[index]; if (value == null) { value = this.accessor.getObject(this.resultSet, field, this.metaData, index + 1, this.platform, this.optimizeData, this.session); this.valuesArray[index] = value; } else {