public boolean relative(int rows) throws SQLException { checkScrollable(); if (onInsertRow) throw new PSQLException(GT.tr("Can''t use relative move methods while on the insert row."), PSQLState.INVALID_CURSOR_STATE); //have to add 1 since absolute expects a 1-based index return absolute(current_row + 1 + rows); }
public void handleWarning(SQLWarning warning) { AbstractJdbc2ResultSet.this.addWarning(warning); }
public boolean absolute(int index) throws SQLException checkScrollable(); beforeFirst(); return false; else beforeFirst(); return false; else afterLast(); return false; initRowBuffer(); onInsertRow = false;
public float getFloat(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return 0; // SQL NULL return toFloat( getFixedString(columnIndex) ); }
public boolean getBoolean(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return false; // SQL NULL return toBoolean( getString(columnIndex) ); }
public synchronized void moveToInsertRow() throws SQLException { checkUpdateable(); if (insertStatement != null) { insertStatement = null; } // make sure the underlying data is null clearRowBuffer(false); onInsertRow = true; doingUpdates = false; }
protected void updateValue(int columnIndex, Object value) throws SQLException { checkUpdateable(); if (!onInsertRow && (isBeforeFirst() || isAfterLast() || rows.size() == 0)) { throw new PSQLException(GT.tr("Cannot update the ResultSet because it is either before the start or after the end of the results."), PSQLState.INVALID_CURSOR_STATE); } checkColumnIndex(columnIndex); doingUpdates = !onInsertRow; if (value == null) { updateNull(columnIndex); } else { PGResultSetMetaData md = (PGResultSetMetaData)getMetaData(); updateValues.put(md.getBaseColumnName(columnIndex), value); } }
public void refreshRow() throws SQLException checkUpdateable(); if (onInsertRow) throw new PSQLException(GT.tr("Can''t refresh the insert row."), PSQLState.INVALID_CURSOR_STATE); if (isBeforeFirst() || isAfterLast() || rows.size() == 0) return ; ResultSetMetaData rsmd = getMetaData(); PGResultSetMetaData pgmd = (PGResultSetMetaData)rsmd; for (int i=1; i <= rsmd.getColumnCount(); i++) { if ( rs.next() ) rs.close(); selectStatement.close(); selectStatement = null;
public synchronized void deleteRow() throws SQLException checkUpdateable(); if (isBeforeFirst()) if (isAfterLast()) moveToCurrentRow();
public synchronized void updateRow() throws SQLException checkUpdateable(); if (isBeforeFirst() || isAfterLast() || rows.size() == 0) updateStatement = null; updateRowBuffer();
public boolean last() throws SQLException { checkScrollable(); final int rows_size = rows.size(); if (rows_size <= 0) return false; current_row = rows_size - 1; initRowBuffer(); onInsertRow = false; return true; }
public InputStream getAsciiStream(int columnIndex) throws SQLException { checkResultSet( columnIndex ); if (wasNullFlag) return null; if (connection.haveMinimumCompatibleVersion("7.2")) { //Version 7.2 supports AsciiStream for all the PG text types //As the spec/javadoc for this method indicate this is to be used for //large text values (i.e. LONGVARCHAR) PG doesn't have a separate //long string datatype, but with toast the text datatype is capable of //handling very large values. Thus the implementation ends up calling //getString() since there is no current way to stream the value from the server try { return new ByteArrayInputStream(getString(columnIndex).getBytes("ASCII")); } catch (UnsupportedEncodingException l_uee) { throw new PSQLException(GT.tr("The JVM claims not to support the encoding: {0}","ASCII"), PSQLState.UNEXPECTED_ERROR, l_uee); } } else { // In 7.1 Handle as BLOBS so return the LargeObject input stream return getBinaryStream(columnIndex); } }
public synchronized void insertRow() throws SQLException checkUpdateable(); updateRowBuffer(); clearRowBuffer(false);
public Object getObject(int columnIndex) throws SQLException { Field field; checkResultSet(columnIndex); if (wasNullFlag) return null; field = fields[columnIndex - 1]; // some fields can be null, mainly from those returned by MetaData methods if (field == null) { wasNullFlag = true; return null; } Object result = internalGetObject(columnIndex, field); if (result != null) return result; return connection.getObject(getPGType(columnIndex), getString(columnIndex)); }
public long getLong(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return 0; // SQL NULL Encoding encoding = connection.getEncoding(); if (encoding.hasAsciiNumbers()) { try { return getFastLong(columnIndex); } catch (NumberFormatException ex) { } } return toLong( getFixedString(columnIndex) ); }
public int getInt(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return 0; // SQL NULL Encoding encoding = connection.getEncoding(); if (encoding.hasAsciiNumbers()) { try { return getFastInt(columnIndex); } catch (NumberFormatException ex) { } } return toInt( getFixedString(columnIndex) ); }
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return null; Encoding encoding = connection.getEncoding(); if (encoding.hasAsciiNumbers()) { try { return getFastBigDecimal(columnIndex); } catch (NumberFormatException ex) { } } return toBigDecimal( getFixedString(columnIndex), scale ); }
public Statement getStatement() throws SQLException { checkClosed(); return (Statement) statement; }
public double getDouble(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return 0; // SQL NULL return toDouble( getFixedString(columnIndex) ); }
public java.sql.Date getDate(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (cal != null) cal = (Calendar)cal.clone(); return connection.getTimestampUtils().toDate(cal, getString(i)); }