public abstract class PamCursor
extends java.lang.Object
This will directly implement a lot of the functions of the ResultSet interface, but not all of them - life is too short. It will however use the same names and behave in the same way.
NonScrollablePamCursor
,
ScrollablePamCursor
Constructor and Description |
---|
PamCursor(EmptyTableDefinition tableDefinition) |
Modifier and Type | Method and Description |
---|---|
abstract boolean |
absolute(int row)
Go t0 an absolute row number
|
abstract void |
afterLast() |
abstract void |
beforeFirst() |
abstract void |
close() |
abstract boolean |
closeScrollableCursor()
Close the scrollable cursor.
|
abstract void |
deleteRow() |
abstract int |
findColumn(java.lang.String columnLabel) |
abstract boolean |
first() |
abstract boolean |
getBoolean(int columnIndex) |
abstract byte |
getByte(int columnIndex) |
java.sql.Connection |
getCurrentConnection() |
abstract java.sql.Date |
getDate(int columnIndex) |
abstract java.sql.Date |
getDate(int columnIndex,
java.util.Calendar cal) |
abstract double |
getDouble(int columnIndex) |
abstract float |
getFloat(int columnIndex) |
java.lang.String |
getInsertString(SQLTypes sqlTypes) |
abstract int |
getInt(int columnIndex) |
abstract long |
getLong(int columnIndex) |
abstract java.lang.Object |
getObject(int columnIndex) |
abstract int |
getRow()
Retrieves the current row number.
|
abstract java.sql.RowId |
getRowId(int columnIndex) |
java.lang.String |
getSelectString(SQLTypes sqlTypes,
boolean includeKeys,
boolean includeCounters,
boolean orderById)
Generate a standard SQL select string for everything in the
table.
|
java.lang.String |
getSelectString(SQLTypes sqlTypes,
boolean includeKeys,
boolean includeCounters,
java.lang.String clause)
Generate an SQL select string with an optional clause which
may include WHERE and ORDER
|
abstract java.lang.String |
getString(int columnIndex) |
EmptyTableDefinition |
getTableDefinition() |
abstract java.sql.Time |
getTime(int columnIndex) |
abstract java.sql.Timestamp |
getTimestamp(int columnIndex) |
java.lang.String |
getUpdateString(SQLTypes sqlTypes) |
int |
immediateInsert(java.sql.Connection connection)
Do an immediate insert of data which should already have
been put into the data objects of the table definition.
|
boolean |
immediateUpdate(java.sql.Connection connection)
Do an immediate update of a single item which already has
it's data in the table definition fields.
|
abstract int |
insertRow(boolean getIndex)
Insert row statement
|
abstract boolean |
isAfterLast() |
abstract boolean |
isBeforeFirst() |
abstract boolean |
isClosed() |
abstract boolean |
isFirst() |
abstract boolean |
isLast() |
abstract boolean |
last() |
void |
moveDataToCursor(boolean includeCounters)
Move data from the table definition down to the cursor
|
void |
moveDataToTableDef(boolean includeCounters)
Move data from the cursor to the table definition
|
abstract void |
moveToCurrentRow() |
abstract void |
moveToInsertRow() |
abstract boolean |
next() |
boolean |
openInsertCursor(java.sql.Connection connection)
Open a cursor for inserting data using a non-scrollable cursor.
|
java.sql.ResultSet |
openReadOnlyCursor(java.sql.Connection connection,
java.lang.String clause) |
abstract boolean |
openScrollableCursor(java.sql.Connection connection,
boolean includeKeys,
boolean includeCounters,
java.lang.String clause)
Open a scrollable cursor
|
abstract boolean |
previous() |
abstract void |
refreshRow() |
abstract boolean |
rowDeleted() |
abstract boolean |
rowInserted() |
abstract boolean |
rowUpdated() |
void |
setCurrentConnection(java.sql.Connection currentConnection) |
abstract void |
updateBoolean(int columnIndex,
boolean x) |
abstract void |
updateByte(int columnIndex,
byte x) |
abstract boolean |
updateDatabase()
Push everything down onto the database
|
abstract void |
updateInt(int columnIndex,
int x) |
abstract void |
updateLong(int columnIndex,
long x) |
abstract void |
updateNull(int columnIndex) |
abstract void |
updateObject(int columnIndex,
java.lang.Object x) |
abstract void |
updateRow() |
abstract void |
updateShort(int columnIndex,
short x) |
abstract void |
updateString(int columnIndex,
java.lang.String x) |
abstract void |
updateTimestamp(int columnIndex,
java.sql.Timestamp x) |
public PamCursor(EmptyTableDefinition tableDefinition)
public EmptyTableDefinition getTableDefinition()
public java.sql.Connection getCurrentConnection()
public void setCurrentConnection(java.sql.Connection currentConnection)
public java.lang.String getSelectString(SQLTypes sqlTypes, boolean includeKeys, boolean includeCounters, boolean orderById)
No ordering of selecting at this stage.
includeKeys
- include items which are primary keys (i.e. the index)includeCounters
- include items which are countersorderById
- add a standard ORDER BY Id at the end of the stringpublic java.lang.String getUpdateString(SQLTypes sqlTypes)
public java.lang.String getInsertString(SQLTypes sqlTypes)
public java.lang.String getSelectString(SQLTypes sqlTypes, boolean includeKeys, boolean includeCounters, java.lang.String clause)
includeKeys
- include items which are primary keys (i.e. the index)includeCounters
- include items which are countersclause
- WHERE ... and ORDER BY clause.public boolean openInsertCursor(java.sql.Connection connection)
These are generally faster than scrollable cursors, so this is in the abstract super class PamCursor. Should for any reason someone convince me that it's better done in a different way for some databases, this function can be easily overridden.
One thing which is more database specific is the way in which index material are retrieved for different database types.
connection
- Database connectionincludeCounters
- include counters in querypublic void moveDataToCursor(boolean includeCounters) throws java.sql.SQLException
includeCounters
- counters are included in the queryjava.sql.SQLException
public void moveDataToTableDef(boolean includeCounters) throws java.sql.SQLException
includeCounters
- include counter datajava.sql.SQLException
public int immediateInsert(java.sql.Connection connection)
Primarily used in real time data collection, called from SQLLogging.
connection
- Database connectionpublic boolean immediateUpdate(java.sql.Connection connection)
Use a single parameterised cursor statement.
connection
- public java.sql.ResultSet openReadOnlyCursor(java.sql.Connection connection, java.lang.String clause)
public abstract boolean openScrollableCursor(java.sql.Connection connection, boolean includeKeys, boolean includeCounters, java.lang.String clause)
connection
- database connectionincludeKeys
- include keysincludeCounters
- inlcude countersclause
- selection and ordering clause.public abstract boolean closeScrollableCursor()
public abstract boolean updateDatabase()
public abstract boolean absolute(int row)
Note that row numbers are 1 indexed.
row
- Row numberpublic abstract void afterLast()
public abstract void beforeFirst()
public abstract void close()
public abstract void deleteRow()
public abstract int findColumn(java.lang.String columnLabel)
public abstract boolean first()
public abstract int getRow() throws java.sql.SQLException
java.sql.SQLException
- if a database error occurspublic abstract java.lang.Object getObject(int columnIndex)
public abstract boolean getBoolean(int columnIndex)
public abstract byte getByte(int columnIndex)
public abstract java.sql.Date getDate(int columnIndex, java.util.Calendar cal)
public abstract java.sql.Date getDate(int columnIndex)
public abstract double getDouble(int columnIndex)
public abstract float getFloat(int columnIndex)
public abstract int getInt(int columnIndex)
public abstract long getLong(int columnIndex)
public abstract java.sql.RowId getRowId(int columnIndex)
public abstract java.lang.String getString(int columnIndex)
public abstract java.sql.Time getTime(int columnIndex)
public abstract java.sql.Timestamp getTimestamp(int columnIndex)
public abstract boolean isAfterLast()
public abstract boolean isBeforeFirst()
public abstract boolean isClosed()
public abstract boolean isFirst()
public abstract boolean isLast()
public abstract boolean last()
public abstract void moveToCurrentRow()
public abstract void moveToInsertRow()
public abstract int insertRow(boolean getIndex)
getIndex
- set true if you want to return the new database index.
Otherwise 0 will be returned.public abstract boolean next()
public abstract boolean previous()
public abstract void refreshRow()
public abstract boolean rowDeleted()
public abstract boolean rowInserted()
public abstract boolean rowUpdated()
public abstract void updateObject(int columnIndex, java.lang.Object x) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateBoolean(int columnIndex, boolean x) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateByte(int columnIndex, byte x) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateInt(int columnIndex, int x) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateLong(int columnIndex, long x) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateNull(int columnIndex) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateRow() throws java.sql.SQLException
java.sql.SQLException
public abstract void updateString(int columnIndex, java.lang.String x) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateShort(int columnIndex, short x) throws java.sql.SQLException
java.sql.SQLException
public abstract void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws java.sql.SQLException
java.sql.SQLException