|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--org.brains2b.data.cursor.Cursor
|
+--org.brains2b.sql.oracle.cursor.OracleCursor
Overwrite of the Cursor object to add functionality for having queries with parameters.
The sql statement can contain placeholder characters ? signifying a
parameter which can be set at runtime by calling addParameter(index, value). The index
corresponds with the count of the placeholder character in the SQL statement starting at 1
| Field Summary |
| Fields inherited from class org.brains2b.data.cursor.Cursor |
m_con, m_condition, m_from, m_groupBy, m_prep, m_select |
| Constructor Summary | |
OracleCursor()
Deprecated. use OracleCursor(String, String) and OracleCursor(Connection,String,String) |
|
OracleCursor(java.sql.Connection con,
java.lang.String name,
java.lang.String sql)
Constructor for OracleCursor. |
|
OracleCursor(java.lang.String name,
java.lang.String sql)
Constructor for OracleCursor |
|
| Method Summary | |
void |
addParameter(int idx,
int i)
adds a integer value for the given placeholder position in the prepared statement. |
void |
addParameter(int idx,
java.lang.Object o)
adds a value for the given placeholder position in the prepared statement. |
int |
delete(CursorData cdata)
Delete the data represented by the CursorData object from the database. |
java.sql.PreparedStatement |
getPreparedStatement(java.sql.Connection con,
java.lang.String select)
returns a prepared statement build from the prepared query set, the parameters added, the conditions set and the order by supplied. |
void |
reset()
reset this Cursor by removing all previously set parameter values |
java.util.Vector |
select()
Perform a select on the basis of the sql statement defined by this Cursor |
void |
setConnection(java.sql.Connection con)
set the java.sql.Connection to use for this Cursor |
int |
update(CursorData cdata)
Update the data represented by the CursorData object from the database. |
| Methods inherited from class org.brains2b.data.cursor.Cursor |
getNewCursorData, getObject, getProtoType, select, select, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public OracleCursor()
public OracleCursor(java.lang.String name,
java.lang.String sql)
name - String, the name of the cursorsql - String, the SQL-statement to use for this cursor
public OracleCursor(java.sql.Connection con,
java.lang.String name,
java.lang.String sql)
Usually the Connection does not have to be set at initialization, you can use setConnection(Connection)
con - java.sql.Connection, the JDBC connection to use for this Cursorname - String, the name of the cursorsql - String, the SQL-statement to use for this cursor| Method Detail |
public java.util.Vector select()
throws java.lang.Exception
Cursor
select in class Cursorjava.lang.Exception - thrown if the database delivers an Exception
public int update(CursorData cdata)
throws java.lang.Exception
Cursor
update in class Cursorcdata - CursorData, an object containing the results for the cursor
java.lang.Exception
public int delete(CursorData cdata)
throws java.lang.Exception
Cursor
delete in class Cursorcdata - CursorData, an object containing the results for the cursor
java.lang.Exception
public void addParameter(int idx,
int i)
idx - int, the placeholder positioni - int, The value to set in the prepared statement
public void addParameter(int idx,
java.lang.Object o)
idx - int, the placeholder positiono - Object, the value to set in the prepared statement.public void reset()
addParameter(int, int),
addParameter(int, Object)
public java.sql.PreparedStatement getPreparedStatement(java.sql.Connection con,
java.lang.String select)
throws java.sql.SQLException
If a prepared query has placeholders, the addParameters must be called for every placeholder supplied.
con - Connection, the connection for which to prepare the query
SQLException, - throws the Exception if generated by the prepareStatement
command in java.sql.Connection()
java.sql.SQLExceptionjava.sql.Connection(),
PreparedStatementpublic void setConnection(java.sql.Connection con)
java.sql.Connection to use for this Cursor
con - java.sql.Connection
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||