Java Doc for DBStatement.java in  » J2EE » Sofia » com » salmonllc » sql » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Sofia » com.salmonllc.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.salmonllc.sql.DBStatement

DBStatement
public class DBStatement implements Statement(Code)
This class serves as a wrapper around the standard java.sql.Statement. It behaves in the same way, except SQL Statements are written to the framework log file.


Field Summary
 DBConnection_conn
    
 Statement_st
    

Constructor Summary
 DBStatement(Statement st, DBConnection conn)
     Creates a new DBStatement.

Method Summary
public  voidaddBatch(String sql)
     JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement.
public  voidcancel()
     Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.
public  voidclearBatch()
     JDBC 2.0 Makes the set of commands in the current batch empty.
public  voidclearWarnings()
     Clears all the warnings reported on this Statement object.
public  voidclose()
     Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
public  booleanexecute(String sql)
     Executes a SQL statement that may return multiple results.
public  booleanexecute(String sql, int autoGeneratedKeys)
     Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval.
public  booleanexecute(String sql, int[] columnIndexes)
     Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
public  booleanexecute(String sql, String[] columnNames)
     Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
public  int[]executeBatch()
     JDBC 2.0Submits a batch of commands to the database for execution.
public  ResultSetexecuteQuery(String sql)
     Executes a SQL statement that returns a single ResultSet.
public  intexecuteUpdate(String sql)
     Executes an SQL INSERT, UPDATE or DELETE statement.
public  intexecuteUpdate(String sql, int autoGeneratedKeys)
     Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval. This will compile in JDK 1.3 and 1.4.
public  intexecuteUpdate(String sql, int[] columnIndexes)
     Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
public  intexecuteUpdate(String sql, String[] columnNames)
     Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval.
public  ConnectiongetConnection()
    
public  intgetFetchDirection()
     JDBC 2.0 Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object.
public  intgetFetchSize()
     JDBC 2.0 Retrieves the number of result set rows that is the default fetch size for result sets generated from this Statement object.
public  ResultSetgetGeneratedKeys()
     Retrieves any auto-generated keys created as a result of executing this Statement object.
public  intgetMaxFieldSize()
     Returns the maximum number of bytes allowed for any column value.
public  intgetMaxRows()
     Returns the maximum number of bytes allowed for any column value.
public  booleangetMoreResults()
     Moves to a Statement's next result.
public  booleangetMoreResults(int current)
     Moves to this Statement object's next result, returns true if it is a ResultSet object, and implicitly closes any current ResultSet object(s) obtained with the method getResultSet. This will compile in JDK 1.3 and 1.4.
public  intgetQueryTimeout()
     Retrieves the number of seconds the driver will wait for a Statement to execute.
public  ResultSetgetResultSet()
     Returns the current result as a ResultSet object.
public  intgetResultSetConcurrency()
     JDBC 2.0 Retrieves the result set concurrency.
public  intgetResultSetHoldability()
     Retrieves the result set holdability for ResultSet objects generated by this Statement object. either ResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT
exception:
  SQLException - if a database access error occursThis will compile in JDK 1.3 and 1.4.
public  intgetResultSetType()
     JDBC 2.0 Determine the result set type.
public  intgetUpdateCount()
     Returns the current result as an update count; if the result is a ResultSet or there are no more results, -1 is returned.
public  SQLWarninggetWarnings()
     Retrieves the first warning reported by calls on this Statement.
public  voidsetCursorName(String name)
     Defines the SQL cursor name that will be used by subsequent Statement execute methods.
public  voidsetEscapeProcessing(boolean enable)
     Sets escape processing on or off.
public  voidsetFetchDirection(int direction)
     JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed.
public  voidsetFetchSize(int rows)
     JDBC 2.0 Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed.
public  voidsetMaxFieldSize(int max)
     Sets the limit for the maximum number of bytes in a column to the given number of bytes.
public  voidsetMaxRows(int max)
     Retrieves the maximum number of rows that a ResultSet can contain.
public  voidsetQueryTimeout(int seconds)
     Retrieves the number of seconds the driver will wait for a Statement to execute.

Field Detail
_conn
DBConnection _conn(Code)



_st
Statement _st(Code)




Constructor Detail
DBStatement
DBStatement(Statement st, DBConnection conn)(Code)
Creates a new DBStatement.




Method Detail
addBatch
public void addBatch(String sql) throws SQLException(Code)
JDBC 2.0 Adds a SQL command to the current batch of commmands for the statement. This method is optional.
Parameters:
  sql - typically this is a static SQL INSERT or UPDATE statement
exception:
  SQLException - if a database access error occurs, or thedriver does not support batch statements



cancel
public void cancel() throws SQLException(Code)
Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.



clearBatch
public void clearBatch() throws SQLException(Code)
JDBC 2.0 Makes the set of commands in the current batch empty.



clearWarnings
public void clearWarnings() throws SQLException(Code)
Clears all the warnings reported on this Statement object.



close
public void close() throws SQLException(Code)
Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.



execute
public boolean execute(String sql) throws SQLException(Code)
Executes a SQL statement that may return multiple results.



