Package adams.db.queries
Class AbstractDatabaseQueries
- java.lang.Object
-
- adams.db.queries.AbstractDatabaseQueries
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
QueriesH2
,QueriesMSSQL
,QueriesMySQL
,QueriesPostgreSQL
,QueriesSQLite
public abstract class AbstractDatabaseQueries extends Object implements Serializable
Ancestor for SQL queries classes.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static Map<String,AbstractDatabaseQueries>
m_Cache
for caching types on URLs.protected static List<AbstractDatabaseQueries>
m_Types
the available types.
-
Constructor Summary
Constructors Constructor Description AbstractDatabaseQueries()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AbstractDatabaseQueries
getHandler(String url)
Returns the handler for the JDBC url.abstract boolean
handles(String url)
Checks whether this URL is handled.String
limit(int max)
Generates the row limiting expression.abstract String
limitKeyword()
Returns the keyword/expression for limiting the number of rows.String
regexp(String col, BaseRegExp expr)
Generates a regexp expression from the column and regular expression.String
regexp(String col, String expr)
Generates a regexp expression from the column and regular expression.abstract String
regexpKeyword()
Returns the keyword for regular expression matching in queries.
-
-
-
Field Detail
-
m_Cache
protected static Map<String,AbstractDatabaseQueries> m_Cache
for caching types on URLs.
-
m_Types
protected static List<AbstractDatabaseQueries> m_Types
the available types.
-
-
Method Detail
-
regexpKeyword
public abstract String regexpKeyword()
Returns the keyword for regular expression matching in queries.- Returns:
- the keyword
-
regexp
public String regexp(String col, BaseRegExp expr)
Generates a regexp expression from the column and regular expression.- Returns:
- the expression
-
regexp
public String regexp(String col, String expr)
Generates a regexp expression from the column and regular expression.- Returns:
- the expression
-
limitKeyword
public abstract String limitKeyword()
Returns the keyword/expression for limiting the number of rows.- Returns:
- the keyword/expression
-
limit
public String limit(int max)
Generates the row limiting expression. NB: requires an ORDER BY in the statement.- Parameters:
max
- the maximum number of rows to return- Returns:
- the expression
-
handles
public abstract boolean handles(String url)
Checks whether this URL is handled.- Parameters:
url
- the URL to check- Returns:
- true if handled by this type class
-
getHandler
public static AbstractDatabaseQueries getHandler(String url)
Returns the handler for the JDBC url.- Parameters:
url
- the URL- Returns:
- the handler, null if no support available
-
-