This interface permits to adapte the use of a JDBC driver and the SQL type
for the non conformance of a Database.
escapeFunctionClose
public void escapeFunctionClose(StringBuffer function)
Modifies the end of a function expression for the escape syntax.
The JDBC standard syntax is "fn{function}".
function
- the function expression to be escaped
escapeFunctionOpen
public void escapeFunctionOpen(StringBuffer function)
Modifies the start of a function expression for the escape syntax.
The JDBC standard syntax is "fn{function}".
function
- the function expression to be escaped
existTable
public boolean existTable(Connection connection,
String tableName)
throws SQLException
checks the table existence
connection
- is the JDBC connection to usetableName
- is the name of the table
- true if the table exists, otherwise false.
existView
public boolean existView(Connection connection,
String viewName)
throws SQLException
checks the view existence
connection
- is the JDBC connection to useviewName
- is the name of the view
- true if the view exists, otherwise false.
fetchResultSetSize
public int fetchResultSetSize(ResultSet rs)
throws SQLException
This method calculates the size of a result set window. If this feature is not
supported by a database or its jdbc driver, this method returns -1.
rs
- the result set which the size must be returned
getColumnAliasExpr
public String getColumnAliasExpr(String aliasName)
Returns a column alias expression. To be used when constructing
the string expression of a select clause.
For example, most database recognize the syntax
'select A as ALIAS_FOR_A, B as ALIAS_FOR_B ... '
whereas Orabcle accepts the following syntax :
'select A "ALIAS_FOR_A", B "ALIAS_FOR_B" '
aliasName
- the column alias
getConcatExpression
public String getConcatExpression(String op1,
String op2)
- the use of the concat operator between two strings
getFirstLocateExpression
public String getFirstLocateExpression(String substring,
String instring)
throws RdbAdapterException
Returns the expression for searching the position of the first occurrence
of a substring in a string.
Three main syntaxes are found: position(substr in str), locate(substr, srt)
and instr(str, substr).
substring
- The substring searchedinstring
- The string in which to search the substring
- The corresponding relational expression.
getIndexedLocateExpression
public String getIndexedLocateExpression(String inputString,
String substring,
String fromIndex)
throws RdbAdapterException
Returns the expression for searching the position of the first occurrence
of a substring in a string starting from a given index.
Two main syntaxes are found: instr() and locate()
inputString
- The string in which to search the substringsubstring
- The substring searchedfromIndex
- The index from which to start searching
- The corresponding relational expression.
getLengthOperator
public String getLengthOperator()
throws RdbAdapterException
- the name of the length operator
getName
public String getName()
- The name of the RdbAdapter. This name is used in the factory to
register the RdbAdapter instance. In addition it is supposes that the
adapter is a part of the class name of the rdb adapter in respect to the
following pattern: org.objectweb.jorm.mapper.rdb.XxxxAdapter where Xxxx
is the adapter name with the upper first letter.
getQuery
public String getQuery(String selectClause,
List jts,
String whereclause,
int rangeFrom,
int rangeSize)
Builds a query with join and table alias.
The implementation must use writeTableAlias(String StringBuffer) method.
selectClause
- is a string representation of the select clausejts
- is the tables with their joinwhereclause
- is a string representation of the where clauserangeFrom
- is the rank of the first row to be returned in case of
a range limit, starting at 0rangeSize
- is the number of rows to be returned in case of a range
limit. The convention is that Integer.MAX_VALUE means no range limit.
getSubqueryAlias
public String getSubqueryAlias()
In the case the subquery needs to be aliased (Postgres), returns a string
to be appended to the subquery.
- the String to be appended to the subquery
handleOrderBy
public String handleOrderBy(String query)
supportBatchPreparedStatement
public boolean supportBatchPreparedStatement()
Indicates if the driver supports the batch of PreparedStatement
writeColumnAlias
public void writeColumnAlias(String alias,
StringBuffer sb)
Append a column alias to an SQL expression. To be used when constructing
the string expression of a select clause.
For example, most database recognize the syntax
'select A as ALIAS_FOR_A, B as ALIAS_FOR_B ... '
whereas Orabcle accepts the following syntax :
'select A "ALIAS_FOR_A", B "ALIAS_FOR_B" '
alias
- the column aliassb
- The StringBuffer into which to write the alias.
writeTableAlias
public void writeTableAlias(String alias,
StringBuffer sb)
Append a table alias to an SQL expression. To be used when constructing
the string expression of a from clause.
For example, most database recognize the syntax
'select ... from R as ALIAS_FOR_R, S as ALIAS_FOR_S ... '
whereas Orabcle accepts the following syntax :
'select ... from R ALIAS_FOR_R, S ALIAS_FOR_S ... '
alias
- The table aliassb
- The StringBuffer into which to write the alias.