Java Doc for DB.java in  » Database-ORM » Torque » org » apache » torque » adapter » 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 » Torque » org.apache.torque.adapter 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.torque.adapter.DB

All known Subclasses:   org.apache.torque.adapter.AbstractDBAdapter,
DB
public interface DB extends Serializable,IDMethod(Code)
DB defines the interface for a Torque database adapter. Support for new databases is added by implementing this interface. A couple of default settings is provided by subclassing AbstractDBAdapter. The new database adapter and its corresponding JDBC driver need to be registered in the service configuration file.

The Torque database adapters exist to present a uniform interface to database access across all available databases. Once the necessary adapters have been written and configured, transparent swapping of databases is theoretically supported with zero code changes and minimal configuration file modifications. All database adapters need to be thread safe, as they are instantiated only once fore a given configured database and may be accessed simultaneously from several threads.

Torque uses the driver class name to find the right adapter. A JDBC driver corresponding to your adapter must be added to the properties file, using the fully-qualified class name of the driver. If no driver is specified for your database, driver.default is used.

 #### MySQL MM Driver
 database.default.driver=org.gjt.mm.mysql.Driver
 database.default.url=jdbc:mysql://localhost/DATABASENAME
 

author:
   Jon S. Stevens
author:
   Brett McLaughlin
author:
   Daniel Rall
author:
   Augustin Vidovic
author:
   Thomas Vandahl
version:
   $Id: DB.java 476550 2006-11-18 16:08:37Z tfischer $


Field Summary
 StringADAPTER_KEY
     Key for the configuration which contains database adapters.
 StringDRIVER_KEY
     Key for the configuration which contains database drivers.
 intLIMIT_STYLE_DB2
    
SELECT ...
 intLIMIT_STYLE_MYSQL
     SELECT ...
 intLIMIT_STYLE_NONE
     Database does not support limiting result sets.
 intLIMIT_STYLE_ORACLE
    
SELECT ...
 intLIMIT_STYLE_POSTGRES
     SELECT ...
 intLIMIT_STYLE_SYBASE
     SET ROWCOUNT <offset> SELECT ...


Method Summary
 booleanescapeText()
     Whether backslashes (\) should be escaped in explicit SQL strings. If true is returned, a BACKSLASH will be changed to "\\".
 voidgenerateLimits(Query query, int offset, int limit)
     This method is used to generate the database specific query extension to limit the number of record returned.
 StringgetBooleanString(Boolean b)
     This method is used to format a boolean string.
 StringgetDateString(Date date)
     This method is used to format any date string.
 StringgetIDMethodSQL(Object obj)
     Returns SQL used to get the most recently inserted primary key. Databases which have no support for this return null.
Parameters:
  obj - Information used for key generation.
 StringgetIDMethodType()
     Returns the constant from the org.apache.torque.adapter.IDMethod interface denoting which type of primary key generation method this type of RDBMS uses.
 intgetLimitStyle()
     This method is used to check whether the database supports limiting the size of the resultset.
 chargetStringDelimiter()
     Returns the character used to indicate the beginning and end of a piece of text used in a SQL statement (generally a single quote).
 StringignoreCase(String in)
     Modifies a SQL snippet such that its case is ignored by the database. The SQL snippet can be a column name (like AURHOR.NAME), an quoted explicit sql string (like 'abc') or any other sql value (like a number etc.).
Parameters:
  in - The SQL snippet whose case to ignore.
 StringignoreCaseInOrderBy(String in)
     This method is used to ignore case in an ORDER BY clause. Usually it is the same as ignoreCase, but some databases (Interbase for example) does not use the same SQL in ORDER BY and other clauses.
Parameters:
  in - The string whose case to ignore.
 voidlockTable(Connection con, String table)
     Locks the specified table.
 booleansupportsNativeLimit()
     This method is used to check whether the database natively supports limiting the size of the resultset.
 booleansupportsNativeOffset()
     This method is used to check whether the database natively supports returning results starting at an offset position other than 0.
 StringtoUpperCase(String in)
     This method is used to ignore case.
Parameters:
  in - The string to transform to upper case.
 voidunlockTable(Connection con, String table)
     Unlocks the specified table.
 booleanuseEscapeClauseForLike()
     Whether an escape clause in like should be used.
 booleanuseIlike()
     Whether ILIKE should be used for case insensitive like clauses.

Field Detail
ADAPTER_KEY
String ADAPTER_KEY(Code)
Key for the configuration which contains database adapters.



DRIVER_KEY
String DRIVER_KEY(Code)
Key for the configuration which contains database drivers.



LIMIT_STYLE_DB2
int LIMIT_STYLE_DB2(Code)
SELECT ... WHERE ... AND ROW_NUMBER() OVER() < 



