Java Doc for JtdsPreparedStatement.java in  » Database-JDBC-Connection-Pool » jTDS » net » sourceforge » jtds » jdbc » 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 » Database JDBC Connection Pool » jTDS » net.sourceforge.jtds.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   net.sourceforge.jtds.jdbc.JtdsStatement
      net.sourceforge.jtds.jdbc.JtdsPreparedStatement

All known Subclasses:   net.sourceforge.jtds.jdbc.JtdsCallableStatement,
JtdsPreparedStatement
public class JtdsPreparedStatement extends JtdsStatement implements PreparedStatement(Code)
jTDS implementation of the java.sql.PreparedStatement interface.

Implementation notes:

  1. Generally a simple subclass of Statement mainly adding support for the setting of parameters.
  2. The stream logic is taken over from the work Brian did to add Blob support to the original jTDS.
  3. Use of Statement specific method calls eg executeQuery(sql) is blocked by this version of the driver. This is unlike the original jTDS but inline with all the other JDBC drivers that I have been able to test.

author:
   Mike Hutchinson
author:
   Brian Heineman
version:
   $Id: JtdsPreparedStatement.java,v 1.63 2007/07/12 21:03:23 bheineman Exp $


Field Summary
 Collectionhandles
    
protected  ParamInfo[]paramMetaData
     The cached parameter meta data.
protected  ParamInfo[]parameters
     The parameter list for the call.
protected  StringprocName
     The procedure name for CallableStatements.
final protected  Stringsql
     The SQL statement being prepared.
protected  StringsqlWord
     The first SQL keyword in the SQL string.

Constructor Summary
 JtdsPreparedStatement(ConnectionJDBC2 connection, String sql, int resultSetType, int concurrency, boolean returnKeys)
     Construct a new preparedStatement object.

Method Summary
public  voidaddBatch()
    
public  voidaddBatch(String sql)
    
protected  voidcheckOpen()
     Check that this statement is still open.
public  voidclearParameters()
    
public  voidclose()
    
public  booleanexecute()
    
public  booleanexecute(String sql)
    
public  booleanexecute(String arg0, int arg1)
    
public  booleanexecute(String arg0, int[] arg1)
    
public  booleanexecute(String arg0, String[] arg1)
    
protected  SQLExceptionexecuteMSBatch(int size, int executeSize, ArrayList counts)
     Execute the SQL batch on a MS server.

When running with prepareSQL=1 or 3, the driver will first prepare temporary stored procedures or statements for each parameter combination found in the batch.

public  ResultSetexecuteQuery()
    
public  ResultSetexecuteQuery(String sql)
    
protected  SQLExceptionexecuteSybaseBatch(int size, int executeSize, ArrayList counts)
     Execute the SQL batch on a Sybase server.

Sybase needs to have the SQL concatenated into one TDS language packet followed by up to 1000 parameters.

public  intexecuteUpdate()
    
public  intexecuteUpdate(String sql)
    
public  intexecuteUpdate(String sql, int getKeys)
    
public  intexecuteUpdate(String arg0, int[] arg1)
    
public  intexecuteUpdate(String arg0, String[] arg1)
    
public  ResultSetMetaDatagetMetaData()
    
protected  ParamInfogetParameter(int parameterIndex)
     Check the supplied index and return the selected parameter.
Parameters:
  parameterIndex - the parameter index 1 to n.
public  ParameterMetaDatagetParameterMetaData()
    
protected static  StringnormalizeCall(String sql)
     This method converts native call syntax into (hopefully) valid JDBC escape syntax.

Note: This method is required for backwards compatibility with previous versions of jTDS.

protected  voidnotSupported(String method)
     Report that user tried to call a method not supported on this type of statement.
public  voidsetArray(int arg0, Array arg1)
    
public  voidsetAsciiStream(int parameterIndex, InputStream inputStream, int length)
    
public  voidsetBigDecimal(int parameterIndex, BigDecimal x)
    
public  voidsetBinaryStream(int parameterIndex, InputStream x, int length)
    
public  voidsetBlob(int parameterIndex, Blob x)
    
