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


java.lang.Object
   org.apache.torque.util.SqlExpression

SqlExpression
final public class SqlExpression (Code)
This class represents a part of an SQL query found in the WHERE section. For example:
 table_a.column_a = table_b.column_a
 column LIKE 'F%'
 table.column < 3
 
This class is used primarily by org.apache.torque.util.BasePeer .
author:
   John D. McNally
author:
   Daniel Rall
author:
   Fedor Karpelevitch
author:
   Martin Poeschl
version:
   $Id: SqlExpression.java 476550 2006-11-18 16:08:37Z tfischer $




Method Summary
public static  Stringbuild(String columnName, Object criteria, SqlEnum comparison)
     Builds a simple SQL expression.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc.
public static  Stringbuild(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db)
     Builds a simple SQL expression.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc.
Parameters:
  ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions.
public static  voidbuild(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause)
     Builds a simple SQL expression.
static  StringbuildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db)
     Takes a columnName and criteria (which must be an array) and builds a SQL 'IN' expression taking into account the ignoreCase flag.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - Either " IN " or " NOT IN ".
Parameters:
  ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions.
static  voidbuildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause)
     Takes a columnName and criteria (which must be an array) and builds a SQL 'IN' expression taking into account the ignoreCase flag.
public static  StringbuildInnerJoin(String column, String relatedColumn)
     Used to specify a join on two columns.
Parameters:
  column - A column in one of the tables to be joined.
Parameters:
  relatedColumn - The column in the other table to be joined.
public static  StringbuildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db)
     Used to specify a join on two columns.
Parameters:
  column - A column in one of the tables to be joined.
Parameters:
  relatedColumn - The column in the other table to be joined.
Parameters:
  ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case.
Parameters:
  db - Represents the database in use for vendor-specific functions.
public static  voidbuildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db, StringBuffer whereClause)
     Used to specify a join on two columns.
static  StringbuildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db)
     Takes a columnName and criteria and builds an SQL phrase based on whether wildcards are present and the state of the ignoreCase flag.
static  voidbuildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause)
     Takes a columnName and criteria and builds an SQL phrase based on whether wildcards are present and the state of the ignoreCase flag.
static  StringprocessInValue(Object value, boolean ignoreCase, DB db)
     Creates an appropriate string for an 'IN' clause from an object.
public static  StringquoteAndEscapeText(String rawText, DB db)
     Quotes and escapes raw text for placement in a SQL expression.



Method Detail
build
public static String build(String columnName, Object criteria, SqlEnum comparison) throws TorqueException(Code)
Builds a simple SQL expression.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc. A simple SQL expression, e.g. UPPER(table_a.column_a)LIKE UPPER('ab%c').
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



build
public static String build(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db) throws TorqueException(Code)
Builds a simple SQL expression.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc.
Parameters:
  ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions. A simple sql expression, e.g. UPPER(table_a.column_a)LIKE UPPER('ab%c').
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



build
public static void build(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause) throws TorqueException(Code)
Builds a simple SQL expression.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - One of =, <, >, ^lt;=, >=, <>,!=, LIKE, etc.
Parameters:
  ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions.
Parameters:
  whereClause - A StringBuffer to which the sql expression will beappended.



buildIn
static String buildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db)(Code)
Takes a columnName and criteria (which must be an array) and builds a SQL 'IN' expression taking into account the ignoreCase flag.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - Either " IN " or " NOT IN ".
Parameters:
  ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions. An SQL expression.



buildIn
static void buildIn(String columnName, Object criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause)(Code)
Takes a columnName and criteria (which must be an array) and builds a SQL 'IN' expression taking into account the ignoreCase flag.
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - Either " IN " or " NOT IN ".
Parameters:
  ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions.
Parameters:
  whereClause - A StringBuffer to which the sql expressionwill be appended.



buildInnerJoin
public static String buildInnerJoin(String column, String relatedColumn)(Code)
Used to specify a join on two columns.
Parameters:
  column - A column in one of the tables to be joined.
Parameters:
  relatedColumn - The column in the other table to be joined. A join expression, e.g. UPPER(table_a.column_a) =UPPER(table_b.column_b).



buildInnerJoin
public static String buildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db)(Code)
Used to specify a join on two columns.
Parameters:
  column - A column in one of the tables to be joined.
Parameters:
  relatedColumn - The column in the other table to be joined.
Parameters:
  ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case.
Parameters:
  db - Represents the database in use for vendor-specific functions. A join expression, e.g. UPPER(table_a.column_a) =UPPER(table_b.column_b).



buildInnerJoin
public static void buildInnerJoin(String column, String relatedColumn, boolean ignoreCase, DB db, StringBuffer whereClause)(Code)
Used to specify a join on two columns.
Parameters:
  column - A column in one of the tables to be joined.
Parameters:
  relatedColumn - The column in the other table to be joined.
Parameters:
  ignoreCase - If true and columns represent Strings, the appropriatefunction defined for the database will be used to ignoredifferences in case.
Parameters:
  db - Represents the database in use for vendor-specific functions.
Parameters:
  whereClause - A StringBuffer to which the sql expression will beappended.



buildLike
static String buildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db)(Code)
Takes a columnName and criteria and builds an SQL phrase based on whether wildcards are present and the state of the ignoreCase flag. Multicharacter wildcards % and * may be used as well as single character wildcards, _ and ?. These characters can be escaped with \. e.g. criteria = "fre%" -> columnName LIKE 'fre%' -> UPPER(columnName) LIKE UPPER('fre%') criteria = "50\%" -> columnName = '50%'
Parameters:
  columnName - A column.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - Whether to do a LIKE or a NOT LIKE
Parameters:
  ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions. An SQL expression.



buildLike
static void buildLike(String columnName, String criteria, SqlEnum comparison, boolean ignoreCase, DB db, StringBuffer whereClause)(Code)
Takes a columnName and criteria and builds an SQL phrase based on whether wildcards are present and the state of the ignoreCase flag. Multicharacter wildcards % and * may be used as well as single character wildcards, _ and ?. These characters can be escaped with \. e.g. criteria = "fre%" -> columnName LIKE 'fre%' -> UPPER(columnName) LIKE UPPER('fre%') criteria = "50\%" -> columnName = '50%'
Parameters:
  columnName - A column name.
Parameters:
  criteria - The value to compare the column against.
Parameters:
  comparison - Whether to do a LIKE or a NOT LIKE
Parameters:
  ignoreCase - If true and columns represent Strings, theappropriate function defined for the database will be used toignore differences in case.
Parameters:
  db - Represents the database in use, for vendor specific functions.
Parameters:
  whereClause - A StringBuffer to which the sql expressionwill be appended.



processInValue
static String processInValue(Object value, boolean ignoreCase, DB db)(Code)
Creates an appropriate string for an 'IN' clause from an object. Adds quoting and/or UPPER() as appropriate. This is broken out into a seperate method as it is used in two places in buildIn, depending on whether an array or List is being looped over.
Parameters:
  value - The value to process.
Parameters:
  ignoreCase - Coerce the value suitably for ignoring case.
Parameters:
  db - Represents the database in use for vendor specific functions. Processed value as String.



quoteAndEscapeText
public static String quoteAndEscapeText(String rawText, DB db)(Code)
Quotes and escapes raw text for placement in a SQL expression. For simplicity, the text is assumed to be neither quoted nor escaped.
Parameters:
  rawText - The unquoted, unescaped text to process.
Parameters:
  db - the db Quoted and escaped text.



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.