Package adams.db
Class JDBC
- java.lang.Object
-
- adams.db.JDBC
-
public class JDBC extends Object
Utility class for JDBC.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static String
URL_MYSQL
the expression to match a MySQL JDBC URL.static String
URL_POSTGRESQL
the expression to match a PostgreSQL JDBC URL.static String
URL_SQLITE
the expression to match a SQLite JDBC URL.
-
Constructor Summary
Constructors Constructor Description JDBC()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AbstractTypes
getTypes(AbstractDatabaseConnection conn)
Returns the appropriate types.static AbstractTypes
getTypes(String url)
Returns the appropriate types.static boolean
isMySQL(AbstractDatabaseConnection conn)
Checks whether this connection represents a MySQL one.static boolean
isMySQL(String url)
Checks whether this JDBC url represents a MySQL URL.static boolean
isPostgreSQL(AbstractDatabaseConnection conn)
Checks whether this connection represents a PostgreSQL one.static boolean
isPostgreSQL(String url)
Checks whether this JDBC url represents a PostgreSQL URL.static boolean
isSQLite(AbstractDatabaseConnection conn)
Checks whether this connection represents a SQLite one.static boolean
isSQLite(String url)
Checks whether this JDBC url represents a SQLite URL.static String
regexpKeyword(AbstractDatabaseConnection conn)
Returns the keyword for regular expression matching in queries.static String
regexpKeyword(String url)
Returns the keyword for regular expression matching in queries.
-
-
-
Field Detail
-
URL_MYSQL
public static final String URL_MYSQL
the expression to match a MySQL JDBC URL.- See Also:
- Constant Field Values
-
URL_POSTGRESQL
public static final String URL_POSTGRESQL
the expression to match a PostgreSQL JDBC URL.- See Also:
- Constant Field Values
-
URL_SQLITE
public static final String URL_SQLITE
the expression to match a SQLite JDBC URL.- See Also:
- Constant Field Values
-
-
Method Detail
-
isMySQL
public static boolean isMySQL(String url)
Checks whether this JDBC url represents a MySQL URL.- Parameters:
url
- the URL to check- Returns:
- true if MySQL URL
- See Also:
URL_MYSQL
-
isMySQL
public static boolean isMySQL(AbstractDatabaseConnection conn)
Checks whether this connection represents a MySQL one.- Parameters:
conn
- the connection to check- Returns:
- true if MySQL URL
- See Also:
isMySQL(String)
-
isPostgreSQL
public static boolean isPostgreSQL(String url)
Checks whether this JDBC url represents a PostgreSQL URL.- Parameters:
url
- the URL to check- Returns:
- true if PostgreSQL URL
- See Also:
URL_POSTGRESQL
-
isPostgreSQL
public static boolean isPostgreSQL(AbstractDatabaseConnection conn)
Checks whether this connection represents a PostgreSQL one.- Parameters:
conn
- the connection to check- Returns:
- true if PostgreSQL URL
- See Also:
isPostgreSQL(String)
-
isSQLite
public static boolean isSQLite(String url)
Checks whether this JDBC url represents a SQLite URL.- Parameters:
url
- the URL to check- Returns:
- true if SQLite URL
- See Also:
URL_SQLITE
-
isSQLite
public static boolean isSQLite(AbstractDatabaseConnection conn)
Checks whether this connection represents a SQLite one.- Parameters:
conn
- the connection to check- Returns:
- true if SQLite URL
- See Also:
isSQLite(String)
-
regexpKeyword
public static String regexpKeyword(AbstractDatabaseConnection conn)
Returns the keyword for regular expression matching in queries.- Parameters:
conn
- the connection to retrieve the keyword for- Returns:
- the keyword
- Throws:
IllegalArgumentException
- if JDBC connection type not supported
-
regexpKeyword
public static String regexpKeyword(String url)
Returns the keyword for regular expression matching in queries.- Parameters:
url
- the connection to retrieve the keyword for- Returns:
- the keyword
- Throws:
IllegalArgumentException
- if JDBC connection type not supported
-
getTypes
public static AbstractTypes getTypes(AbstractDatabaseConnection conn)
Returns the appropriate types.- Parameters:
conn
- the connection to use for identification- Returns:
- the types
- Throws:
IllegalArgumentException
- if JDBC connection type not supported
-
getTypes
public static AbstractTypes getTypes(String url)
Returns the appropriate types.- Parameters:
url
- the URL to use for identification- Returns:
- the types
- Throws:
IllegalArgumentException
- if JDBC connection type not supported
-
-