|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.opengamma.elsql.ElSqlConfig
public class ElSqlConfig
Configuration that provides support for differences between databases.
The class provides SQL fragments that the tags use to build the complete SQL. Some standard implementations have been provided, but subclasses may be added.
Implementations must be thread-safe.
| Field Summary | |
|---|---|
static ElSqlConfig |
DEFAULT
A constant for the standard set of config, based on ANSI SQL. |
static ElSqlConfig |
HSQL
A constant for the config needed for HSQL, which escapes the LIKE clause. |
static ElSqlConfig |
MYSQL
A constant for the config needed for MySQL, which uses LIMIT-OFFSET instead of FETCH-OFFSET. |
static ElSqlConfig |
ORACLE
A constant for the config needed for Oracle RDBMS. |
static ElSqlConfig |
POSTGRES
A constant for the config needed for Postgres, the same as DEFAULT. |
static ElSqlConfig |
SQL_SERVER_2008
A constant for the config needed for SQL Server 2008, which pages in a different way. |
static ElSqlConfig |
VERTICA
A constant for the config needed for Vertica, the same as DEFAULT. |
| Constructor Summary | |
|---|---|
ElSqlConfig(String name)
Creates an instance. |
|
| Method Summary | |
|---|---|
String |
addPaging(String selectToPage,
int offset,
int fetchLimit)
Alters the supplied SQL to add paging, such as OFFSET-FETCH. |
String |
getLikeSuffix()
Gets the suffix to add after LIKE, which would typically be an ESCAPE clause. |
String |
getName()
Gets the config name. |
String |
getPaging(int offset,
int fetchLimit)
Gets the paging SQL, such as OFFSET-FETCH. |
boolean |
isLikeWildcard(String value)
Checks if the value contains a wildcard. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final ElSqlConfig DEFAULT
public static final ElSqlConfig POSTGRES
DEFAULT.
public static final ElSqlConfig HSQL
public static final ElSqlConfig MYSQL
public static final ElSqlConfig ORACLE
public static final ElSqlConfig SQL_SERVER_2008
public static final ElSqlConfig VERTICA
DEFAULT.
| Constructor Detail |
|---|
public ElSqlConfig(String name)
name - a descriptive name for the config, not null| Method Detail |
|---|
public final String getName()
public boolean isLikeWildcard(String value)
The default implementation matches % and _, using backslash as an escape character. This matches Postgres and other databases.
value - the value to check, not null
public String getLikeSuffix()
The default implementation returns an empty string. This matches Postgres and other databases.
The returned SQL must be end in a space if non-empty.
public String addPaging(String selectToPage,
int offset,
int fetchLimit)
The default implementation calls getPaging(int, int).
The returned SQL must be end in a space if non-empty.
selectToPage - the SELECT statement to page, not nulloffset - the OFFSET amount, zero to start from the beginningfetchLimit - the FETCH/LIMIT amount, zero to fetch all
public String getPaging(int offset,
int fetchLimit)
The default implementation uses 'FETCH FIRST n ROWS ONLY' or 'OFFSET n ROWS FETCH NEXT n ROWS ONLY'. This matches Postgres, HSQL and other databases.
The returned SQL must be end in a space if non-empty.
offset - the OFFSET amount, zero to start from the beginningfetchLimit - the FETCH/LIMIT amount, zero to fetch all
public String toString()
toString in class Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||