|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectgeneralDatabase.pamCursor.PamCursor
public abstract class PamCursor
Class to generate Cursors for databases which can directly support scrollable cursors and ones which cannot.
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| Field Summary | |
|---|---|
private java.sql.Connection |
currentConnection
|
private java.sql.PreparedStatement |
preparedInsertStatement
|
private java.sql.PreparedStatement |
preparedUpdateStatement
|
private EmptyTableDefinition |
tableDefinition
|
| Constructor Summary | |
|---|---|
PamCursor(EmptyTableDefinition tableDefinition)
|
|
| Method Summary | |
|---|---|
abstract boolean |
absolute(int row)
Go t0 an absolute row number |
abstract void |
afterLast()
|
abstract void |
beforeFirst()
|
abstract void |
close()
|
private void |
closeCursors()
|
abstract boolean |
closeScrollableCursor()
Close the scrollable cursor. |
abstract void |
deleteRow()
|
protected void |
finalize()
|
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()
|
abstract int |
getInt(int columnIndex)
|
(package private) abstract int |
getLastDatabaseIndex(java.sql.Connection connection,
java.sql.PreparedStatement preparedInsertStatement)
Gets called from ImmediateInsert to get the last database index using a couple of alternate methods. |
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(boolean includeKeys,
boolean includeCounters,
boolean orderById)
Generate a standard SQL select string for everything in the table. |
java.lang.String |
getSelectString(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()
|
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 |
private boolean |
prepareUpdateStatement(java.sql.Connection connection)
Prepare a prepared update statement for the cursor which can be reused so long as the connection doesn't change. |
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)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private EmptyTableDefinition tableDefinition
private java.sql.Connection currentConnection
private java.sql.PreparedStatement preparedInsertStatement
private java.sql.PreparedStatement preparedUpdateStatement
| Constructor Detail |
|---|
public PamCursor(EmptyTableDefinition tableDefinition)
| Method Detail |
|---|
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic EmptyTableDefinition getTableDefinition()
public java.sql.Connection getCurrentConnection()
public void setCurrentConnection(java.sql.Connection currentConnection)
public java.lang.String getSelectString(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 string
public java.lang.String getUpdateString()
public java.lang.String getInsertString()
public java.lang.String getSelectString(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 query
public void moveDataToCursor(boolean includeCounters)
throws java.sql.SQLException
includeCounters - counters are included in the query
java.sql.SQLException
public void moveDataToTableDef(boolean includeCounters)
throws java.sql.SQLException
includeCounters - include counter data
java.sql.SQLExceptionpublic int immediateInsert(java.sql.Connection connection)
Primarily used in real time data collection, called from SQLLogging.
connection - Database connection
private boolean prepareUpdateStatement(java.sql.Connection connection)
connection - database connection
public boolean immediateUpdate(java.sql.Connection connection)
Use a single parameterised cursor statement.
connection -
abstract int getLastDatabaseIndex(java.sql.Connection connection,
java.sql.PreparedStatement preparedInsertStatement)
connection - preparedInsertStatement -
private void closeCursors()
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 number
public 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||