execute
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException(Code)
Executes the given SQL statement, which may return multiple results, and signals the driver that any auto-generated keys should be made available for retrieval. The driver will ignore this signal if the SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s). This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters:
  sql - any SQL statement
Parameters:
  autoGeneratedKeys - a constant indicating whether auto-generatedkeys should be made available for retrieval using the methodgetGeneratedKeys; one of the following constants:Statement.RETURN_GENERATED_KEYS orStatement.NO_GENERATED_KEYS true if the first result is a ResultSetobject; false if it is an update count or there areno results
exception:
  SQLException - if a database access error occurs
See Also:   DBStatement.getResultSet
See Also:   DBStatement.getUpdateCount
See Also:   DBStatement.getMoreResults
See Also:   DBStatement.getGeneratedKeys
since:
   1.4




execute
public boolean execute(String sql, int[] columnIndexes) throws SQLException(Code)
Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the indexes of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT statement.

Under some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s). This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters:
  sql - any SQL statement
Parameters:
  columnIndexes - an array of the indexes of the columns in theinserted row that should be made available for retrieval by acall to the method getGeneratedKeys true if the first result is a ResultSetobject; false if it is an update count or thereare no results
exception:
  SQLException - if a database access error occurs
See Also:   DBStatement.getResultSet
See Also:   DBStatement.getUpdateCount
See Also:   DBStatement.getMoreResults
since:
   1.4




execute
public boolean execute(String sql, String[] columnNames) throws SQLException(Code)
Executes the given SQL statement, which may return multiple results, and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. This array contains the names of the columns in the target table that contain the auto-generated keys that should be made available. The driver will ignore the array if the given SQL statement is not an INSERT statement.

In some (uncommon) situations, a single SQL statement may return multiple result sets and/or update counts. Normally you can ignore this unless you are (1) executing a stored procedure that you know may return multiple results or (2) you are dynamically executing an unknown SQL string.

The execute method executes an SQL statement and indicates the form of the first result. You must then use the methods getResultSet or getUpdateCount to retrieve the result, and getMoreResults to move to any subsequent result(s). This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters:
  sql - any SQL statement
Parameters:
  columnNames - an array of the names of the columns in the insertedrow that should be made available for retrieval by a call to themethod getGeneratedKeys true if the next result is a ResultSetobject; false if it is an update count or thereare no more results
exception:
  SQLException - if a database access error occurs
See Also:   DBStatement.getResultSet
See Also:   DBStatement.getUpdateCount
See Also:   DBStatement.getMoreResults
See Also:   DBStatement.getGeneratedKeys
since:
   1.4




executeBatch
public int[] executeBatch() throws SQLException(Code)
JDBC 2.0Submits a batch of commands to the database for execution. This method is optional. an array of update counts containing one element for each command in the batch. The array is ordered according to the order in which commands were inserted into the batch.



executeQuery
public ResultSet executeQuery(String sql) throws SQLException(Code)
Executes a SQL statement that returns a single ResultSet.



executeUpdate
public int executeUpdate(String sql) throws SQLException(Code)
Executes an SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.



executeUpdate
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException(Code)
Executes the given SQL statement and signals the driver with the given flag about whether the auto-generated keys produced by this Statement object should be made available for retrieval. This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters:
  sql - must be an SQL INSERT, UPDATE orDELETE statement or an SQL statement thatreturns nothing
Parameters:
  autoGeneratedKeys - a flag indicating whether auto-generated keysshould be made available for retrieval;one of the following constants:Statement.RETURN_GENERATED_KEYSStatement.NO_GENERATED_KEYS either the row count for INSERT, UPDATEor DELETE statements, or 0 for SQLstatements that return nothing
exception:
  SQLException - if a database access error occurs, the givenSQL statement returns a ResultSet object, orthe given constant is not one of those allowed
since:
   1.4



executeUpdate
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException(Code)
Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement. This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters:
  sql - an SQL INSERT, UPDATE orDELETE statement or an SQL statement that returns nothing,such as an SQL DDL statement
Parameters:
  columnIndexes - an array of column indexes indicating the columnsthat should be returned from the inserted row either the row count for INSERT, UPDATE,or DELETE statements, or 0 for SQL statementsthat return nothing
exception:
  SQLException - if a database access error occurs or the SQLstatement returns a ResultSet object
since:
   1.4



executeUpdate
public int executeUpdate(String sql, String[] columnNames) throws SQLException(Code)
Executes the given SQL statement and signals the driver that the auto-generated keys indicated in the given array should be made available for retrieval. The driver will ignore the array if the SQL statement is not an INSERT statement. This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
Parameters:
  sql - an SQL INSERT, UPDATE orDELETE statement or an SQL statement that returns nothing
Parameters:
  columnNames - an array of the names of the columns that should bereturned from the inserted row either the row count for INSERT, UPDATE,or DELETE statements, or 0 for SQL statementsthat return nothing
exception:
  SQLException - if a database access error occurs
since:
   1.4



