public java.sql.Array getArray(int i) throws SQLException { checkResultSet( i ); if (wasNullFlag) return null; return createArray(i); }
public boolean getBoolean(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return false; // SQL NULL return toBoolean( getString(columnIndex) ); }
public float getFloat(int columnIndex) throws SQLException { checkResultSet(columnIndex); if (wasNullFlag) return 0; // SQL NULL return toFloat( getFixedString(columnIndex) ); }
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)); }
public Timestamp getTimestamp(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (cal != null) cal = (Calendar)cal.clone(); // If this is actually a timestamptz, the server-provided timezone will override // the one we pass in, which is the desired behaviour. Otherwise, we'll // interpret the timezone-less value in the provided timezone. return connection.getTimestampUtils().toTimestamp(cal, getString(i)); }
public Time getTime(int i, java.util.Calendar cal) throws SQLException { checkResultSet(i); if (wasNullFlag) return null; if (cal != null) cal = (Calendar)cal.clone(); return connection.getTimestampUtils().toTime(cal, getString(i)); }
public byte getByte(int columnIndex) throws SQLException checkResultSet(columnIndex); if (wasNullFlag) return 0; // SQL NULL
public short getShort(int columnIndex) throws SQLException checkResultSet(columnIndex); if (wasNullFlag) return 0; // SQL NULL
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 InputStream getUnicodeStream(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("UTF-8")); } catch (UnsupportedEncodingException l_uee) { throw new PSQLException(GT.tr("The JVM claims not to support the encoding: {0}","UTF-8"), PSQLState.UNEXPECTED_ERROR, l_uee); } } else { // In 7.1 Handle as BLOBS so return the LargeObject input stream return getBinaryStream(columnIndex); } }
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 String getString(int columnIndex) throws SQLException { checkResultSet( columnIndex ); if (wasNullFlag) return null; Encoding encoding = connection.getEncoding(); try { return trimString(columnIndex, encoding.decode(this_row[columnIndex - 1])); } catch (IOException ioe) { throw new PSQLException(GT.tr("Invalid character data was found. This is most likely caused by stored data containing characters that are invalid for the character set the database was created in. The most common example of this is storing 8bit data in a SQL_ASCII database."), PSQLState.DATA_ERROR, ioe); } }
public java.io.Reader getCharacterStream(int i) throws SQLException { checkResultSet( i ); if (wasNullFlag) return null; if (((AbstractJdbc2Connection) 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 return new CharArrayReader(getString(i).toCharArray()); } else { // In 7.1 Handle as BLOBS so return the LargeObject input stream Encoding encoding = connection.getEncoding(); InputStream input = getBinaryStream(i); try { return encoding.getDecodingReader(input); } catch (IOException ioe) { throw new PSQLException(GT.tr("Unexpected error while decoding character data from a large object."), PSQLState.UNEXPECTED_ERROR, ioe); } } }
public InputStream getBinaryStream(int columnIndex) throws SQLException { checkResultSet( columnIndex ); if (wasNullFlag) return null; if (connection.haveMinimumCompatibleVersion("7.2")) { //Version 7.2 supports BinaryStream for all PG bytea type //As the spec/javadoc for this method indicate this is to be used for //large binary values (i.e. LONGVARBINARY) PG doesn't have a separate //long binary datatype, but with toast the bytea datatype is capable of //handling very large values. Thus the implementation ends up calling //getBytes() since there is no current way to stream the value from the server byte b[] = getBytes(columnIndex); if (b != null) return new ByteArrayInputStream(b); } else { // In 7.1 Handle as BLOBS so return the LargeObject input stream if ( fields[columnIndex - 1].getOID() == Oid.OID) { LargeObjectManager lom = connection.getLargeObjectAPI(); LargeObject lob = lom.open(getLong(columnIndex)); return lob.getInputStream(); } } return null; }
public byte[] getBytes(int columnIndex) throws SQLException checkResultSet( columnIndex ); if (wasNullFlag) return null;
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)); }