public  voidsetBoolean(int parameterIndex, boolean x)
    
public  voidsetByte(int parameterIndex, byte x)
    
public  voidsetBytes(int parameterIndex, byte[] x)
    
public  voidsetCharacterStream(int parameterIndex, Reader reader, int length)
    
public  voidsetClob(int parameterIndex, Clob x)
    
 voidsetColMetaData(ColInfo[] value)
     Update the cached column meta data information.
public  voidsetDate(int parameterIndex, Date x)
    
public  voidsetDate(int parameterIndex, Date x, Calendar cal)
    
public  voidsetDouble(int parameterIndex, double x)
    
public  voidsetFloat(int parameterIndex, float x)
    
public  voidsetInt(int parameterIndex, int x)
    
public  voidsetLong(int parameterIndex, long x)
    
public  voidsetNull(int parameterIndex, int sqlType)
    
public  voidsetNull(int parameterIndex, int sqlType, String typeName)
    
public  voidsetObject(int parameterIndex, Object x)
    
public  voidsetObject(int parameterIndex, Object x, int targetSqlType)
    
public  voidsetObject(int parameterIndex, Object x, int targetSqlType, int scale)
    
public  voidsetObjectBase(int parameterIndex, Object x, int targetSqlType, int scale)
     Generic setObject method.
 voidsetParamMetaData(ParamInfo[] value)
     Update the cached parameter meta data information.
protected  voidsetParameter(int parameterIndex, Object x, int targetSqlType, int scale, int length)
     Update the ParamInfo object for the specified parameter.
public  voidsetRef(int parameterIndex, Ref x)
    
public  voidsetShort(int parameterIndex, short x)
    
public  voidsetString(int parameterIndex, String x)
    
public  voidsetTime(int parameterIndex, Time x)
    
public  voidsetTime(int parameterIndex, Time x, Calendar cal)
    
public  voidsetTimestamp(int parameterIndex, Timestamp x)
    
public  voidsetTimestamp(int parameterIndex, Timestamp x, Calendar cal)
    
public  voidsetURL(int parameterIndex, URL url)
    
public  voidsetUnicodeStream(int parameterIndex, InputStream inputStream, int length)
    

Field Detail
handles
Collection handles(Code)
Collection of handles used by this statement



paramMetaData
protected ParamInfo[] paramMetaData(Code)
The cached parameter meta data.



parameters
protected ParamInfo[] parameters(Code)
The parameter list for the call.



procName
protected String procName(Code)
The procedure name for CallableStatements.



sql
final protected String sql(Code)
The SQL statement being prepared.



sqlWord
protected String sqlWord(Code)
The first SQL keyword in the SQL string.




Constructor Detail
JtdsPreparedStatement
JtdsPreparedStatement(ConnectionJDBC2 connection, String sql, int resultSetType, int concurrency, boolean returnKeys) throws SQLException(Code)
Construct a new preparedStatement object.
Parameters:
  connection - The parent connection.
Parameters:
  sql - The SQL statement to prepare.
Parameters:
  resultSetType - The result set type eg SCROLLABLE etc.
Parameters:
  concurrency - The result set concurrency eg READONLY.
Parameters:
  returnKeys - True if generated keys should be returned.
throws:
  SQLException -




Method Detail
addBatch
public void addBatch() throws SQLException(Code)



addBatch
public void addBatch(String sql) throws SQLException(Code)



checkOpen
protected void checkOpen() throws SQLException(Code)
Check that this statement is still open.
throws:
  SQLException - if statement closed.



clearParameters
public void clearParameters() throws SQLException(Code)



close
public void close() throws SQLException(Code)



execute
public boolean execute() throws SQLException(Code)



execute
public boolean execute(String sql) throws SQLException(Code)



execute
public boolean execute(String arg0, int arg1) throws SQLException(Code)



execute
public boolean execute(String arg0, int[] arg1) throws SQLException(Code)



execute
public boolean execute(String arg0, String[] arg1) throws SQLException(Code)



executeMSBatch
protected SQLException executeMSBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code)
Execute the SQL batch on a MS server.