getConnection
public Connection getConnection() throws SQLException(Code)
Returns the database connection this is statement is using



getFetchDirection
public int getFetchDirection() throws SQLException(Code)
JDBC 2.0 Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this Statement object. If this Statement object has not set a fetch direction by calling the method setFetchDirection, the return value is implementation-specific. the default fetch direction for result sets generatedfrom this Statement object
exception:
  SQLException - if a database access error occurs



getFetchSize
public int getFetchSize() throws SQLException(Code)
JDBC 2.0 Retrieves the number of result set rows that is the default fetch size for result sets generated from this Statement object. If this Statement object has not set a fetch size by calling the method setFetchSize, the return value is implementation-specific. the default fetch size for result sets generatedfrom this Statement object
exception:
  SQLException - if a database access error occurs



getGeneratedKeys
public ResultSet getGeneratedKeys() throws SQLException(Code)
Retrieves any auto-generated keys created as a result of executing this Statement object. If this Statement object did not generate any keys, an empty ResultSet object is returned. This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM. a ResultSet object containing the auto-generated key(s)generated by the execution of this Statement object
exception:
  SQLException - if a database access error occurs
since:
   1.4



getMaxFieldSize
public int getMaxFieldSize() throws SQLException(Code)
Returns the maximum number of bytes allowed for any column value. This limit is the maximum number of bytes that can be returned for any column value. The limit applies only to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.



getMaxRows
public int getMaxRows() throws SQLException(Code)
Returns the maximum number of bytes allowed for any column value. This limit is the maximum number of bytes that can be returned for any column value. The limit applies only to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.



getMoreResults
public boolean getMoreResults() throws SQLException(Code)
Moves to a Statement's next result. It returns true if this result is a ResultSet. This method also implicitly closes any current ResultSet obtained with getResultSet. There are no more results when (!getMoreResults() && (getUpdateCount() == -1)



getMoreResults
public boolean getMoreResults(int current) throws SQLException(Code)
Moves to this Statement object's next result, returns true if it is a ResultSet object, and implicitly closes any current ResultSet object(s) obtained with the method getResultSet. This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.

There are no more results when the following is true:

 (!getMoreResults() && (getUpdateCount() == -1)
 
true if the next result is a ResultSetobject; false if it is an update count or there areno more results
exception:
  SQLException - if a database access error occurs
See Also:   DBStatement.execute



getQueryTimeout
public int getQueryTimeout() throws SQLException(Code)
Retrieves the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.



getResultSet
public ResultSet getResultSet() throws SQLException(Code)
Returns the current result as a ResultSet object. This method should be called only once per result.



getResultSetConcurrency
public int getResultSetConcurrency() throws java.sql.SQLException(Code)
JDBC 2.0 Retrieves the result set concurrency.



getResultSetHoldability
public int getResultSetHoldability() throws SQLException(Code)
Retrieves the result set holdability for ResultSet objects generated by this Statement object. either ResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT
exception:
  SQLException - if a database access error occursThis will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
since:
   1.4



getResultSetType
public int getResultSetType() throws SQLException(Code)
JDBC 2.0 Determine the result set type.



getUpdateCount
public int getUpdateCount() throws SQLException(Code)
Returns the current result as an update count; if the result is a ResultSet or there are no more results, -1 is returned. This method should be called only once per result.



getWarnings
public SQLWarning getWarnings() throws SQLException(Code)
Retrieves the first warning reported by calls on this Statement. 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, any warnings associated with ResultSet reads will be chained on the ResultSet object.



setCursorName
public void setCursorName(String name) throws SQLException(Code)
Defines the SQL cursor name that will be used by subsequent Statement execute methods.



setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws SQLException(Code)
Sets escape processing on or off. If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. Note: Since prepared statements have usually been parsed prior to making this call, disabling escape processing for prepared statements will have no effect.



setFetchDirection
public void setFetchDirection(int direction) throws SQLException(Code)
JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this Statement object. The default value is ResultSet.FETCH_FORWARD. Note that this method sets the default fetch direction for result sets generated by this Statement object. Each result set has its own methods for getting and setting its own fetch direction.



setFetchSize
public void setFetchSize(int rows) throws SQLException(Code)
JDBC 2.0 Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified affects only result sets created using this statement. If the value specified is zero, then the hint is ignored. The default value is zero.
Parameters:
  rows - the number of rows to fetch
exception:
  SQLException - if a database access error occurs, or thecondition 0 <= rows <= this.getMaxRows() is not satisfied.



setMaxFieldSize
public void setMaxFieldSize(int max) throws SQLException(Code)
Sets the limit for the maximum number of bytes in a column to the given number of bytes. This is the maximum number of bytes that can be returned for any column value. This limit applies only to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. If the limit is exceeded, the excess data is silently discarded. For maximum portability, use values greater than 256.



setMaxRows
public void setMaxRows(int max) throws SQLException(Code)
Retrieves the maximum number of rows that a ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.



setQueryTimeout
public void setQueryTimeout(int seconds) throws SQLException(Code)
Retrieves the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.