Class PgResultSet
- All Implemented Interfaces:
AutoCloseable
,ResultSet
,Wrapper
,PGRefCursorResultSet
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
(package private) static class
private class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
private static final BigInteger
private static final BigInteger
protected final BaseConnection
protected int
protected ResultCursor
private TimeZone
private PreparedStatement
private boolean
private static final NumberFormatException
A dummy exception thrown when fast byte[] to number parsing fails and no value can be returned.private int
protected int
protected final Field[]
private static final BigInteger
private static final BigInteger
protected int
private static final LocalDate
private static final BigInteger
private static final BigInteger
protected final int
protected final int
protected boolean
private String
protected final Query
private List<PgResultSet.PrimaryKey>
private String
private final int
private final int
private Tuple
protected int
private ResultSetMetaData
private static final BigInteger
private static final BigInteger
private boolean
protected final BaseStatement
private String
protected Tuple
private TimestampUtils
private boolean
private boolean
protected SQLWarning
protected boolean
True if the last obtained column value was SQL NULL as specified bywasNull()
.Fields inherited from interface java.sql.ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE
-
Constructor Summary
ConstructorsConstructorDescriptionPgResultSet
(Query originalQuery, BaseStatement statement, Field[] fields, List<Tuple> tuples, ResultCursor cursor, int maxRows, int maxFieldSize, int rsType, int rsConcurrency, int rsHoldability, boolean adaptiveFetch) -
Method Summary
Modifier and TypeMethodDescriptionboolean
absolute
(int index) (package private) void
Used to add rows to an already existing ResultSet that exactly match the existing rows.protected void
addWarning
(SQLWarning warnings) void
void
void
protected void
protected void
checkColumnIndex
(int column) private void
private void
private void
clearRowBuffer
(boolean copyCurrentRow) void
void
close()
protected void
private void
Closes<unnamed portal 1>
if no more fetch calls expected (cursor==null
)createColumnNameIndexMap
(Field[] fields, boolean isSanitiserDisabled) protected ResultSetMetaData
void
int
findColumn
(String columnName) private int
findColumnIndex
(String columnName) boolean
first()
boolean
Get state of adaptive fetch for resultSet.getArray
(int i) getAsciiStream
(int columnIndex) getAsciiStream
(String columnName) getBigDecimal
(int columnIndex) getBigDecimal
(int columnIndex, int scale) getBigDecimal
(String columnName) getBigDecimal
(String columnName, int scale) getBinaryStream
(int columnIndex) getBinaryStream
(String columnName) getBlob
(int i) boolean
getBoolean
(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSet
object as aboolean
in the Java programming language.boolean
getBoolean
(String columnName) byte
getByte
(int columnIndex) byte
byte[]
getBytes
(int columnIndex) byte[]
getCharacterStream
(int i) getCharacterStream
(String columnName) getClob
(int i) int
getColumnOID
(int field) Returns the OID of a field.int
getDate
(int columnIndex) private Calendar
double
getDouble
(int columnIndex) double
private BigDecimal
getFastBigDecimal
(byte[] bytes) Optimised byte[] to number parser.private int
getFastInt
(byte[] bytes) Optimised byte[] to number parser.private long
getFastLong
(byte[] bytes) Optimised byte[] to number parser.int
int
getFixedString
(int col) This is used to fix get*() methods on Money fields.float
getFloat
(int columnIndex) float
int
int
getInt
(int columnIndex) int
int
Get fetch size used during last fetch.private LocalDate
getLocalDate
(int i) private LocalDateTime
getLocalDateTime
(int i) private LocalTime
getLocalTime
(int i) long
getLong
(int columnIndex) long
getNCharacterStream
(int columnIndex) getNCharacterStream
(String columnName) getNClob
(int columnIndex) getNString
(int columnIndex) getNString
(String columnName) private Number
getNumeric
(int columnIndex, int scale, boolean allowNaN) getObject
(int columnIndex) <T> T
<T> T
getObjectImpl
(int i, Map<String, Class<?>> map) getObjectImpl
(String columnName, Map<String, Class<?>> map) private OffsetDateTime
getOffsetDateTime
(int i) private OffsetTime
getOffsetTime
(int i) protected String
getPGType
(int column) protected byte[]
getRawValue
(int column) Checks that the result set is not closed, it's positioned on a valid row and that the given column number is valid.getRef
(int i) int
getRow()
getRowId
(int columnIndex) short
getShort
(int columnIndex) short
protected int
getSQLType
(int column) getSQLXML
(int columnIndex) getString
(int columnIndex) getTime
(int columnIndex) getTimestamp
(int columnIndex) getTimestamp
(int i, Calendar cal) getTimestamp
(String columnName) getTimestamp
(String c, Calendar cal) private TimestampUtils
int
getType()
getUnicodeStream
(int columnIndex) getUnicodeStream
(String columnName) getURL
(int columnIndex) protected Object
getUUID
(byte[] data) protected Object
private void
private void
initSqlType
(Field field) void
protected Object
internalGetObject
(int columnIndex, Field field) boolean
boolean
protected boolean
isBinary
(int column) Returns true if the value of the given column is in binary format.boolean
isClosed()
private boolean
isColumnTrimmable
(int columnIndex) boolean
isFirst()
boolean
isLast()
protected boolean
(package private) boolean
Is this ResultSet updateable?boolean
isWrapperFor
(Class<?> iface) boolean
last()
protected Array
makeArray
(int oid, byte[] value) protected Array
protected Blob
makeBlob
(long oid) protected Clob
makeClob
(long oid) void
void
boolean
next()
private void
boolean
previous()
static String[]
quotelessTableName
(String fullname) Cracks out the table name and schema (if it exists) from a fully qualified table name.private double
readDoubleValue
(byte[] bytes, int oid, String targetType) Converts any numeric binary field to double value.private long
readLongValue
(byte[] bytes, int oid, long minVal, long maxVal, String targetType) Converts any numeric binary field to long value.void
boolean
relative
(int rows) boolean
boolean
boolean
private BigDecimal
scaleBigDecimal
(BigDecimal val, int scale) void
setAdaptiveFetch
(boolean adaptiveFetch) Turn on/off adaptive fetch for ResultSet.void
setFetchDirection
(int direction) void
setFetchSize
(int rows) private void
setRefCursor
(String refCursorName) private void
setRowBufferColumn
(Tuple rowBuffer, int columnIndex, Object valueObject) static BigDecimal
toBigDecimal
(String s, int scale) static double
static float
static int
static long
static short
private byte[]
trimBytes
(int columnIndex, byte[] bytes) private String
private String
trimString
(int columnIndex, String string) <T> T
void
updateArray
(int columnIndex, Array x) void
updateArray
(String columnName, Array x) void
updateAsciiStream
(int columnIndex, InputStream inputStream) void
updateAsciiStream
(int columnIndex, InputStream x, int length) void
updateAsciiStream
(int columnIndex, InputStream inputStream, long length) void
updateAsciiStream
(String columnName, InputStream inputStream) void
updateAsciiStream
(String columnName, InputStream x, int length) void
updateAsciiStream
(String columnName, InputStream inputStream, long length) void
updateBigDecimal
(int columnIndex, BigDecimal x) void
updateBigDecimal
(String columnName, BigDecimal x) void
updateBinaryStream
(int columnIndex, InputStream inputStream) void
updateBinaryStream
(int columnIndex, InputStream x, int length) void
updateBinaryStream
(int columnIndex, InputStream inputStream, long length) void
updateBinaryStream
(String columnName, InputStream inputStream) void
updateBinaryStream
(String columnName, InputStream x, int length) void
updateBinaryStream
(String columnName, InputStream inputStream, long length) void
updateBlob
(int columnIndex, InputStream inputStream) void
updateBlob
(int columnIndex, InputStream inputStream, long length) void
updateBlob
(int columnIndex, Blob x) void
updateBlob
(String columnName, InputStream inputStream) void
updateBlob
(String columnName, InputStream inputStream, long length) void
updateBlob
(String columnName, Blob x) void
updateBoolean
(int columnIndex, boolean x) void
updateBoolean
(String columnName, boolean x) void
updateByte
(int columnIndex, byte x) void
updateByte
(String columnName, byte x) void
updateBytes
(int columnIndex, byte[] x) void
updateBytes
(String columnName, byte[] x) void
updateCharacterStream
(int columnIndex, Reader reader) void
updateCharacterStream
(int columnIndex, Reader x, int length) void
updateCharacterStream
(int columnIndex, Reader reader, long length) void
updateCharacterStream
(String columnName, Reader reader) void
updateCharacterStream
(String columnName, Reader reader, int length) void
updateCharacterStream
(String columnName, Reader reader, long length) void
updateClob
(int columnIndex, Reader reader) void
updateClob
(int columnIndex, Reader reader, long length) void
updateClob
(int columnIndex, Clob x) void
updateClob
(String columnName, Reader reader) void
updateClob
(String columnName, Reader reader, long length) void
updateClob
(String columnName, Clob x) void
updateDate
(int columnIndex, Date x) void
updateDate
(String columnName, Date x) void
updateDouble
(int columnIndex, double x) void
updateDouble
(String columnName, double x) void
updateFloat
(int columnIndex, float x) void
updateFloat
(String columnName, float x) void
updateInt
(int columnIndex, int x) void
void
updateLong
(int columnIndex, long x) void
updateLong
(String columnName, long x) void
updateNCharacterStream
(int columnIndex, Reader x) void
updateNCharacterStream
(int columnIndex, Reader x, int length) void
updateNCharacterStream
(int columnIndex, Reader x, long length) void
updateNCharacterStream
(String columnName, Reader x) void
updateNCharacterStream
(String columnName, Reader x, int length) void
updateNCharacterStream
(String columnName, Reader x, long length) void
updateNClob
(int columnIndex, Reader reader) void
updateNClob
(int columnIndex, Reader reader, long length) void
updateNClob
(int columnIndex, NClob nClob) void
updateNClob
(String columnName, Reader reader) void
updateNClob
(String columnName, Reader reader, long length) void
updateNClob
(String columnName, NClob nClob) void
updateNString
(int columnIndex, String nString) void
updateNString
(String columnName, String nString) void
updateNull
(int columnIndex) void
updateNull
(String columnName) void
updateObject
(int columnIndex, Object x) void
updateObject
(int columnIndex, Object x, int scale) void
updateObject
(int columnIndex, Object x, SQLType targetSqlType) void
updateObject
(int columnIndex, Object x, SQLType targetSqlType, int scaleOrLength) void
updateObject
(String columnName, Object x) void
updateObject
(String columnName, Object x, int scale) void
updateObject
(String columnLabel, Object x, SQLType targetSqlType) void
updateObject
(String columnLabel, Object x, SQLType targetSqlType, int scaleOrLength) private void
updateQueryInsideAdaptiveFetchCache
(boolean newAdaptiveFetch) Update adaptive fetch cache during changing state of adaptive fetch inside ResultSet.void
void
void
private void
updateRowBuffer
(PreparedStatement insertStatement, Tuple rowBuffer, HashMap<String, Object> updateValues) void
updateRowId
(int columnIndex, RowId x) void
updateRowId
(String columnName, RowId x) void
updateShort
(int columnIndex, short x) void
updateShort
(String columnName, short x) void
updateSQLXML
(int columnIndex, SQLXML xmlObject) void
updateSQLXML
(String columnName, SQLXML xmlObject) void
updateString
(int columnIndex, String x) void
updateString
(String columnName, String x) void
updateTime
(int columnIndex, Time x) void
updateTime
(String columnName, Time x) void
updateTimestamp
(int columnIndex, Timestamp x) void
updateTimestamp
(String columnName, Timestamp x) protected void
updateValue
(int columnIndex, Object value) protected PgResultSet
This is here to be used by metadata functions to make all column labels upper case.boolean
wasNull()
-
Field Details
-
updateable
private boolean updateable -
doingUpdates
private boolean doingUpdates -
updateValues
-
usingOID
private boolean usingOID -
-
singleTable
private boolean singleTable -
onlyTable
-
tableName
-
deleteStatement
-
resultsettype
private final int resultsettype -
resultsetconcurrency
private final int resultsetconcurrency -
fetchdirection
private int fetchdirection -
defaultTimeZone
-
connection
-
statement
-
fields
-
originalQuery
-
timestampUtils
-
maxRows
protected final int maxRows -
maxFieldSize
protected final int maxFieldSize -
rows
-
currentRow
protected int currentRow -
rowOffset
protected int rowOffset -
thisRow
-
warnings
-
wasNullFlag
protected boolean wasNullFlagTrue if the last obtained column value was SQL NULL as specified bywasNull()
. The value is always updated by thegetRawValue(int)
method. -
onInsertRow
protected boolean onInsertRow -
rowBuffer
-
fetchSize
protected int fetchSize -
lastUsedFetchSize
protected int lastUsedFetchSize -
adaptiveFetch
protected boolean adaptiveFetch -
cursor
-
columnNameIndexMap
-
rsMetaData
-
LOCAL_DATE_EPOCH
-
refCursorName
-
BYTEMAX
-
BYTEMIN
-
FAST_NUMBER_FAILED
A dummy exception thrown when fast byte[] to number parsing fails and no value can be returned. The exact stack trace does not matter because the exception is always caught and is not visible to users. -
SHORTMAX
-
SHORTMIN
-
INTMAX
-
INTMIN
-
LONGMAX
-
LONGMIN
-
-
Constructor Details
-
PgResultSet
PgResultSet(Query originalQuery, BaseStatement statement, Field[] fields, List<Tuple> tuples, ResultCursor cursor, int maxRows, int maxFieldSize, int rsType, int rsConcurrency, int rsHoldability, boolean adaptiveFetch) throws SQLException - Throws:
SQLException
-
-
Method Details
-
createMetaData
- Throws:
SQLException
-
getMetaData
- Specified by:
getMetaData
in interfaceResultSet
- Throws:
SQLException
-
getURL
- Specified by:
getURL
in interfaceResultSet
- Throws:
SQLException
-
getURL
- Specified by:
getURL
in interfaceResultSet
- Throws:
SQLException
-
internalGetObject
- Throws:
SQLException
-
checkScrollable
- Throws:
SQLException
-
absolute
- Specified by:
absolute
in interfaceResultSet
- Throws:
SQLException
-
afterLast
- Specified by:
afterLast
in interfaceResultSet
- Throws:
SQLException
-
beforeFirst
- Specified by:
beforeFirst
in interfaceResultSet
- Throws:
SQLException
-
first
- Specified by:
first
in interfaceResultSet
- Throws:
SQLException
-
getArray
- Specified by:
getArray
in interfaceResultSet
- Throws:
SQLException
-
makeArray
- Throws:
SQLException
-
makeArray
- Throws:
SQLException
-
getArray
- Specified by:
getArray
in interfaceResultSet
- Throws:
SQLException
-
getBigDecimal
- Specified by:
getBigDecimal
in interfaceResultSet
- Throws:
SQLException
-
getBigDecimal
- Specified by:
getBigDecimal
in interfaceResultSet
- Throws:
SQLException
-
getBlob
- Specified by:
getBlob
in interfaceResultSet
- Throws:
SQLException
-
makeBlob
- Throws:
SQLException
-
getBlob
- Specified by:
getBlob
in interfaceResultSet
- Throws:
SQLException
-
getCharacterStream
- Specified by:
getCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
getCharacterStream
- Specified by:
getCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
getClob
- Specified by:
getClob
in interfaceResultSet
- Throws:
SQLException
-
makeClob
- Throws:
SQLException
-
getClob
- Specified by:
getClob
in interfaceResultSet
- Throws:
SQLException
-
getConcurrency
- Specified by:
getConcurrency
in interfaceResultSet
- Throws:
SQLException
-
getDate
- Specified by:
getDate
in interfaceResultSet
- Throws:
SQLException
-
getTime
- Specified by:
getTime
in interfaceResultSet
- Throws:
SQLException
-
getTimestamp
- Specified by:
getTimestamp
in interfaceResultSet
- Throws:
SQLException
-
getOffsetDateTime
- Throws:
SQLException
-
getOffsetTime
- Throws:
SQLException
-
getLocalDateTime
- Throws:
SQLException
-
getLocalDate
- Throws:
SQLException
-
getLocalTime
- Throws:
SQLException
-
getDate
- Specified by:
getDate
in interfaceResultSet
- Throws:
SQLException
-
getTime
- Specified by:
getTime
in interfaceResultSet
- Throws:
SQLException
-
getTimestamp
- Specified by:
getTimestamp
in interfaceResultSet
- Throws:
SQLException
-
getFetchDirection
- Specified by:
getFetchDirection
in interfaceResultSet
- Throws:
SQLException
-
getObjectImpl
- Throws:
SQLException
-
getObjectImpl
- Throws:
SQLException
-
getRef
- Specified by:
getRef
in interfaceResultSet
- Throws:
SQLException
-
getRef
- Specified by:
getRef
in interfaceResultSet
- Throws:
SQLException
-
getRow
- Specified by:
getRow
in interfaceResultSet
- Throws:
SQLException
-
getStatement
- Specified by:
getStatement
in interfaceResultSet
- Throws:
SQLException
-
getType
- Specified by:
getType
in interfaceResultSet
- Throws:
SQLException
-
isAfterLast
- Specified by:
isAfterLast
in interfaceResultSet
- Throws:
SQLException
-
isBeforeFirst
- Specified by:
isBeforeFirst
in interfaceResultSet
- Throws:
SQLException
-
isFirst
- Specified by:
isFirst
in interfaceResultSet
- Throws:
SQLException
-
isLast
- Specified by:
isLast
in interfaceResultSet
- Throws:
SQLException
-
last
- Specified by:
last
in interfaceResultSet
- Throws:
SQLException
-
previous
- Specified by:
previous
in interfaceResultSet
- Throws:
SQLException
-
relative
- Specified by:
relative
in interfaceResultSet
- Throws:
SQLException
-
setFetchDirection
- Specified by:
setFetchDirection
in interfaceResultSet
- Throws:
SQLException
-
cancelRowUpdates
- Specified by:
cancelRowUpdates
in interfaceResultSet
- Throws:
SQLException
-
deleteRow
- Specified by:
deleteRow
in interfaceResultSet
- Throws:
SQLException
-
insertRow
- Specified by:
insertRow
in interfaceResultSet
- Throws:
SQLException
-
moveToCurrentRow
- Specified by:
moveToCurrentRow
in interfaceResultSet
- Throws:
SQLException
-
moveToInsertRow
- Specified by:
moveToInsertRow
in interfaceResultSet
- Throws:
SQLException
-
clearRowBuffer
- Throws:
SQLException
-
rowDeleted
- Specified by:
rowDeleted
in interfaceResultSet
- Throws:
SQLException
-
rowInserted
- Specified by:
rowInserted
in interfaceResultSet
- Throws:
SQLException
-
rowUpdated
- Specified by:
rowUpdated
in interfaceResultSet
- Throws:
SQLException
-
updateAsciiStream
- Specified by:
updateAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
updateBigDecimal
- Specified by:
updateBigDecimal
in interfaceResultSet
- Throws:
SQLException
-
updateBinaryStream
- Specified by:
updateBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
updateBoolean
- Specified by:
updateBoolean
in interfaceResultSet
- Throws:
SQLException
-
updateByte
- Specified by:
updateByte
in interfaceResultSet
- Throws:
SQLException
-
updateBytes
- Specified by:
updateBytes
in interfaceResultSet
- Throws:
SQLException
-
updateCharacterStream
- Specified by:
updateCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateDate
- Specified by:
updateDate
in interfaceResultSet
- Throws:
SQLException
-
updateDouble
- Specified by:
updateDouble
in interfaceResultSet
- Throws:
SQLException
-
updateFloat
- Specified by:
updateFloat
in interfaceResultSet
- Throws:
SQLException
-
updateInt
- Specified by:
updateInt
in interfaceResultSet
- Throws:
SQLException
-
updateLong
- Specified by:
updateLong
in interfaceResultSet
- Throws:
SQLException
-
updateNull
- Specified by:
updateNull
in interfaceResultSet
- Throws:
SQLException
-
updateObject
- Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
updateObject
- Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
refreshRow
- Specified by:
refreshRow
in interfaceResultSet
- Throws:
SQLException
-
updateRow
- Specified by:
updateRow
in interfaceResultSet
- Throws:
SQLException
-
updateShort
- Specified by:
updateShort
in interfaceResultSet
- Throws:
SQLException
-
updateString
- Specified by:
updateString
in interfaceResultSet
- Throws:
SQLException
-
updateTime
- Specified by:
updateTime
in interfaceResultSet
- Throws:
SQLException
-
updateTimestamp
- Specified by:
updateTimestamp
in interfaceResultSet
- Throws:
SQLException
-
updateNull
- Specified by:
updateNull
in interfaceResultSet
- Throws:
SQLException
-
updateBoolean
- Specified by:
updateBoolean
in interfaceResultSet
- Throws:
SQLException
-
updateByte
- Specified by:
updateByte
in interfaceResultSet
- Throws:
SQLException
-
updateShort
- Specified by:
updateShort
in interfaceResultSet
- Throws:
SQLException
-
updateInt
- Specified by:
updateInt
in interfaceResultSet
- Throws:
SQLException
-
updateLong
- Specified by:
updateLong
in interfaceResultSet
- Throws:
SQLException
-
updateFloat
- Specified by:
updateFloat
in interfaceResultSet
- Throws:
SQLException
-
updateDouble
- Specified by:
updateDouble
in interfaceResultSet
- Throws:
SQLException
-
updateBigDecimal
- Specified by:
updateBigDecimal
in interfaceResultSet
- Throws:
SQLException
-
updateString
- Specified by:
updateString
in interfaceResultSet
- Throws:
SQLException
-
updateBytes
- Specified by:
updateBytes
in interfaceResultSet
- Throws:
SQLException
-
updateDate
- Specified by:
updateDate
in interfaceResultSet
- Throws:
SQLException
-
updateTime
- Specified by:
updateTime
in interfaceResultSet
- Throws:
SQLException
-
updateTimestamp
- Specified by:
updateTimestamp
in interfaceResultSet
- Throws:
SQLException
-
updateAsciiStream
- Specified by:
updateAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
updateBinaryStream
- Specified by:
updateBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
updateCharacterStream
- Specified by:
updateCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateObject
- Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
updateObject
- Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
isUpdateable
Is this ResultSet updateable?- Throws:
SQLException
-
setAdaptiveFetch
Turn on/off adaptive fetch for ResultSet.- Parameters:
adaptiveFetch
- desired state of adaptive fetch.- Throws:
SQLException
- exception returned if ResultSet is closed
-
updateQueryInsideAdaptiveFetchCache
private void updateQueryInsideAdaptiveFetchCache(boolean newAdaptiveFetch) Update adaptive fetch cache during changing state of adaptive fetch inside ResultSet. Update inside AdaptiveFetchCache is required to collect data about max result row length for that query to compute adaptive fetch size.- Parameters:
newAdaptiveFetch
- new state of adaptive fetch
-
getAdaptiveFetch
Get state of adaptive fetch for resultSet.- Returns:
- state of adaptive fetch (turned on or off)
- Throws:
SQLException
- exception returned if ResultSet is closed
-
quotelessTableName
Cracks out the table name and schema (if it exists) from a fully qualified table name.- Parameters:
fullname
- string that we are trying to crack. Test cases:Table: table () "Table": Table () Schema.Table: table (schema) "Schema"."Table": Table (Schema) "Schema"."Dot.Table": Dot.Table (Schema) Schema."Dot.Table": Dot.Table (schema)
- Returns:
- String array with element zero always being the tablename and element 1 the schema name which may be a zero length string.
-
parseQuery
private void parseQuery() -
setRowBufferColumn
private void setRowBufferColumn(Tuple rowBuffer, int columnIndex, Object valueObject) throws SQLException - Throws:
SQLException
-
updateRowBuffer
private void updateRowBuffer(PreparedStatement insertStatement, Tuple rowBuffer, HashMap<String, Object> updateValues) throws SQLException- Throws:
SQLException
-
getPGStatement
-
getRefCursor
- Specified by:
getRefCursor
in interfacePGRefCursorResultSet
- Returns:
- the name of the cursor.
-
setRefCursor
-
setFetchSize
- Specified by:
setFetchSize
in interfaceResultSet
- Throws:
SQLException
-
getFetchSize
- Specified by:
getFetchSize
in interfaceResultSet
- Throws:
SQLException
-
getLastUsedFetchSize
Get fetch size used during last fetch. Returned value can be useful if using adaptive fetch.- Returns:
- fetch size used during last fetch.
- Throws:
SQLException
- exception returned if ResultSet is closed
-
next
- Specified by:
next
in interfaceResultSet
- Throws:
SQLException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceResultSet
- Throws:
SQLException
-
closeInternally
- Throws:
SQLException
-
closeRefCursor
Closes<unnamed portal 1>
if no more fetch calls expected (cursor==null
)- Throws:
SQLException
- if portal close fails
-
wasNull
- Specified by:
wasNull
in interfaceResultSet
- Throws:
SQLException
-
getString
- Specified by:
getString
in interfaceResultSet
- Throws:
SQLException
-
getBoolean
Retrieves the value of the designated column in the current row of this
ResultSet
object as aboolean
in the Java programming language.If the designated column has a Character datatype and is one of the following values: "1", "true", "t", "yes", "y" or "on", a value of
true
is returned. If the designated column has a Character datatype and is one of the following values: "0", "false", "f", "no", "n" or "off", a value offalse
is returned. Leading or trailing whitespace is ignored, and case does not matter.If the designated column has a Numeric datatype and is a 1, a value of
true
is returned. If the designated column has a Numeric datatype and is a 0, a value offalse
is returned.- Specified by:
getBoolean
in interfaceResultSet
- Parameters:
columnIndex
- the first column is 1, the second is 2, ...- Returns:
- the column value; if the value is SQL
NULL
, the value returned isfalse
- Throws:
SQLException
- if the columnIndex is not valid; if a database access error occurs; if this method is called on a closed result set or is an invalid cast to boolean type.- See Also:
-
getByte
- Specified by:
getByte
in interfaceResultSet
- Throws:
SQLException
-
getShort
- Specified by:
getShort
in interfaceResultSet
- Throws:
SQLException
-
getInt
- Specified by:
getInt
in interfaceResultSet
- Throws:
SQLException
-
getLong
- Specified by:
getLong
in interfaceResultSet
- Throws:
SQLException
-
getFastLong
Optimised byte[] to number parser. This code does not handle null values, so the caller must do checkResultSet and handle null values prior to calling this function.- Parameters:
bytes
- integer represented as a sequence of ASCII bytes- Returns:
- The parsed number.
- Throws:
NumberFormatException
- If the number is invalid or the out of range for fast parsing. The value must then be parsed bytoLong(String)
.
-
getFastInt
Optimised byte[] to number parser. This code does not handle null values, so the caller must do checkResultSet and handle null values prior to calling this function.- Parameters:
bytes
- integer represented as a sequence of ASCII bytes- Returns:
- The parsed number.
- Throws:
NumberFormatException
- If the number is invalid or the out of range for fast parsing. The value must then be parsed bytoInt(String)
.
-
getFastBigDecimal
Optimised byte[] to number parser. This code does not handle null values, so the caller must do checkResultSet and handle null values prior to calling this function.- Parameters:
bytes
- integer represented as a sequence of ASCII bytes- Returns:
- The parsed number.
- Throws:
NumberFormatException
- If the number is invalid or the out of range for fast parsing. The value must then be parsed bytoBigDecimal(String, int)
.
-
getFloat
- Specified by:
getFloat
in interfaceResultSet
- Throws:
SQLException
-
getDouble
- Specified by:
getDouble
in interfaceResultSet
- Throws:
SQLException
-
getBigDecimal
- Specified by:
getBigDecimal
in interfaceResultSet
- Throws:
SQLException
-
getNumeric
- Throws:
SQLException
-
getBytes
In normal use, the bytes represent the raw values returned by the backend. However, if the column is an OID, then it is assumed to refer to a Large Object, and that object is returned as a byte array.
Be warned If the large object is huge, then you may run out of memory.
- Specified by:
getBytes
in interfaceResultSet
- Throws:
SQLException
-
getDate
- Specified by:
getDate
in interfaceResultSet
- Throws:
SQLException
-
getTime
- Specified by:
getTime
in interfaceResultSet
- Throws:
SQLException
-
getTimestamp
- Specified by:
getTimestamp
in interfaceResultSet
- Throws:
SQLException
-
getAsciiStream
- Specified by:
getAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
getUnicodeStream
- Specified by:
getUnicodeStream
in interfaceResultSet
- Throws:
SQLException
-
getBinaryStream
- Specified by:
getBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
getString
- Specified by:
getString
in interfaceResultSet
- Throws:
SQLException
-
getBoolean
- Specified by:
getBoolean
in interfaceResultSet
- Throws:
SQLException
-
getByte
- Specified by:
getByte
in interfaceResultSet
- Throws:
SQLException
-
getShort
- Specified by:
getShort
in interfaceResultSet
- Throws:
SQLException
-
getInt
- Specified by:
getInt
in interfaceResultSet
- Throws:
SQLException
-
getLong
- Specified by:
getLong
in interfaceResultSet
- Throws:
SQLException
-
getFloat
- Specified by:
getFloat
in interfaceResultSet
- Throws:
SQLException
-
getDouble
- Specified by:
getDouble
in interfaceResultSet
- Throws:
SQLException
-
getBigDecimal
- Specified by:
getBigDecimal
in interfaceResultSet
- Throws:
SQLException
-
getBytes
- Specified by:
getBytes
in interfaceResultSet
- Throws:
SQLException
-
getDate
- Specified by:
getDate
in interfaceResultSet
- Throws:
SQLException
-
getTime
- Specified by:
getTime
in interfaceResultSet
- Throws:
SQLException
-
getTimestamp
- Specified by:
getTimestamp
in interfaceResultSet
- Throws:
SQLException
-
getAsciiStream
- Specified by:
getAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
getUnicodeStream
- Specified by:
getUnicodeStream
in interfaceResultSet
- Throws:
SQLException
-
getBinaryStream
- Specified by:
getBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
getWarnings
- Specified by:
getWarnings
in interfaceResultSet
- Throws:
SQLException
-
clearWarnings
- Specified by:
clearWarnings
in interfaceResultSet
- Throws:
SQLException
-
addWarning
-
getCursorName
- Specified by:
getCursorName
in interfaceResultSet
- Throws:
SQLException
-
getObject
- Specified by:
getObject
in interfaceResultSet
- Throws:
SQLException
-
getObject
- Specified by:
getObject
in interfaceResultSet
- Throws:
SQLException
-
findColumn
- Specified by:
findColumn
in interfaceResultSet
- Throws:
SQLException
-
createColumnNameIndexMap
-
findColumnIndex
-
getColumnOID
public int getColumnOID(int field) Returns the OID of a field. It is used internally by the driver.- Parameters:
field
- field index- Returns:
- OID of a field
-
getFixedString
This is used to fix get*() methods on Money fields. It should only be used by those methods!
It converts ($##.##) to -##.## and $##.## to ##.##
- Parameters:
col
- column position (1-based)- Returns:
- numeric-parsable representation of money string literal
- Throws:
SQLException
- if something wrong happens
-
trimMoney
-
getPGType
- Throws:
SQLException
-
getSQLType
- Throws:
SQLException
-
initSqlType
- Throws:
SQLException
-
checkUpdateable
- Throws:
SQLException
-
checkClosed
- Throws:
SQLException
-
isResultSetClosed
protected boolean isResultSetClosed() -
checkColumnIndex
- Throws:
SQLException
-
getRawValue
Checks that the result set is not closed, it's positioned on a valid row and that the given column number is valid. Also updates thewasNullFlag
to correct value.- Parameters:
column
- The column number to check. Range starts from 1.- Returns:
- raw value or null
- Throws:
SQLException
- If state or column is invalid.
-
isBinary
protected boolean isBinary(int column) Returns true if the value of the given column is in binary format.- Parameters:
column
- The column to check. Range starts from 1.- Returns:
- True if the column is in binary format.
-
toShort
- Throws:
SQLException
-
toInt
- Throws:
SQLException
-
toLong
- Throws:
SQLException
-
toBigDecimal
- Throws:
SQLException
-
toBigDecimal
- Throws:
SQLException
-
scaleBigDecimal
- Throws:
PSQLException
-
toFloat
- Throws:
SQLException
-
toDouble
- Throws:
SQLException
-
initRowBuffer
private void initRowBuffer() -
isColumnTrimmable
- Throws:
SQLException
-
trimBytes
- Throws:
SQLException
-
trimString
- Throws:
SQLException
-
readDoubleValue
Converts any numeric binary field to double value. This method does no overflow checking.- Parameters:
bytes
- The bytes of the numeric field.oid
- The oid of the field.targetType
- The target type. Used for error reporting.- Returns:
- The value as double.
- Throws:
PSQLException
- If the field type is not supported numeric type.
-
readLongValue
private long readLongValue(byte[] bytes, int oid, long minVal, long maxVal, String targetType) throws PSQLException Converts any numeric binary field to long value.
This method is used by getByte,getShort,getInt and getLong. It must support a subset of the following java types that use Binary encoding. (fields that use text encoding use a different code path).
byte,short,int,long,float,double,BigDecimal,boolean,string
.- Parameters:
bytes
- The bytes of the numeric field.oid
- The oid of the field.minVal
- the minimum value allowed.maxVal
- the maximum value allowed.targetType
- The target type. Used for error reporting.- Returns:
- The value as long.
- Throws:
PSQLException
- If the field type is not supported numeric type or if the value is out of range.
-
updateValue
- Throws:
SQLException
-
getUUID
- Throws:
SQLException
-
getUUID
- Throws:
SQLException
-
addRows
Used to add rows to an already existing ResultSet that exactly match the existing rows. Currently only used for assembling generated keys from batch statement execution. -
updateRef
- Specified by:
updateRef
in interfaceResultSet
- Throws:
SQLException
-
updateRef
- Specified by:
updateRef
in interfaceResultSet
- Throws:
SQLException
-
updateBlob
- Specified by:
updateBlob
in interfaceResultSet
- Throws:
SQLException
-
updateBlob
- Specified by:
updateBlob
in interfaceResultSet
- Throws:
SQLException
-
updateClob
- Specified by:
updateClob
in interfaceResultSet
- Throws:
SQLException
-
updateClob
- Specified by:
updateClob
in interfaceResultSet
- Throws:
SQLException
-
updateArray
- Specified by:
updateArray
in interfaceResultSet
- Throws:
SQLException
-
updateArray
- Specified by:
updateArray
in interfaceResultSet
- Throws:
SQLException
-
getObject
- Specified by:
getObject
in interfaceResultSet
- Throws:
SQLException
-
getObject
- Specified by:
getObject
in interfaceResultSet
- Throws:
SQLException
-
getObject
- Specified by:
getObject
in interfaceResultSet
- Throws:
SQLException
-
getObject
- Specified by:
getObject
in interfaceResultSet
- Throws:
SQLException
-
updateObject
public void updateObject(int columnIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException - Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
updateObject
public void updateObject(String columnLabel, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException - Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
updateObject
- Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
updateObject
- Specified by:
updateObject
in interfaceResultSet
- Throws:
SQLException
-
getRowId
- Specified by:
getRowId
in interfaceResultSet
- Throws:
SQLException
-
getRowId
- Specified by:
getRowId
in interfaceResultSet
- Throws:
SQLException
-
updateRowId
- Specified by:
updateRowId
in interfaceResultSet
- Throws:
SQLException
-
updateRowId
- Specified by:
updateRowId
in interfaceResultSet
- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldability
in interfaceResultSet
- Throws:
SQLException
-
isClosed
- Specified by:
isClosed
in interfaceResultSet
- Throws:
SQLException
-
updateNString
- Specified by:
updateNString
in interfaceResultSet
- Throws:
SQLException
-
updateNString
- Specified by:
updateNString
in interfaceResultSet
- Throws:
SQLException
-
updateNClob
- Specified by:
updateNClob
in interfaceResultSet
- Throws:
SQLException
-
updateNClob
- Specified by:
updateNClob
in interfaceResultSet
- Throws:
SQLException
-
updateNClob
- Specified by:
updateNClob
in interfaceResultSet
- Throws:
SQLException
-
updateNClob
- Specified by:
updateNClob
in interfaceResultSet
- Throws:
SQLException
-
updateNClob
- Specified by:
updateNClob
in interfaceResultSet
- Throws:
SQLException
-
updateNClob
- Specified by:
updateNClob
in interfaceResultSet
- Throws:
SQLException
-
getNClob
- Specified by:
getNClob
in interfaceResultSet
- Throws:
SQLException
-
getNClob
- Specified by:
getNClob
in interfaceResultSet
- Throws:
SQLException
-
updateBlob
- Specified by:
updateBlob
in interfaceResultSet
- Throws:
SQLException
-
updateBlob
- Specified by:
updateBlob
in interfaceResultSet
- Throws:
SQLException
-
updateBlob
- Specified by:
updateBlob
in interfaceResultSet
- Throws:
SQLException
-
updateBlob
- Specified by:
updateBlob
in interfaceResultSet
- Throws:
SQLException
-
updateClob
- Specified by:
updateClob
in interfaceResultSet
- Throws:
SQLException
-
updateClob
- Specified by:
updateClob
in interfaceResultSet
- Throws:
SQLException
-
updateClob
- Specified by:
updateClob
in interfaceResultSet
- Throws:
SQLException
-
updateClob
- Specified by:
updateClob
in interfaceResultSet
- Throws:
SQLException
-
getSQLXML
- Specified by:
getSQLXML
in interfaceResultSet
- Throws:
SQLException
-
getSQLXML
- Specified by:
getSQLXML
in interfaceResultSet
- Throws:
SQLException
-
updateSQLXML
- Specified by:
updateSQLXML
in interfaceResultSet
- Throws:
SQLException
-
updateSQLXML
- Specified by:
updateSQLXML
in interfaceResultSet
- Throws:
SQLException
-
getNString
- Specified by:
getNString
in interfaceResultSet
- Throws:
SQLException
-
getNString
- Specified by:
getNString
in interfaceResultSet
- Throws:
SQLException
-
getNCharacterStream
- Specified by:
getNCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
getNCharacterStream
- Specified by:
getNCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateNCharacterStream
- Throws:
SQLException
-
updateNCharacterStream
- Throws:
SQLException
-
updateNCharacterStream
- Specified by:
updateNCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateNCharacterStream
- Specified by:
updateNCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateNCharacterStream
- Specified by:
updateNCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateNCharacterStream
- Specified by:
updateNCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateCharacterStream
- Specified by:
updateCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateCharacterStream
public void updateCharacterStream(String columnName, Reader reader, long length) throws SQLException - Specified by:
updateCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateCharacterStream
- Specified by:
updateCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateCharacterStream
- Specified by:
updateCharacterStream
in interfaceResultSet
- Throws:
SQLException
-
updateBinaryStream
public void updateBinaryStream(int columnIndex, InputStream inputStream, long length) throws SQLException - Specified by:
updateBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
updateBinaryStream
public void updateBinaryStream(String columnName, InputStream inputStream, long length) throws SQLException - Specified by:
updateBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
updateBinaryStream
- Specified by:
updateBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
updateBinaryStream
- Specified by:
updateBinaryStream
in interfaceResultSet
- Throws:
SQLException
-
updateAsciiStream
public void updateAsciiStream(int columnIndex, InputStream inputStream, long length) throws SQLException - Specified by:
updateAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
updateAsciiStream
public void updateAsciiStream(String columnName, InputStream inputStream, long length) throws SQLException - Specified by:
updateAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
updateAsciiStream
- Specified by:
updateAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
updateAsciiStream
- Specified by:
updateAsciiStream
in interfaceResultSet
- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperFor
in interfaceWrapper
- Throws:
SQLException
-
unwrap
- Specified by:
unwrap
in interfaceWrapper
- Throws:
SQLException
-
getDefaultCalendar
-
getTimestampUtils
-
upperCaseFieldLabels
This is here to be used by metadata functions to make all column labels upper case. Because postgres folds columns to lower case in queries it will be easier to change the fields after the fact rather than try to coerce all the columns to upper case in the queries as this would require surrounding all columns with " and escaping them making them even harder to read than they are now.- Returns:
- PgResultSet
-