|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectchemaxon.util.DatabaseTools
public class DatabaseTools
Tools that can be applied in the development of applications accessing databases.
| Constructor Summary | |
|---|---|
DatabaseTools()
|
|
| Method Summary | |
|---|---|
static java.util.ArrayList |
getFieldNames(ConnectionHandler ch,
java.lang.String tableName,
java.util.ArrayList types)
Returns field names in a table. |
static int[] |
getFieldTypes(ConnectionHandler ch,
java.lang.String tableName)
Returns field types in a table. |
static boolean |
isConnectionAlive(java.sql.Connection con)
Checks if JDBC connection to a database is alive or not. |
static boolean |
isIntType(int type)
Determines if an SQL type is an integer |
static boolean |
isRealType(int type)
Determines if an SQL type is a non-integer number |
static boolean |
isTextType(int type)
Determines if an SQL type is a text type |
static byte[] |
readBytes(java.sql.ResultSet rs,
int idx)
Reads bytes from a ResultSet. |
static byte[] |
readBytes(java.sql.ResultSet rs,
java.lang.String columnName)
Reads bytes from a ResultSet. |
static java.lang.String |
readString(java.sql.ResultSet rs,
int idx)
Reads a String from a ResultSet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseTools()
| Method Detail |
|---|
public static boolean isConnectionAlive(java.sql.Connection con)
public static java.util.ArrayList getFieldNames(ConnectionHandler ch,
java.lang.String tableName,
java.util.ArrayList types)
throws java.sql.SQLException
ch - ConnectionHandler opened to the database.tableName - the name of the database table.types - ArrayList object to store type names in it.
java.sql.SQLException
public static int[] getFieldTypes(ConnectionHandler ch,
java.lang.String tableName)
throws java.sql.SQLException
ch - ConnectionHandler opened to the database.tableName - the name of the database table.
java.sql.SQLExceptionpublic static boolean isTextType(int type)
type - the SQL type
true, if the specified type is a text typepublic static boolean isIntType(int type)
type - the SQL type
true, if the specified type is an integer typepublic static boolean isRealType(int type)
type - the SQL type
true, if the specified type is a non-integer number
public static byte[] readBytes(java.sql.ResultSet rs,
int idx)
throws java.sql.SQLException
rs - the ResultSetidx - the index of the field (first column is 1)
java.sql.SQLException - in case of database error, or invalid column type
public static byte[] readBytes(java.sql.ResultSet rs,
java.lang.String columnName)
throws java.sql.SQLException
rs - the ResultSetcolumnName - the name of the field
java.sql.SQLException - in case of database error, or invalid column type
public static java.lang.String readString(java.sql.ResultSet rs,
int idx)
throws java.sql.SQLException
rs - the ResultSetidx - the index of the field (first column is 1)
java.sql.SQLException - in case of database error, or invalid column type
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||