|
|||||||||
| Home >> All >> postgresql >> [ jdbc1 overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
postgresql.jdbc1
Class Statement

java.lang.Objectpostgresql.jdbc1.Statement
- All Implemented Interfaces:
- java.sql.Statement
- Direct Known Subclasses:
- PreparedStatement
- public class Statement
- extends java.lang.Object
- implements java.sql.Statement
- extends java.lang.Object
A Statement object is used for executing a static SQL statement and obtaining the results produced by it.
Only one ResultSet per Statement can be open at any point in time. Therefore, if the reading of one ResultSet is interleaved with the reading of another, each must have been generated by different Statements. All statement execute methods implicitly close a statement's current ResultSet if an open one exists.
| Field Summary | |
(package private) Connection |
connection
|
(package private) boolean |
escapeProcessing
|
(package private) java.sql.ResultSet |
result
|
(package private) int |
timeout
|
(package private) java.sql.SQLWarning |
warnings
|
| Fields inherited from interface java.sql.Statement |
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO |
| Constructor Summary | |
Statement(Connection c)
Constructor for a Statement. |
|
| Method Summary | |
void |
cancel()
Cancel can be used by one thread to cancel a statement that is being executed by another thread. |
void |
clearWarnings()
After this call, getWarnings returns null until a new warning is reported for this Statement. |
void |
close()
In many cases, it is desirable to immediately release a Statement's database and JDBC resources instead of waiting for this to happen when it is automatically closed. |
boolean |
execute(java.lang.String sql)
Execute a SQL statement that may return multiple results. |
java.sql.ResultSet |
executeQuery(java.lang.String sql)
Execute a SQL statement that retruns a single ResultSet |
int |
executeUpdate(java.lang.String sql)
Execute a SQL INSERT, UPDATE or DELETE statement. |
int |
getMaxFieldSize()
The maxFieldSize limit (in bytes) is the maximum amount of data returned for any column value; it only applies to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR columns. |
int |
getMaxRows()
The maxRows limit is set to limit the number of rows that any ResultSet can contain. |
boolean |
getMoreResults()
getMoreResults moves to a Statement's next result. |
int |
getQueryTimeout()
The queryTimeout limit is the number of seconds the driver will wait for a Statement to execute. |
java.sql.ResultSet |
getResultSet()
getResultSet returns the current result as a ResultSet. |
java.lang.String |
getResultStatusString()
Returns the status message from the current Result. |
int |
getUpdateCount()
getUpdateCount returns the current result as an update count, if the result is a ResultSet or there are no more results, -1 is returned. |
java.sql.SQLWarning |
getWarnings()
The first warning reported by calls on this Statement is returned. |
void |
setCursorName(java.lang.String name)
setCursorName defines the SQL cursor name that will be used by subsequent execute methods. |
void |
setEscapeProcessing(boolean enable)
If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. |
void |
setMaxFieldSize(int max)
Sets the maxFieldSize - NOT! - We throw an SQLException just to inform them to stop doing this. |
void |
setMaxRows(int max)
Set the maximum number of rows |
void |
setQueryTimeout(int seconds)
Sets the queryTimeout limit |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.sql.Statement |
addBatch, clearBatch, execute, execute, execute, executeBatch, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMoreResults, getResultSetConcurrency, getResultSetHoldability, getResultSetType, setFetchDirection, setFetchSize |
| Field Detail |
connection
Connection connection
result
java.sql.ResultSet result
warnings
java.sql.SQLWarning warnings
timeout
int timeout
escapeProcessing
boolean escapeProcessing
| Constructor Detail |
Statement
public Statement(Connection c)
- Constructor for a Statement. It simply sets the connection
that created us.
| Method Detail |
executeQuery
public java.sql.ResultSet executeQuery(java.lang.String sql) throws java.sql.SQLException
- Execute a SQL statement that retruns a single ResultSet
- Specified by:
executeQueryin interfacejava.sql.Statement
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException
- Execute a SQL INSERT, UPDATE or DELETE statement. In addition
SQL statements that return nothing such as SQL DDL statements
can be executed
- Specified by:
executeUpdatein interfacejava.sql.Statement
close
public void close()
throws java.sql.SQLException
- In many cases, it is desirable to immediately release a
Statement's database and JDBC resources instead of waiting
for this to happen when it is automatically closed. The
close method provides this immediate release.
Note: A Statement is automatically closed when it is garbage collected. When a Statement is closed, its current ResultSet, if one exists, is also closed.
- Specified by:
closein interfacejava.sql.Statement
getMaxFieldSize
public int getMaxFieldSize()
throws java.sql.SQLException
- The maxFieldSize limit (in bytes) is the maximum amount of
data returned for any column value; it only applies to
BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR
columns. If the limit is exceeded, the excess data is silently
discarded.
- Specified by:
getMaxFieldSizein interfacejava.sql.Statement
setMaxFieldSize
public void setMaxFieldSize(int max)
throws java.sql.SQLException
- Sets the maxFieldSize - NOT! - We throw an SQLException just
to inform them to stop doing this.
- Specified by:
setMaxFieldSizein interfacejava.sql.Statement
getMaxRows
public int getMaxRows()
throws java.sql.SQLException
- The maxRows limit is set to limit the number of rows that
any ResultSet can contain. If the limit is exceeded, the
excess rows are silently dropped.
- Specified by:
getMaxRowsin interfacejava.sql.Statement
setMaxRows
public void setMaxRows(int max)
throws java.sql.SQLException
- Set the maximum number of rows
- Specified by:
setMaxRowsin interfacejava.sql.Statement
setEscapeProcessing
public void setEscapeProcessing(boolean enable)
throws java.sql.SQLException
- If escape scanning is on (the default), the driver will do escape
substitution before sending the SQL to the database.
- Specified by:
setEscapeProcessingin interfacejava.sql.Statement
getQueryTimeout
public int getQueryTimeout()
throws java.sql.SQLException
- The queryTimeout limit is the number of seconds the driver
will wait for a Statement to execute. If the limit is
exceeded, a SQLException is thrown.
- Specified by:
getQueryTimeoutin interfacejava.sql.Statement
setQueryTimeout
public void setQueryTimeout(int seconds)
throws java.sql.SQLException
- Sets the queryTimeout limit
- Specified by:
setQueryTimeoutin interfacejava.sql.Statement
cancel
public void cancel()
throws java.sql.SQLException
- Cancel can be used by one thread to cancel a statement that
is being executed by another thread. However, PostgreSQL is
a sync. sort of thing, so this really has no meaning - we
define it as a no-op (i.e. you can't cancel, but there is no
error if you try.)
6.4 introduced a cancel operation, but we have not implemented it
yet. Sometime before 6.5, this method will be implemented.
- Specified by:
cancelin interfacejava.sql.Statement
getWarnings
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
- The first warning reported by calls on this Statement is
returned. A Statement's execute methods clear its SQLWarning
chain. Subsequent Statement warnings will be chained to this
SQLWarning.
The Warning chain is automatically cleared each time a statement is (re)executed.
Note: If you are processing a ResultSet then any warnings associated with ResultSet reads will be chained on the ResultSet object.
- Specified by:
getWarningsin interfacejava.sql.Statement
clearWarnings
public void clearWarnings()
throws java.sql.SQLException
- After this call, getWarnings returns null until a new warning
is reported for this Statement.
- Specified by:
clearWarningsin interfacejava.sql.Statement
setCursorName
public void setCursorName(java.lang.String name) throws java.sql.SQLException
- setCursorName defines the SQL cursor name that will be used by
subsequent execute methods. This name can then be used in SQL
positioned update/delete statements to identify the current row
in the ResultSet generated by this statement. If a database
doesn't support positioned update/delete, this method is a
no-op.
Note: By definition, positioned update/delete execution must be done by a different Statement than the one which generated the ResultSet being used for positioning. Also, cursor names must be unique within a Connection.
We throw an additional constriction. There can only be one cursor active at any one time.
- Specified by:
setCursorNamein interfacejava.sql.Statement
execute
public boolean execute(java.lang.String sql) throws java.sql.SQLException
- Execute a SQL statement that may return multiple results. We
don't have to worry about this since we do not support multiple
ResultSets. You can use getResultSet or getUpdateCount to
retrieve the result.
- Specified by:
executein interfacejava.sql.Statement
getResultSet
public java.sql.ResultSet getResultSet() throws java.sql.SQLException
- getResultSet returns the current result as a ResultSet. It
should only be called once per result.
- Specified by:
getResultSetin interfacejava.sql.Statement
getUpdateCount
public int getUpdateCount()
throws java.sql.SQLException
- getUpdateCount returns the current result as an update count,
if the result is a ResultSet or there are no more results, -1
is returned. It should only be called once per result.
- Specified by:
getUpdateCountin interfacejava.sql.Statement
getMoreResults
public boolean getMoreResults()
throws java.sql.SQLException
- getMoreResults moves to a Statement's next result. If it returns
true, this result is a ResulSet.
- Specified by:
getMoreResultsin interfacejava.sql.Statement
getResultStatusString
public java.lang.String getResultStatusString()
- Returns the status message from the current Result.
This is used internally by the driver.
|
|||||||||
| Home >> All >> postgresql >> [ jdbc1 overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
postgresql.jdbc1.Statement