Java Doc for SQLFunction.java in  » Rule-Engine » Mandarax » org » mandarax » sql » 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 » Rule Engine » Mandarax » org.mandarax.sql 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.mandarax.sql.SQLFunction

SQLFunction
public class SQLFunction implements org.mandarax.kernel.Function,LogCategories(Code)
Implementation of a function based on a SQL query. The query contains variable parameters represented by the VARIABLE_PROXY constants, just like the query strings used in JDBC prepared statements (the value of this variable is "?"). The return value is the one row in the result set converted to an object. If the result set has no rows or more than one row, an IllegalArgumentException is thrown. Therefore, queries will typically retrieve one column and have a where clause with a primary key condition.

Example:The query SELECT NAME FROM CUSTOMER WHERE ID=? will define a function that takes one value (the id) as input and returns one value (the name of the customer).
The (java) return type and the parameter types must be declared. Defaults (Object/Object[]) will be used otherwise.
Internally, we are using PreparedStatements. Since these statements can be reused, they are cached by connection using weak references (so that the function does not keep the connection alive if nobody else does it).
See Also:   java.sql.PreparedStatement
See Also:   org.mandarax.sql.SQLObjectRelationalMapping
author:
   Jens Dietrich
version:
   3.4 <7 March 05>
since:
   1.6



Field Summary
final public static  StringVARIABLE_PROXY
    

Constructor Summary
public  SQLFunction()
     Constructor.

Method Summary
public  booleanequals(Object obj)
     Compare objects.
public  DataSourcegetDataSource()
     Set the data source.
public  StringgetName()
     Get the name of the function.
public  SQLObjectRelationalMappinggetObjectRelationalMapping()
     Get the object relational mapping.
public  StringgetQuery()
     Get the query string.
public  ClassgetReturnType()
     Get the return type.
public  java.lang.Class[]getStructure()
     Get the type structure of the object, e.g.
public  inthashCode()
     Get the hashcode of the object.
public  booleanisCloseConnection()
     Indicates whether to close the connection at the end.
public  booleanisExecutable()
     Indicates whether the object (usually a term or a clause set) can be performed using the java semantics.
public  Objectperform(org.mandarax.kernel.Term[] parameter, Session session)
     Perform the function or predicate using an array of terms as parameters.
public  voidsetCloseConnection(boolean closeConnection)
     Sets whether to close the connection at the end.
public  voidsetDataSource(DataSource ds)
     Set the data source.
public  voidsetName(String n)
     Set the name.
public  voidsetObjectRelationalMapping(SQLObjectRelationalMapping map)
     Set the object relational mapping used.
public  voidsetQuery(String q)
     Set the query.
public  voidsetStructure(Class[] struct)
     Set the type structure of the object, e.g.
public  StringtoString()
     Convert the object to a string.

Field Detail
VARIABLE_PROXY
final public static String VARIABLE_PROXY(Code)




Constructor Detail
SQLFunction
public SQLFunction()(Code)
Constructor.




Method Detail
equals
public boolean equals(Object obj)(Code)
Compare objects.
Parameters:
  obj - another object a boolean



getDataSource
public DataSource getDataSource()(Code)
Set the data source. a data source.



getName
public String getName()(Code)
Get the name of the function. the name of the predicate



getObjectRelationalMapping
public SQLObjectRelationalMapping getObjectRelationalMapping()(Code)
Get the object relational mapping. a mapping



getQuery
public String getQuery()(Code)
Get the query string. a query



getReturnType
public Class getReturnType()(Code)
Get the return type. the return type of the function



getStructure
public java.lang.Class[] getStructure()(Code)
Get the type structure of the object, e.g. the types of terms that can be used with this constructor. Warning:Number and types must be consistent with the query and the column types in the table(s). an array of classes



hashCode
public int hashCode()(Code)
Get the hashcode of the object. the hash code of the object



isCloseConnection
public boolean isCloseConnection()(Code)
Indicates whether to close the connection at the end. a boolean



isExecutable
public boolean isExecutable()(Code)
Indicates whether the object (usually a term or a clause set) can be performed using the java semantics. true



perform
public Object perform(org.mandarax.kernel.Term[] parameter, Session session) throws UnsupportedOperationException, IllegalArgumentException(Code)
Perform the function or predicate using an array of terms as parameters. the result of the perform operation
Parameters:
  parameter - an array of terms
Parameters:
  session - a session object
throws:
  java.lang.UnsupportedOperationException -
throws:
  java.lang.IllegalArgumentException - thrown if any problem occurs, including connectionproblems, or the result set having one or more than one rows



setCloseConnection
public void setCloseConnection(boolean closeConnection)(Code)
Sets whether to close the connection at the end.
Parameters:
  closeConnection - a boolean



setDataSource
public void setDataSource(DataSource ds)(Code)
Set the data source.
Parameters:
  ds - a data source.



setName
public void setName(String n)(Code)
Set the name.
Parameters:
  n - a name



setObjectRelationalMapping
public void setObjectRelationalMapping(SQLObjectRelationalMapping map)(Code)
Set the object relational mapping used.
Parameters:
  map - a mapping



setQuery
public void setQuery(String q)(Code)
Set the query.
Parameters:
  q - a query string



setStructure
public void setStructure(Class[] struct)(Code)
Set the type structure of the object, e.g. the types of terms that can be used with this constructor. Warning:Number and types must be consistent with the query and the column types in the table(s). struct an array of classes



toString
public String toString()(Code)
Convert the object to a string. a string



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.