When running with prepareSQL=1 or 3, the driver will first prepare temporary stored procedures or statements for each parameter combination found in the batch. The handles to these pre-preared statements will then be used to execute the actual batch statements.
Parameters:
  size - the total size of the batch
Parameters:
  executeSize - the maximum number of statements to send in one request
Parameters:
  counts - the returned update counts chained exceptions linked to a SQLException
throws:
  SQLException - if a serious error occurs during execution




executeQuery
public ResultSet executeQuery() throws SQLException(Code)



executeQuery
public ResultSet executeQuery(String sql) throws SQLException(Code)



executeSybaseBatch
protected SQLException executeSybaseBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code)
Execute the SQL batch on a Sybase server.

Sybase needs to have the SQL concatenated into one TDS language packet followed by up to 1000 parameters. This method will be overriden for CallableStatements.
Parameters:
  size - the total size of the batch
Parameters:
  executeSize - the maximum number of statements to send in one request
Parameters:
  counts - the returned update counts chained exceptions linked to a SQLException
throws:
  SQLException - if a serious error occurs during execution




executeUpdate
public int executeUpdate() throws SQLException(Code)



executeUpdate
public int executeUpdate(String sql) throws SQLException(Code)



executeUpdate
public int executeUpdate(String sql, int getKeys) throws SQLException(Code)



executeUpdate
public int executeUpdate(String arg0, int[] arg1) throws SQLException(Code)



executeUpdate
public int executeUpdate(String arg0, String[] arg1) throws SQLException(Code)



getMetaData
public ResultSetMetaData getMetaData() throws SQLException(Code)



getParameter
protected ParamInfo getParameter(int parameterIndex) throws SQLException(Code)
Check the supplied index and return the selected parameter.
Parameters:
  parameterIndex - the parameter index 1 to n. the parameter as a ParamInfo object.
throws:
  SQLException - if the statement is closed;if parameterIndex is less than 0;if parameterIndex is greater than thenumber of parameters;if checkIfSet was trueand the parameter was not set



getParameterMetaData
public ParameterMetaData getParameterMetaData() throws SQLException(Code)



normalizeCall
protected static String normalizeCall(String sql)(Code)
This method converts native call syntax into (hopefully) valid JDBC escape syntax.

Note: This method is required for backwards compatibility with previous versions of jTDS. Strictly speaking only the JDBC syntax needs to be recognised, constructions such as "?=#testproc ?,?" are neither valid native syntax nor valid escapes. All the substrings and trims below are not as bad as they look. The objects created all refer back to the original sql string it is just the start and length positions which change.
Parameters:
  sql - the SQL statement to process the SQL, possibly in original form




notSupported
protected void notSupported(String method) throws SQLException(Code)
Report that user tried to call a method not supported on this type of statement.
Parameters:
  method - The method name to report in the error message.
throws:
  SQLException -



setArray
public void setArray(int arg0, Array arg1) throws SQLException(Code)



setAsciiStream
public void setAsciiStream(int parameterIndex, InputStream inputStream, int length) throws SQLException(Code)



setBigDecimal
public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException(Code)



setBinaryStream
public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException(Code)



setBlob
public void setBlob(int parameterIndex, Blob x) throws SQLException(Code)



setBoolean
public void setBoolean(int parameterIndex, boolean x) throws SQLException(Code)



setByte
public void setByte(int parameterIndex, byte x) throws SQLException(Code)



setBytes
public void setBytes(int parameterIndex, byte[] x) throws SQLException(Code)



setCharacterStream
public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException(Code)



setClob
public void setClob(int parameterIndex, Clob x) throws SQLException(Code)



setColMetaData
void setColMetaData(ColInfo[] value)(Code)
Update the cached column meta data information.
Parameters:
  value - The Column meta data array.



setDate
public void setDate(int parameterIndex, Date x) throws SQLException(Code)



setDate
public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException(Code)



setDouble
public void setDouble(int parameterIndex, double x) throws SQLException(Code)



setFloat
public void setFloat(int parameterIndex, float x) throws SQLException(Code)



