Package com.onenetwork.platform.data.sql
Class SqlRow
java.lang.Object
com.onenetwork.platform.data.sql.SqlRow
- All Implemented Interfaces:
com.onenetwork.platform.data.sql.impl.QueryResult
public class SqlRow
extends java.lang.Object
implements com.onenetwork.platform.data.sql.impl.QueryResult
Contains the result of a query executed through
SqlService
.
When accessing primitive methods like getIntValue(String)
, one should call
isNull(String)
first.
Use of String-based getters is strongly recommended. When index-based access is required,
Similar to ResultSet
, SqlRow's indexed getters start counting from one, not zero.-
Nested Class Summary
-
Constructor Summary
Constructors Constructor Description SqlRow()
-
Method Summary
Modifier and Type Method Description void
addValue(java.lang.Object value)
Add value to row (the value is assumed to conform with the metadata for the row)boolean
getBooleanValue(int index)
Returns the boolean value for the given column index.boolean
getBooleanValue(int index, boolean defaultVal)
LikegetBooleanValue(int)
but returns defaultVal if actual value is null.boolean
getBooleanValue(java.lang.String columnName)
Returns the boolean value for the given column name.boolean
getBooleanValue(java.lang.String columnName, boolean defaultVal)
LikegetBooleanValue(String)
but returns defaultVal if actual value is null.byte[]
getBytesValue(int index)
Returns the byte array value for the given column index.byte[]
getBytesValue(int index, byte[] defaultVal)
LikegetBytesValue(int)
but returns defaultVal if actual value is null.byte[]
getBytesValue(java.lang.String columnName)
Returns the byte array value for the given column name.byte[]
getBytesValue(java.lang.String columnName, byte[] defaultVal)
LikegetBytesValue(String)
but returns defaultVal if actual value is null.byte
getByteValue(int index)
Returns the byte value for the given column index.byte
getByteValue(int index, byte defaultVal)
LikegetByteValue(int)
but returns defaultVal if actual value is null.byte
getByteValue(java.lang.String columnName)
Returns the byte value for the given column name.byte
getByteValue(java.lang.String columnName, byte defaultVal)
LikegetByteValue(String)
but returns defaultVal if actual value is null.java.io.Reader
getCharacterStreamValue(int index)
Returns the character Reader value for the given column index.java.io.Reader
getCharacterStreamValue(int index, java.io.Reader defaultVal)
LikegetCharacterStreamValue(int)
but returns defaultVal if actual value is null.java.io.Reader
getCharacterStreamValue(java.lang.String columnName)
Returns the character Reader value for the given column name.java.io.Reader
getCharacterStreamValue(java.lang.String columnName, java.io.Reader defaultVal)
LikegetCharacterStreamValue(String)
but returns defaultVal if actual value is null.int
getColumnCount()
Returns the total number of columnns in the rowdouble
getDoubleValue(int index)
Returns the double value for the given column index.double
getDoubleValue(int index, double defaultVal)
LikegetDoubleValue(int)
but returns defaultVal if actual value is null.double
getDoubleValue(java.lang.String columnName)
Returns the double value for the given column name.double
getDoubleValue(java.lang.String columnName, double defaultVal)
LikegetDoubleValue(String)
but returns defaultVal if actual value is null.float
getFloatValue(int index)
Returns the float value for the given column index.float
getFloatValue(int index, float defaultVal)
LikegetFloatValue(int)
but returns defaultVal if actual value is null.float
getFloatValue(java.lang.String columnName)
Returns the float value for the given column name.float
getFloatValue(java.lang.String columnName, float defaultVal)
LikegetFloatValue(String)
but returns defaultVal if actual value is null.int
getIntValue(int index)
Returns the int value for the given column index.int
getIntValue(int index, int defaultVal)
LikegetIntValue(int)
but returns defaultVal if actual value is null.int
getIntValue(java.lang.String columnName)
Returns the int value for the given column name.int
getIntValue(java.lang.String columnName, int defaultVal)
LikegetIntValue(String)
but returns defaultVal if actual value is null.int
getLength()
long
getLongValue(int index)
Returns the long value for the given column index.long
getLongValue(int index, long defaultVal)
LikegetLongValue(int)
but returns defaultVal if actual value is null.long
getLongValue(java.lang.String columnName)
Returns the long value for the given column name.long
getLongValue(java.lang.String columnName, long defaultVal)
LikegetLongValue(String)
but returns defaultVal if actual value is null.java.lang.Number
getNumericValue(int index, java.lang.Class<? extends java.lang.Number> numericClass)
Returns the value for the given column index (may be null) as aNumber
.java.lang.Number
getNumericValue(int index, java.lang.Class<? extends java.lang.Number> numericClass, java.lang.Number defaultVal)
LikegetNumericValue(int, Class)
but returns defaultVal if actual value is null.short
getShortValue(int index)
Returns the short value for the given column index.short
getShortValue(int index, short defaultVal)
LikegetShortValue(int)
but returns defaultVal if actual value is null.short
getShortValue(java.lang.String columnName)
Returns the short value for the given column name.short
getShortValue(java.lang.String columnName, short defaultVal)
LikegetShortValue(String)
but returns defaultVal if actual value is null.SqlResultMeta
getSqlResultMeta()
java.lang.String
getStringValue(int index)
Returns the String value for the given column index (may be null)java.lang.String
getStringValue(int index, java.lang.String defaultVal)
LikegetStringValue(int)
but returns defaultVal if actual value is null.java.lang.String
getStringValue(java.lang.String columnName)
Returns the String value for the given column name (may be null)java.lang.String
getStringValue(java.lang.String columnName, java.lang.String defaultVal)
LikegetStringValue(String)
but returns defaultVal if actual value is null.java.sql.Timestamp
getTimestampUTCValue(int index)
Deprecated.This method currently just callsgetTimestampValue(int)
, it is not intended to be used.java.sql.Timestamp
getTimestampUTCValue(int index, java.sql.Timestamp defaultVal)
Deprecated.LikegetTimestampUTCValue(int)
but returns defaultVal if actual value is null.java.sql.Timestamp
getTimestampUTCValue(java.lang.String columnName)
Deprecated.This method currently just callsgetTimestampValue(String)
, it is not intended to be used.java.sql.Timestamp
getTimestampUTCValue(java.lang.String columnName, java.sql.Timestamp defaultVal)
Deprecated.LikegetTimestampUTCValue(String)
but returns defaultVal if actual value is null.java.sql.Timestamp
getTimestampValue(int index)
Returns the Timestamp value for the given column index.java.sql.Timestamp
getTimestampValue(int index, java.sql.Timestamp defaultVal)
LikegetTimestampValue(int)
but returns defaultVal if actual value is null.java.sql.Timestamp
getTimestampValue(java.lang.String columnName)
Returns the Timestamp value for the given column name.java.sql.Timestamp
getTimestampValue(java.lang.String columnName, java.sql.Timestamp defaultVal)
LikegetTimestampValue(String)
but returns defaultVal if actual value is null.java.lang.Object
getValue(int index)
Returns the value for the given column index (may be null)java.lang.Object
getValue(int index, java.lang.Object defaultVal)
LikegetValue(int)
but returns defaultVal if actual value is null.java.lang.Object
getValue(java.lang.String columnName)
Returns the value for the given column name (may be null)java.lang.Object
getValue(java.lang.String columnName, java.lang.Object defaultVal)
LikegetValue(String)
but returns defaultVal if actual value is null.boolean
isNull(int index)
Returns true iff the value at the given index is null.boolean
isNull(java.lang.String columnName)
Returns true iff the value at the given index is null.com.onenetwork.platform.data.sql.impl.QueryResult.IsNull
isNullValue(int index)
Deprecated.not meant for use by clientscom.onenetwork.platform.data.sql.impl.QueryResult.IsNull
isNullValue(java.lang.String column)
Deprecated.not meant for use by clientsvoid
setSqlResultMeta(SqlResultMeta meta)
Sets the row metadata (describes columns/types)java.lang.String
toString()
boolean
wasNull()
Deprecated.not meant for use by clients
-
Constructor Details
-
SqlRow
public SqlRow()
-
-
Method Details
-
setSqlResultMeta
Sets the row metadata (describes columns/types)- Parameters:
meta
- row metadata
-
getValue
public java.lang.Object getValue(int index, java.lang.Object defaultVal)LikegetValue(int)
but returns defaultVal if actual value is null. -
getValue
public java.lang.Object getValue(int index)Returns the value for the given column index (may be null)- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
isNull
public boolean isNull(int index)Returns true iff the value at the given index is null. Should always be called before calling primitive getters like#getIntValue(index)
.- Parameters:
index
- column index - the first column is 1- Returns:
- true if the value at the given index is null
-
isNull
public boolean isNull(java.lang.String columnName)Returns true iff the value at the given index is null. Should always be called before calling primitive getters like#getIntValue(index)
.- Parameters:
columnName
- column name- Returns:
- true if the value at the given column is null
-
getValue
public java.lang.Object getValue(java.lang.String columnName, java.lang.Object defaultVal)LikegetValue(String)
but returns defaultVal if actual value is null. -
getValue
public java.lang.Object getValue(java.lang.String columnName)Returns the value for the given column name (may be null)- Parameters:
columnName
- column name- Returns:
- value of column
-
getNumericValue
public java.lang.Number getNumericValue(int index, java.lang.Class<? extends java.lang.Number> numericClass, java.lang.Number defaultVal)LikegetNumericValue(int, Class)
but returns defaultVal if actual value is null. -
getNumericValue
public java.lang.Number getNumericValue(int index, java.lang.Class<? extends java.lang.Number> numericClass)Returns the value for the given column index (may be null) as aNumber
. Any underlying numeric type (int, long, short, etc) can use this method.- Parameters:
index
- column index - the first column is 1numericClass
- Number subclass to which the value should be converted- Returns:
- numeric value, converted to the given type
-
getStringValue
public java.lang.String getStringValue(int index, java.lang.String defaultVal)LikegetStringValue(int)
but returns defaultVal if actual value is null. -
getStringValue
public java.lang.String getStringValue(int index)Returns the String value for the given column index (may be null)- Specified by:
getStringValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getStringValue
public java.lang.String getStringValue(java.lang.String columnName, java.lang.String defaultVal)LikegetStringValue(String)
but returns defaultVal if actual value is null. -
getStringValue
public java.lang.String getStringValue(java.lang.String columnName)Returns the String value for the given column name (may be null)- Specified by:
getStringValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getLongValue
public long getLongValue(int index, long defaultVal)LikegetLongValue(int)
but returns defaultVal if actual value is null. -
getLongValue
public long getLongValue(int index)Returns the long value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getLongValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getLongValue
public long getLongValue(java.lang.String columnName, long defaultVal)LikegetLongValue(String)
but returns defaultVal if actual value is null. -
getLongValue
public long getLongValue(java.lang.String columnName)Returns the long value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getLongValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getIntValue
public int getIntValue(int index, int defaultVal)LikegetIntValue(int)
but returns defaultVal if actual value is null. -
getIntValue
public int getIntValue(int index)Returns the int value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getIntValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getIntValue
public int getIntValue(java.lang.String columnName, int defaultVal)LikegetIntValue(String)
but returns defaultVal if actual value is null. -
getIntValue
public int getIntValue(java.lang.String columnName)Returns the int value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getIntValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getByteValue
public byte getByteValue(int index, byte defaultVal)LikegetByteValue(int)
but returns defaultVal if actual value is null. -
getByteValue
public byte getByteValue(int index)Returns the byte value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getByteValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getByteValue
public byte getByteValue(java.lang.String columnName, byte defaultVal)LikegetByteValue(String)
but returns defaultVal if actual value is null. -
getByteValue
public byte getByteValue(java.lang.String columnName)Returns the byte value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getByteValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getShortValue
public short getShortValue(int index, short defaultVal)LikegetShortValue(int)
but returns defaultVal if actual value is null. -
getShortValue
public short getShortValue(int index)Returns the short value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getShortValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getShortValue
public short getShortValue(java.lang.String columnName, short defaultVal)LikegetShortValue(String)
but returns defaultVal if actual value is null. -
getShortValue
public short getShortValue(java.lang.String columnName)Returns the short value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getShortValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getFloatValue
public float getFloatValue(int index, float defaultVal)LikegetFloatValue(int)
but returns defaultVal if actual value is null. -
getFloatValue
public float getFloatValue(int index)Returns the float value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getFloatValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getFloatValue
public float getFloatValue(java.lang.String columnName, float defaultVal)LikegetFloatValue(String)
but returns defaultVal if actual value is null. -
getFloatValue
public float getFloatValue(java.lang.String columnName)Returns the float value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getFloatValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getDoubleValue
public double getDoubleValue(int index, double defaultVal)LikegetDoubleValue(int)
but returns defaultVal if actual value is null. -
getDoubleValue
public double getDoubleValue(int index)Returns the double value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getDoubleValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getDoubleValue
public double getDoubleValue(java.lang.String columnName, double defaultVal)LikegetDoubleValue(String)
but returns defaultVal if actual value is null. -
getDoubleValue
public double getDoubleValue(java.lang.String columnName)Returns the double value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getDoubleValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getTimestampValue
public java.sql.Timestamp getTimestampValue(int index, java.sql.Timestamp defaultVal)LikegetTimestampValue(int)
but returns defaultVal if actual value is null. -
getTimestampValue
public java.sql.Timestamp getTimestampValue(int index)Returns the Timestamp value for the given column index.- Specified by:
getTimestampValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getTimestampUTCValue
public java.sql.Timestamp getTimestampUTCValue(int index, java.sql.Timestamp defaultVal)Deprecated.LikegetTimestampUTCValue(int)
but returns defaultVal if actual value is null. -
getTimestampUTCValue
public java.sql.Timestamp getTimestampUTCValue(int index)Deprecated.This method currently just callsgetTimestampValue(int)
, it is not intended to be used.- Specified by:
getTimestampUTCValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
-
getTimestampValue
public java.sql.Timestamp getTimestampValue(java.lang.String columnName, java.sql.Timestamp defaultVal)LikegetTimestampValue(String)
but returns defaultVal if actual value is null. -
getTimestampValue
public java.sql.Timestamp getTimestampValue(java.lang.String columnName)Returns the Timestamp value for the given column name.- Specified by:
getTimestampValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getTimestampUTCValue
public java.sql.Timestamp getTimestampUTCValue(java.lang.String columnName, java.sql.Timestamp defaultVal)Deprecated.LikegetTimestampUTCValue(String)
but returns defaultVal if actual value is null. -
getTimestampUTCValue
public java.sql.Timestamp getTimestampUTCValue(java.lang.String columnName)Deprecated.This method currently just callsgetTimestampValue(String)
, it is not intended to be used.- Specified by:
getTimestampUTCValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
-
getBooleanValue
public boolean getBooleanValue(int index, boolean defaultVal)LikegetBooleanValue(int)
but returns defaultVal if actual value is null. -
getBooleanValue
public boolean getBooleanValue(int index)Returns the boolean value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getBooleanValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getBooleanValue
public boolean getBooleanValue(java.lang.String columnName, boolean defaultVal)LikegetBooleanValue(String)
but returns defaultVal if actual value is null. -
getBooleanValue
public boolean getBooleanValue(java.lang.String columnName)Returns the boolean value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getBooleanValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
addValue
public void addValue(java.lang.Object value)Add value to row (the value is assumed to conform with the metadata for the row)- Parameters:
value
- value to add at end of list
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getBytesValue
public byte[] getBytesValue(int index, byte[] defaultVal)LikegetBytesValue(int)
but returns defaultVal if actual value is null. -
getBytesValue
public byte[] getBytesValue(int index)Returns the byte array value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getBytesValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getCharacterStreamValue
public java.io.Reader getCharacterStreamValue(int index, java.io.Reader defaultVal)LikegetCharacterStreamValue(int)
but returns defaultVal if actual value is null. -
getCharacterStreamValue
public java.io.Reader getCharacterStreamValue(int index)Returns the character Reader value for the given column index. Client should first callisNull(int)
to see if the value is null.- Specified by:
getCharacterStreamValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
index
- column index - the first column is 1- Returns:
- value at index
-
getBytesValue
public byte[] getBytesValue(java.lang.String columnName, byte[] defaultVal)LikegetBytesValue(String)
but returns defaultVal if actual value is null. -
getBytesValue
public byte[] getBytesValue(java.lang.String columnName)Returns the byte array value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getBytesValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
getCharacterStreamValue
public java.io.Reader getCharacterStreamValue(java.lang.String columnName, java.io.Reader defaultVal)LikegetCharacterStreamValue(String)
but returns defaultVal if actual value is null. -
getCharacterStreamValue
public java.io.Reader getCharacterStreamValue(java.lang.String columnName)Returns the character Reader value for the given column name. Client should first callisNull(String)
to see if the value is null.- Specified by:
getCharacterStreamValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
- Parameters:
columnName
- column name- Returns:
- value for column
-
wasNull
public boolean wasNull()Deprecated.not meant for use by clients- Specified by:
wasNull
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
-
isNullValue
public com.onenetwork.platform.data.sql.impl.QueryResult.IsNull isNullValue(int index)Deprecated.not meant for use by clients- Specified by:
isNullValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
-
isNullValue
public com.onenetwork.platform.data.sql.impl.QueryResult.IsNull isNullValue(java.lang.String column)Deprecated.not meant for use by clients- Specified by:
isNullValue
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
-
getColumnCount
public int getColumnCount()Returns the total number of columnns in the row- Specified by:
getColumnCount
in interfacecom.onenetwork.platform.data.sql.impl.QueryResult
-
getSqlResultMeta
- Returns:
- result meta-data, including column-to-index mapping
-
getLength
public int getLength()- Returns:
- the number of columns in the row
-