Java Doc for JDBCUtil.java in  » J2EE » Expresso » com » jcorporate » expresso » core » dataobjects » 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 » J2EE » Expresso » com.jcorporate.expresso.core.dataobjects.jdbc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.jcorporate.expresso.core.db.DBException
   com.jcorporate.expresso.core.dataobjects.DataException
      com.jcorporate.expresso.core.dataobjects.jdbc.JDBCUtil

JDBCUtil
public class JDBCUtil extends DataException (Code)
This class provides utility functions that are common across the jdbc.* package classes. This class is normally not accessed except through other classes in the jdbc package.
author:
   Michael Rimov
since:
   Expresso 5.0


Field Summary
final public static  StringDATETIME_FORMAT
    
final public static  StringDATE_FORMAT
    
final public static  StringTIME_FORMAT
    

Constructor Summary
protected  JDBCUtil()
    

Method Summary
public  voidbuildStoreProcedureCallableStatement(JDBCDataObject criteria, CallableStatement myCallableStatement)
     Build and return a FastStringBuffer ring consisting of an SQL 'where' clause using the current field values as criteria for the search.
public  StringbuildWhereClause(JDBCDataObject criteria, boolean useAllFields)
     Build and return a string consisting of an SQL 'where' clause using the current field values as criteria for the search.
public  FastStringBufferbuildWhereClauseBuffer(JDBCDataObject criteria, boolean useAllFields, FastStringBuffer allocatedBuffer)
     Build and return a FastStringBuffer ring consisting of an SQL 'where' clause using the current field values as criteria for the search.
public  booleancontainsWildCards(JDBCDataObject ownerObject, String fieldValue)
     See if this field value contains wild cards (e.g.
public  StringformatDateTime(DataObject theObject, String fieldName)
     Given the value of a date/time or date/time field, return the value formatted as appropriate for the current DBMS.
public  StringformatDateTime(DataObject theObject, String fieldName, boolean surroundWithQuotes)
     Given the value of a date/time or datetime field, return the value formatted as appropriate for the current DBMS.
protected  DateReturnFormatformatDateTimeInternal(DataObject theObject, String fieldName)
     This class combines the old getFieldDate() with quoteIfNeeded() to format the Date-Time fields appropriately for storage.
public  java.util.DategetDateField(DataObject theObject, String fieldName)
    
public static  JDBCUtilgetInstance()
    
protected  SimpleDateFormatgetSimpleDateFormat(String pattern)
     Get a SimpleDateFormat object that is cached.
public  StringmakeLimitationStub(DBConnection theConnection, DataObject theObj)
     Creates the limitation syntax optimisation stub to embed inside the SQL command that performs search and retrieve.

This method takes the limitation syntax string and performs a string replacement on the following tokens

  • %offset%

  • the number of rows in the ResultSet to skip before reading the data.

  • %maxrecord%

  • the maximum number of rows to read from the ResultSet. Also known as the rowlength.

  • %endrecord%

  • the last record of in the ResultSet that the search and retrieved should retrieve.
public  StringquoteIfNeeded(JDBCDataObject targetObject, String fieldName, String rangeString)
     Return the value of this field, placing double quotes around it if the field's datatype requires it.

Field Detail
DATETIME_FORMAT
final public static String DATETIME_FORMAT(Code)



DATE_FORMAT
final public static String DATE_FORMAT(Code)



TIME_FORMAT
final public static String TIME_FORMAT(Code)




Constructor Detail
JDBCUtil
protected JDBCUtil()(Code)




Method Detail
buildStoreProcedureCallableStatement
public void buildStoreProcedureCallableStatement(JDBCDataObject criteria, CallableStatement myCallableStatement) throws DataException(Code)
Build and return a FastStringBuffer ring consisting of an SQL 'where' clause using the current field values as criteria for the search. See setCustomWhereClause for information on specifying a more complex where clause.
Parameters:
  criteria - the JDBCDataObject to build from
Parameters:
  useAllFields - True if all fields are to be used,false for only key fields
Parameters:
  allocatedBuffer - - An already allocated FastStringBuffer to fill out.This allows for compatability with, for example, object pools. A FastStringBuffer containing the "where" clause for the SQL statement
throws:
  DataException - upon error



buildWhereClause
public String buildWhereClause(JDBCDataObject criteria, boolean useAllFields) throws DataException(Code)
Build and return a string consisting of an SQL 'where' clause using the current field values as criteria for the search. See setCustomWhereClause for information on specifying a more complex where clause.
Parameters:
  criteria - the JDBCDataObject to build from
Parameters:
  useAllFields - True if all fields are to be used,false for only key fields The where clause to use in a query.



buildWhereClauseBuffer
public FastStringBuffer buildWhereClauseBuffer(JDBCDataObject criteria, boolean useAllFields, FastStringBuffer allocatedBuffer) throws DataException(Code)
Build and return a FastStringBuffer ring consisting of an SQL 'where' clause using the current field values as criteria for the search. See setCustomWhereClause for information on specifying a more complex where clause.
Parameters:
  criteria - the JDBCDataObject to build from
Parameters:
  useAllFields - True if all fields are to be used,false for only key fields
Parameters:
  allocatedBuffer - - An already allocated FastStringBuffer to fill out.This allows for compatability with, for example, object pools. A FastStringBuffer containing the "where" clause for the SQL statement
throws:
  DataException - upon error



containsWildCards
public boolean containsWildCards(JDBCDataObject ownerObject, String fieldValue) throws DataException(Code)
See if this field value contains wild cards (e.g. pattern matching criteria for the database). The wild cards can be configured via the properties file.
Parameters:
  fieldValue - The field value to check for wild cards
Parameters:
  ownerObject - the obejct to query for metadata True if the string does contain wild cards, False if it does not



formatDateTime
public String formatDateTime(DataObject theObject, String fieldName) throws DataException(Code)
Given the value of a date/time or date/time field, return the value formatted as appropriate for the current DBMS. Can be configured using property file values.
Parameters:
  fieldName - java.lang.String The value for the date/time field.
Parameters:
  theObject - the DataObject that the date field is comingfrom. java.lang.String The formatted date time, ready for use in the DBMS



formatDateTime
public String formatDateTime(DataObject theObject, String fieldName, boolean surroundWithQuotes) throws DataException(Code)
Given the value of a date/time or datetime field, return the value formatted as appropriate for the current DBMS. Can be configured using expresso-config file values.
Parameters:
  fieldName - java.lang.String The value for the date/time field.
Parameters:
  theObject - the DataObject that the date field is comingfrom.
Parameters:
  surroundWithQuotes - set to true if you want the returned valueto be surrounded with single quotes, such as for a standard JDBC SELECT statement.Use false if you want to use it, for example, in a PreparedStatement java.lang.String The formatted date time, ready for use in the DBMS



formatDateTimeInternal
protected DateReturnFormat formatDateTimeInternal(DataObject theObject, String fieldName) throws DataException(Code)
This class combines the old getFieldDate() with quoteIfNeeded() to format the Date-Time fields appropriately for storage. This probably could use some serious optimization since it looks like at first glance it does the same operation twice. Any volunteers? :)
Parameters:
  theObject - The object that contains the data to froatm