LIMIT_STYLE_MYSQL
int LIMIT_STYLE_MYSQL(Code)
SELECT ... LIMIT [, ] <offset>



LIMIT_STYLE_NONE
int LIMIT_STYLE_NONE(Code)
Database does not support limiting result sets.



LIMIT_STYLE_ORACLE
int LIMIT_STYLE_ORACLE(Code)
SELECT ... WHERE ... AND ROWNUM < 



LIMIT_STYLE_POSTGRES
int LIMIT_STYLE_POSTGRES(Code)
SELECT ... LIMIT , [<offset>]



LIMIT_STYLE_SYBASE
int LIMIT_STYLE_SYBASE(Code)
SET ROWCOUNT <offset> SELECT ... SET ROWCOUNT 0





Method Detail
escapeText
boolean escapeText()(Code)
Whether backslashes (\) should be escaped in explicit SQL strings. If true is returned, a BACKSLASH will be changed to "\\". If false is returned, a BACKSLASH will be left as "\". true if the database needs to escape backslashesin SqlExpressions.



generateLimits
void generateLimits(Query query, int offset, int limit) throws TorqueException(Code)
This method is used to generate the database specific query extension to limit the number of record returned.
Parameters:
  query - The query to modify
Parameters:
  offset - the offset Value
Parameters:
  limit - the limit Value
throws:
  TorqueException - if any error occurs when building the query



getBooleanString
String getBooleanString(Boolean b)(Code)
This method is used to format a boolean string.
Parameters:
  b - the Boolean to format The proper date formatted String.



getDateString
String getDateString(Date date)(Code)
This method is used to format any date string. Database can use different default date formats.
Parameters:
  date - the Date to format The proper date formatted String.



getIDMethodSQL
String getIDMethodSQL(Object obj)(Code)
Returns SQL used to get the most recently inserted primary key. Databases which have no support for this return null.
Parameters:
  obj - Information used for key generation. The most recently inserted database key.



getIDMethodType
String getIDMethodType()(Code)
Returns the constant from the org.apache.torque.adapter.IDMethod interface denoting which type of primary key generation method this type of RDBMS uses. IDMethod constant



getLimitStyle
int getLimitStyle()(Code)
This method is used to check whether the database supports limiting the size of the resultset. The limit style for the database.



getStringDelimiter
char getStringDelimiter()(Code)
Returns the character used to indicate the beginning and end of a piece of text used in a SQL statement (generally a single quote). The text delimeter.



ignoreCase
String ignoreCase(String in)(Code)
Modifies a SQL snippet such that its case is ignored by the database. The SQL snippet can be a column name (like AURHOR.NAME), an quoted explicit sql string (like 'abc') or any other sql value (like a number etc.).
Parameters:
  in - The SQL snippet whose case to ignore. The string in a case that can be ignored.



ignoreCaseInOrderBy
String ignoreCaseInOrderBy(String in)(Code)
This method is used to ignore case in an ORDER BY clause. Usually it is the same as ignoreCase, but some databases (Interbase for example) does not use the same SQL in ORDER BY and other clauses.
Parameters:
  in - The string whose case to ignore. The string in a case that can be ignored.



lockTable
void lockTable(Connection con, String table) throws SQLException(Code)
Locks the specified table.
Parameters:
  con - The JDBC connection to use.
Parameters:
  table - The name of the table to lock.
throws:
  SQLException - No Statement could be created or executed.



supportsNativeLimit
boolean supportsNativeLimit()(Code)
This method is used to check whether the database natively supports limiting the size of the resultset. True if the database natively supports limiting thesize of the resultset.



supportsNativeOffset
boolean supportsNativeOffset()(Code)
This method is used to check whether the database natively supports returning results starting at an offset position other than 0. True if the database natively supports returningresults starting at an offset position other than 0.



toUpperCase
String toUpperCase(String in)(Code)
This method is used to ignore case.
Parameters:
  in - The string to transform to upper case. The upper case string.



unlockTable
void unlockTable(Connection con, String table) throws SQLException(Code)
Unlocks the specified table.
Parameters:
  con - The JDBC connection to use.
Parameters:
  table - The name of the table to unlock.
throws:
  SQLException - No Statement could be created or executed.



useEscapeClauseForLike
boolean useEscapeClauseForLike()(Code)
Whether an escape clause in like should be used. Example : select * from AUTHOR where AUTHOR.NAME like '\_%' ESCAPE '\'; whether the escape clause should be appended or not.



useIlike
boolean useIlike()(Code)
Whether ILIKE should be used for case insensitive like clauses. true if ilike should be used for case insensitive likes,false if ignoreCase should be applied to the compared strings.



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