Java Doc for SPreparedStatement.java in  » Database-ORM » SimpleORM » simpleorm » core » 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 ORM » SimpleORM » simpleorm.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   simpleorm.core.SPreparedStatement

SPreparedStatement
public class SPreparedStatement (Code)
This class represents a SimpleORM prepared query statement. It is analagous to the JDBC prepared statement.

The general flow of a query goes as follows:-

SPreparedStatement stmt = Employee.meta.select("SALARY > ?", "NAME"); // SELECT <All columns> FROM XX_EMPLOYEE // WHERE SALARY > ? ORDER BY NAME stmt.setInt(1, 50000); SResultSet res = stmt.execute(); while (res.hasNext()) { Employee emp = res.getRecord(); emp.getString(Employee.NAME); } To avoid a brittle structure with an ever growing number of parameters to SPreparedStatement, the objects now created in two steps one to create the object and set parameters. To utilize this use the following style instead:- SPreparedStatement limitps = new SPreparedStatement(); limitps.setOffset(1); limitps.setLimit(1); SResultSet limitR = Employee.meta.newQuery() .ascending(Employee.EMPEE_ID) .execute(limitps); // Employee.meta.Select(limitps,...) ## This uses of the SPreparedStatement seems a little odd. Maybe newQuery(limitps) would be better, and also use newSPreparedStatement(Employee.meta...) instead of Select. Mabye. But definitely do not want to create a Properties object one per query.


Field Summary
 booleandistinct
    
 PreparedStatementjdbcPreparedStatement
    
 SRecordMeta[]joinTables
    
 longlimit
    
 longoffset
    
 booleanoptimistic
    
 booleanreadOnly
    
 SConnectionsConnection
    
 SRecordMetasRecordMeta
    
 SFieldMeta[]selectList
    
 StringsqlQuery
    
 booleanunrepeatableRead
    

Constructor Summary
public  SPreparedStatement()
    

Method Summary
public  voidclose()
    
public  SResultSetexecute()
     Execute the query having set "?" paramenters.
public  booleangetDistinct()
    
public  PreparedStatementgetJDBCPreparedStatement()
     Retrieves the underlying JDBC PreparedStatement object. Dangerous.
public  SRecordMeta[]getJoinTables()
    
public  longgetLimit()
    
public  longgetOffset()
     Offset and Limit reduce the number of rows retrieved.
public  StringgetSQL()
    
protected  voidprepareStatement(SRecordMeta meta, String where, String orderBy, long sqy_bitSet, SFieldMeta[] selectList)
    
public  voidsetBigDecimal(int parameterIndex, BigDecimal value)
    
public  voidsetDate(int parameterIndex, java.util.Date value)
     See SRecordInstance.setTimestamp for discussion of Date parameter.
public  voidsetDistinct(boolean jts)
    
public  voidsetDouble(int parameterIndex, double value)
    
public  voidsetInt(int parameterIndex, int value)
    
public  voidsetJoinTables(SRecordMeta[] jts)
    
public  voidsetLimit(long lim)
    
public  voidsetLong(int parameterIndex, long value)
    
public  voidsetObject(int parameterIndex, Object value)
    
public  voidsetOffset(long off)
    
public  voidsetString(int parameterIndex, String value)
     value replaces the parameterIndexth "?" in the query.
public  voidsetTime(int parameterIndex, java.util.Date value)
     See SRecordInstance.setTimestamp for discussion of Date parameter.
public  voidsetTimestamp(int parameterIndex, java.util.Date value)
     See SRecordInstance.setTimestamp for discussion of Date parameter.
public  StringtoString()
    

Field Detail
distinct
boolean distinct(Code)



jdbcPreparedStatement
PreparedStatement jdbcPreparedStatement(Code)



joinTables
SRecordMeta[] joinTables(Code)



limit
long limit(Code)



offset
long offset(Code)



optimistic
boolean optimistic(Code)



readOnly
boolean readOnly(Code)



sConnection
SConnection sConnection(Code)



sRecordMeta
SRecordMeta sRecordMeta(Code)



selectList
SFieldMeta[] selectList(Code)



sqlQuery
String sqlQuery(Code)



unrepeatableRead
boolean unrepeatableRead(Code)




Constructor Detail
SPreparedStatement
public SPreparedStatement()(Code)




Method Detail
close
public void close()(Code)
Close the underlying JDBC prepared statement.

SResultSet.close




execute
public SResultSet execute()(Code)
Execute the query having set "?" paramenters.



getDistinct
public boolean getDistinct()(Code)
Select DISTINCT



getJDBCPreparedStatement
public PreparedStatement getJDBCPreparedStatement()(Code)
Retrieves the underlying JDBC PreparedStatement object. Dangerous. The authors can see no reason why this would ever need to be used but it is provided for completeness.



getJoinTables
public SRecordMeta[] getJoinTables()(Code)



getLimit
public long getLimit()(Code)
see limit



getOffset
public long getOffset()(Code)
Offset and Limit reduce the number of rows retrieved. My be implemented efficiently by the database, or just by skipping ahead during execute. Semantics are not that well defined between transactions, rows may be missed. Useful for paging out query results.

Note that if offset = 2 and limit = 5, the rows 0 and 1 are skipped, and rows 2..6 are returned.




getSQL
public String getSQL()(Code)



prepareStatement
protected void prepareStatement(SRecordMeta meta, String where, String orderBy, long sqy_bitSet, SFieldMeta[] selectList)(Code)



setBigDecimal
public void setBigDecimal(int parameterIndex, BigDecimal value)(Code)



setDate
public void setDate(int parameterIndex, java.util.Date value)(Code)
See SRecordInstance.setTimestamp for discussion of Date parameter.



setDistinct
public void setDistinct(boolean jts)(Code)



setDouble
public void setDouble(int parameterIndex, double value)(Code)



setInt
public void setInt(int parameterIndex, int value)(Code)



setJoinTables
public void setJoinTables(SRecordMeta[] jts)(Code)



setLimit
public void setLimit(long lim)(Code)



setLong
public void setLong(int parameterIndex, long value)(Code)



setObject
public void setObject(int parameterIndex, Object value)(Code)



setOffset
public void setOffset(long off)(Code)



setString
public void setString(int parameterIndex, String value)(Code)
value replaces the parameterIndexth "?" in the query. The first "?" is 1, not 0. Analagous to jdbc PreparedStatement.setString.



setTime
public void setTime(int parameterIndex, java.util.Date value)(Code)
See SRecordInstance.setTimestamp for discussion of Date parameter.



setTimestamp
public void setTimestamp(int parameterIndex, java.util.Date value)(Code)
See SRecordInstance.setTimestamp for discussion of Date parameter.



toString
public String toString()(Code)



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.