setInt
public void setInt(int parameterIndex, int x) throws SQLException(Code)



setLong
public void setLong(int parameterIndex, long x) throws SQLException(Code)



setNull
public void setNull(int parameterIndex, int sqlType) throws SQLException(Code)



setNull
public void setNull(int parameterIndex, int sqlType, String typeName) throws SQLException(Code)



setObject
public void setObject(int parameterIndex, Object x) throws SQLException(Code)



setObject
public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException(Code)



setObject
public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException(Code)



setObjectBase
public void setObjectBase(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException(Code)
Generic setObject method.
Parameters:
  parameterIndex - Parameter index 1 to n.
Parameters:
  x - The value to set.
Parameters:
  targetSqlType - The java.sql.Types constant describing the data.
Parameters:
  scale - The decimal scale -1 if not set.



setParamMetaData
void setParamMetaData(ParamInfo[] value)(Code)
Update the cached parameter meta data information.
Parameters:
  value - The Column meta data array.



setParameter
protected void setParameter(int parameterIndex, Object x, int targetSqlType, int scale, int length) throws SQLException(Code)
Update the ParamInfo object for the specified parameter.
Parameters:
  parameterIndex - Parameter index 1 to n.
Parameters:
  x - The value to set.
Parameters:
  targetSqlType - The java.sql.Types constant describing the data.
Parameters:
  scale - The decimal scale -1 if not set.
Parameters:
  length - The length of the data item.



setRef
public void setRef(int parameterIndex, Ref x) throws SQLException(Code)



setShort
public void setShort(int parameterIndex, short x) throws SQLException(Code)



setString
public void setString(int parameterIndex, String x) throws SQLException(Code)



setTime
public void setTime(int parameterIndex, Time x) throws SQLException(Code)



setTime
public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException(Code)



setTimestamp
public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException(Code)



setTimestamp
public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException(Code)



setURL
public void setURL(int parameterIndex, URL url) throws SQLException(Code)



setUnicodeStream
public void setUnicodeStream(int parameterIndex, InputStream inputStream, int length) throws SQLException(Code)



Fields inherited from net.sourceforge.jtds.jdbc.JtdsStatement
final static int BOOLEAN(Code)(Java Doc)
final static int CLOSE_ALL_RESULTS(Code)(Java Doc)
final static int CLOSE_CURRENT_RESULT(Code)(Java Doc)
final static int DATALINK(Code)(Java Doc)
final static int DEFAULT_FETCH_SIZE(Code)(Java Doc)
final static Integer EXECUTE_FAILED(Code)(Java Doc)
final static int KEEP_CURRENT_RESULT(Code)(Java Doc)
final static int NO_GENERATED_KEYS(Code)(Java Doc)
final static int RETURN_GENERATED_KEYS(Code)(Java Doc)
final static Integer SUCCESS_NO_INFO(Code)(Java Doc)
protected ArrayList batchValues(Code)(Java Doc)
protected boolean closed(Code)(Java Doc)
protected ColInfo[] colMetaData(Code)(Java Doc)
protected ConnectionJDBC2 connection(Code)(Java Doc)
protected JtdsResultSet currentResult(Code)(Java Doc)
protected String cursorName(Code)(Java Doc)
protected boolean escapeProcessing(Code)(Java Doc)
protected int fetchDirection(Code)(Java Doc)
protected int fetchSize(Code)(Java Doc)
protected JtdsResultSet genKeyResultSet(Code)(Java Doc)
protected int maxFieldSize(Code)(Java Doc)
protected int maxRows(Code)(Java Doc)
final protected SQLDiagnostic messages(Code)(Java Doc)
protected ArrayList openResultSets(Code)(Java Doc)
protected int queryTimeout(Code)(Java Doc)
final protected LinkedList resultQueue(Code)(Java Doc)
protected int resultSetConcurrency(Code)(Java Doc)
protected int resultSetType(Code)(Java Doc)
protected TdsCore tds(Code)(Java Doc)

Methods inherited from net.sourceforge.jtds.jdbc.JtdsStatement
public void addBatch(String sql) throws SQLException(Code)(Java Doc)
void addWarning(SQLWarning w)(Code)(Java Doc)
protected void cacheResults() throws SQLException(Code)(Java Doc)
public void cancel() throws SQLException(Code)(Java Doc)
protected void checkCursorException(SQLException e) throws SQLException(Code)(Java Doc)
protected void checkOpen() throws SQLException(Code)(Java Doc)
public void clearBatch() throws SQLException(Code)(Java Doc)
public void clearWarnings() throws SQLException(Code)(Java Doc)
public void close() throws SQLException(Code)(Java Doc)
void closeAllResultSets() throws SQLException(Code)(Java Doc)
void closeCurrentResultSet() throws SQLException(Code)(Java Doc)
public boolean execute(String sql) throws SQLException(Code)(Java Doc)
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException(Code)(Java Doc)
public boolean execute(String sql, int[] columnIndexes) throws SQLException(Code)(Java Doc)
public boolean execute(String sql, String[] columnNames) throws SQLException(Code)(Java Doc)
public int[] executeBatch() throws SQLException, BatchUpdateException(Code)(Java Doc)
protected SQLException executeMSBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code)(Java Doc)
public ResultSet executeQuery(String sql) throws SQLException(Code)(Java Doc)
protected boolean executeSQL(String sql, String spName, ParamInfo[] params, boolean returnKeys, boolean update, boolean useCursor) throws SQLException(Code)(Java Doc)
protected ResultSet executeSQLQuery(String sql, String spName, ParamInfo[] params, boolean useCursor) throws SQLException(Code)(Java Doc)
protected SQLException executeSybaseBatch(int size, int executeSize, ArrayList counts) throws SQLException(Code)(Java Doc)
public int executeUpdate(String sql) throws SQLException(Code)(Java Doc)
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException(Code)(Java Doc)
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException(Code)(Java Doc)
public int executeUpdate(String sql, String[] columnNames) throws SQLException(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
public Connection getConnection() throws SQLException(Code)(Java Doc)
int getDefaultFetchSize()(Code)(Java Doc)
public int getFetchDirection() throws SQLException(Code)(Java Doc)
public int getFetchSize() throws SQLException(Code)(Java Doc)
public ResultSet getGeneratedKeys() throws SQLException(Code)(Java Doc)
public int getMaxFieldSize() throws SQLException(Code)(Java Doc)
public int getMaxRows() throws SQLException(Code)(Java Doc)
SQLDiagnostic getMessages()(Code)(Java Doc)
public boolean getMoreResults() throws SQLException(Code)(Java Doc)
public boolean getMoreResults(int current) throws SQLException(Code)(Java Doc)
public int getQueryTimeout() throws SQLException(Code)(Java Doc)
public ResultSet getResultSet() throws SQLException(Code)(Java Doc)
public int getResultSetConcurrency() throws SQLException(Code)(Java Doc)
public int getResultSetHoldability() throws SQLException(Code)(Java Doc)
public int getResultSetType() throws SQLException(Code)(Java Doc)
TdsCore getTds()(Code)(Java Doc)
public int getUpdateCount() throws SQLException(Code)(Java Doc)
public SQLWarning getWarnings() throws SQLException(Code)(Java Doc)
protected void initialize() throws SQLException(Code)(Java Doc)
static void notImplemented(String method) throws SQLException(Code)(Java Doc)
public void setCursorName(String name) throws SQLException(Code)(Java Doc)
public void setEscapeProcessing(boolean enable) throws SQLException(Code)(Java Doc)
public void setFetchDirection(int direction) throws SQLException(Code)(Java Doc)
public void setFetchSize(int rows) throws SQLException(Code)(Java Doc)
public void setMaxFieldSize(int max) throws SQLException(Code)(Java Doc)
public void setMaxRows(int max) throws SQLException(Code)(Java Doc)
public void setQueryTimeout(int seconds) throws SQLException(Code)(Java Doc)
protected boolean useCursor(boolean returnKeys, String sqlWord)(Code)(Java Doc)

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.