Parameters:
  fieldName - the name of the field to format a DateReturnFormat object.
throws:
  DataException - upon error



getDateField
public java.util.Date getDateField(DataObject theObject, String fieldName) throws DataException(Code)
Helper function that helps convert any string values from the database's format
Parameters:
  theObject - the source data object
Parameters:
  fieldName - the name of the field java.util.Date
throws:
  DataException - upon error (possibly conversion error)



getInstance
public static JDBCUtil getInstance()(Code)



getSimpleDateFormat
protected SimpleDateFormat getSimpleDateFormat(String pattern)(Code)
Get a SimpleDateFormat object that is cached. Make sure you have dateConvertFormatMap already locked before calling this function or you'll have a race condition.
Parameters:
  pattern - the format pattern to look up an instantiated SimpleDateFormat object. SimpleDateFormat is NOTthreadsafe, so make sure you do your parsing while still in the synchronizedblock. Perhaps in the future a keyed Object pool will be better.



makeLimitationStub
public String makeLimitationStub(DBConnection theConnection, DataObject theObj)(Code)
Creates the limitation syntax optimisation stub to embed inside the SQL command that performs search and retrieve.

This method takes the limitation syntax string and performs a string replacement on the following tokens

  • %offset%

  • the number of rows in the ResultSet to skip before reading the data.

  • %maxrecord%

  • the maximum number of rows to read from the ResultSet. Also known as the rowlength.

  • %endrecord%

  • the last record of in the ResultSet that the search and retrieved should retrieve. The end record number is equal to ( %offset% + %maxrecord% - 1 )

author Peter Pilgrim, Thu Jun 21 10:30:59 BST 2001
Parameters:
  theConnection - the db connection to make this stub from
Parameters:
  theObj - the DataObject to query for the limitation stub the limitation syntax stub string



quoteIfNeeded
public String quoteIfNeeded(JDBCDataObject targetObject, String fieldName, String rangeString) throws DataException(Code)
Return the value of this field, placing double quotes around it if the field's datatype requires it.
Parameters:
  fieldName - The name of the field to be used
Parameters:
  rangeString - the appropriately formatted string
Parameters:
  targetObject - the JDBCDataObject to query for metadata A string, quoted if necessary, to be used in building an SQL statement
throws:
  DataException - If there is no such field or it's value cannot bedetermined




Methods inherited from com.jcorporate.expresso.core.db.DBException
public String getDBMessage()(Code)(Java Doc)
public String getMessage()(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.