public class GenericDB extends Object
| Modifier and Type | Field and Description |
|---|---|
static BaseDB |
dbtypeMYSQL |
static BaseDB |
dbtypeORACLE |
static BaseDB |
dbtypePOSTGRESQL |
static BaseDB |
dbtypeUNKNOWN |
| Modifier and Type | Method and Description |
|---|---|
static String |
getCheckString(BaseDB dbtype) |
static BaseDB |
getDbType(Connection dbc)
Tries to return a database type for the connection passed.
|
static BaseDB |
getDbTypeByDriverName(String dn) |
static int |
getFullSequenceID(Connection dbc,
String tablename) |
static Reader |
getLobReader(Connection dbc,
ResultSet rs,
int col)
Returns a Reader from the blob (clob) column specified.
|
static Reader |
getLobReader(Connection dbc,
ResultSet rs,
String col)
Returns a Reader from the blob (clob) column specified.
|
static InputStream |
getLobStream(Connection dbc,
ResultSet rs,
int col)
Returns an InputStream from the blob (clob) column specified.
|
static InputStream |
getLobStream(Connection dbc,
ResultSet rs,
String col)
Returns an InputStream from the blob (clob) column specified.
|
static String |
getScriptResource(Connection dbc,
Class<?> clz,
String baseName)
Get a database script as a resource.
|
static int |
getSequenceID(Connection dbc,
String tablename)
Returns a sequence number that can be used to create a new PK for a
record in the given table.
|
static void |
runScriptResource(Connection dbc,
Class<?> clz,
String name,
StringBuilder errors)
Run a script resource with some basic name.
|
static boolean |
saveBlob(ResultSet rs,
int col,
File f)
Saves a BLOB from a resultset to a file using Oracle semantics.
|
static boolean |
saveBlob(ResultSet rs,
int col,
OutputStream os) |
static boolean |
saveBlob(ResultSet rs,
String col,
File f) |
static void |
setBlob(Connection dbc,
String table,
String column,
String[] pkfields,
Object[] key,
File f) |
static void |
setBlob(Connection dbc,
String table,
String column,
String[] pkfields,
Object[] key,
InputStream is,
int len) |
static void |
setBlob(Connection dbc,
String table,
String column,
String where,
byte[][] data)
Writes a blob to the requested record.
|
static void |
setBlob(Connection dbc,
String table,
String column,
String where,
File f)
Writes a blob to the requested record.
|
static void |
setBlob(Connection dbc,
String table,
String column,
String where,
InputStream is,
int len)
Writes a blob to the requested record.
|
static void |
setBlob(Connection dbc,
String table,
String column,
String where,
String str) |
static void |
setClob(Connection dbc,
String table,
String column,
String where,
Reader r) |
static void |
setClob(Connection dbc,
String table,
String column,
String where,
String content) |
public static final BaseDB dbtypeUNKNOWN
public static final BaseDB dbtypeORACLE
public static final BaseDB dbtypeMYSQL
public static final BaseDB dbtypePOSTGRESQL
public static BaseDB getDbType(Connection dbc)
dbc - the connection to checkpublic static int getSequenceID(Connection dbc, String tablename) throws SQLException
dbc - tablename - SQLExceptionpublic static int getFullSequenceID(Connection dbc, String tablename) throws SQLException
SQLExceptionpublic static void setBlob(Connection dbc, String table, String column, String where, File f) throws Exception
Exceptionpublic static void setBlob(Connection dbc, String table, String column, String where, String str) throws Exception
Exceptionpublic static void setBlob(Connection dbc, String table, String column, String where, InputStream is, int len) throws Exception
Exceptionpublic static void setBlob(Connection dbc, String table, String column, String where, byte[][] data) throws Exception
Exceptionpublic static void setBlob(Connection dbc, String table, String column, String[] pkfields, Object[] key, InputStream is, int len) throws SQLException
SQLExceptionpublic static void setBlob(Connection dbc, String table, String column, String[] pkfields, Object[] key, File f) throws SQLException
SQLExceptionpublic static Reader getLobReader(Connection dbc, ResultSet rs, int col) throws Exception
rs - col - Exceptionpublic static Reader getLobReader(Connection dbc, ResultSet rs, String col) throws Exception
rs - col - Exceptionpublic static InputStream getLobStream(Connection dbc, ResultSet rs, int col) throws Exception
rs - col - Exceptionpublic static InputStream getLobStream(Connection dbc, ResultSet rs, String col) throws Exception
rs - col - Exceptionpublic static void setClob(Connection dbc, String table, String column, String where, Reader r) throws Exception
Exceptionpublic static void setClob(Connection dbc, String table, String column, String where, String content) throws Exception
Exceptionpublic static boolean saveBlob(ResultSet rs, int col, File f) throws Exception
Exceptionpublic static boolean saveBlob(ResultSet rs, String col, File f) throws Exception
Exceptionpublic static boolean saveBlob(ResultSet rs, int col, OutputStream os) throws Exception
Exception@Nonnull public static String getScriptResource(@Nonnull Connection dbc, @Nonnull Class<?> clz, @Nonnull String baseName) throws Exception
dbc - clz - baseName - SQLExceptionExceptionpublic static void runScriptResource(Connection dbc, Class<?> clz, String name, StringBuilder errors) throws Exception
dbc - clz - name - errors - ExceptionCopyright © 2017 etc.to. All rights reserved.