|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.db.DbHelper
Field Summary | |
static int |
DB_DEFAULT
|
static int |
DB_MAX
|
static int |
DB_ORACLE
|
static int |
DB_POSTGRES
|
Method Summary | |
static int |
getDatabase()
This will return the type of database that is being used by the system. |
static int |
getDatabase(Connection conn)
|
static int |
getDatabase(DatabaseMetaData md)
|
static int |
getDatabase(ResultSet rs)
|
static int |
getDatabase(Statement stmt)
|
static String |
getDatabaseDirectory()
Gets the directory name for the current database |
static String |
getDatabaseDirectory(int database)
Gets the directory name to be used for database specific files |
static int |
getDatabaseFromURL(String url)
Parses the JDBC url to determine the database type, will return DB_DEFAULT if no supported database is determined. |
static String |
getDatabaseName(int database)
Gets the pretty name for a given database integer identifier. |
static String |
getDatabaseSuffix()
Gets the filename suffix used to distinguish between resource files based on database. |
static String |
getDatabaseSuffix(int database)
Gets the filename suffix used to distinguish between resource files based on database. |
static String[] |
getDatabaseSuffixes()
|
static void |
setDatabase(int database)
Sets the database type. |
static String |
truncateString(String s,
int maxLength)
Truncate a string to a specified length, respecting character boundaries. |
static void |
unsupportedDatabaseError(String operation)
Convenience method for throwing a DbUnsupportedException filling in the message for the current database type. |
static int |
varcharLength(String str)
Returns the width of the VARCHAR column required to store str in the database. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int DB_DEFAULT
public static final int DB_ORACLE
public static final int DB_POSTGRES
public static final int DB_MAX
Method Detail |
public static void setDatabase(int database)
public static int getDatabase()
public static int getDatabase(DatabaseMetaData md)
public static int getDatabase(Connection conn)
public static int getDatabase(Statement stmt)
public static int getDatabase(ResultSet rs)
public static String getDatabaseDirectory()
public static String getDatabaseDirectory(int database)
public static String getDatabaseSuffix()
public static String getDatabaseSuffix(int database)
public static String[] getDatabaseSuffixes()
public static int getDatabaseFromURL(String url)
public static String getDatabaseName(int database)
public static void unsupportedDatabaseError(String operation)
public static int varcharLength(String str)
str
in the database.
This abstracts the differences in the interpretation of, say, VARCHAR(100) in Oracle and Postgres. In Oracle, this means 100 bytes. Therefore, a 100-character long string may not fit in a VARCHAR(100) column in Oracle, depending on the particular encoding used. In Postgres, VARCHAR(100) means 100 characters.
str
is null
; otherwise a
db-specific positive value.public static String truncateString(String s, int maxLength)
s
- The string to be truncated.maxLength
- The maximum length of the string, in units that
are database-dependent (for PG, characters; for Oracle, bytes).varcharLength(String)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |