public class SQLDatabaseTypeExtensionPoint extends AbstractThreadSafeComponentExtensionPoint<SQLDatabaseType>
SQLDatabaseType
Modifier and Type | Field and Description |
---|---|
static String |
ROLE
Avalon Role
|
_cocoonManager, _context, _manager
Constructor and Description |
---|
SQLDatabaseTypeExtensionPoint() |
Modifier and Type | Method and Description |
---|---|
InputStream |
getBlob(String dbType,
ResultSet resultSet,
int pos)
Get the InputStream to read a blob
|
InputStream |
getBlob(String dbType,
ResultSet resultSet,
String columnName)
Get the InputStream to read a blob
|
Map<String,I18nizableText> |
getSQLDatabaseTypes()
Get the SQL database types with their label
|
void |
initializeExtensions()
Finalize the initialization of the extensions.
This method is called after all addExtension() calls.This is the last step before the actual startup of the application. |
String |
languageEscapeTableName(String dbType,
String tableNameToEscape)
Some db systems requires the table names to be escaped
|
String |
languageLimitQuery(String dbType,
String queryToLimit,
String limit,
String offset)
Add a limit/offset element to the given query
|
void |
setBlob(String dbType,
PreparedStatement statement,
int pos,
byte[] bytes)
Set an array of bytes (UTF-8 encoded) into a blob, if you want to pass a String, you can use
setBlob(String, PreparedStatement, int, String) |
void |
setBlob(String dbType,
PreparedStatement statement,
int pos,
InputStream is,
long length)
Set an array of bytes (UTF-8 encoded) into a blob, if you want to pass a String, you can use
setBlob(String, PreparedStatement, int, String) |
void |
setBlob(String dbType,
PreparedStatement statement,
int pos,
String blob)
Set an String into a blob
|
addComponent, addExtension, contextualize, dispose, getExtension, getExtensionsIds, hasExtension, initialize, service
getLogger, setLogger
public SQLDatabaseTypeExtensionPoint()
public void initializeExtensions() throws Exception
ExtensionPoint
addExtension()
calls.initializeExtensions
in interface ExtensionPoint<SQLDatabaseType>
initializeExtensions
in class AbstractThreadSafeComponentExtensionPoint<SQLDatabaseType>
Exception
- if something wrong occurspublic Map<String,I18nizableText> getSQLDatabaseTypes()
public String languageEscapeTableName(String dbType, String tableNameToEscape)
dbType
- The identifier of the db type usedtableNameToEscape
- The non-null table namepublic String languageLimitQuery(String dbType, String queryToLimit, String limit, String offset)
dbType
- The identifier of the db type usedqueryToLimit
- The sql query that will be amendedlimit
- The max number of the results to returnoffset
- The initial offset of the results to returnpublic InputStream getBlob(String dbType, ResultSet resultSet, String columnName) throws SQLException
dbType
- The identifier of the db type usedresultSet
- the result set containing the blob.columnName
- columnSQLException
- if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result setpublic InputStream getBlob(String dbType, ResultSet resultSet, int pos) throws SQLException
dbType
- The identifier of the db type usedresultSet
- the result set containing the blob.pos
- column positionSQLException
- if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result setpublic void setBlob(String dbType, PreparedStatement statement, int pos, String blob) throws SQLException, UnsupportedEncodingException, IllegalArgumentException
dbType
- The identifier of the db type usedstatement
- The satement where the blob will be setpos
- position in the statementblob
- String representing the blobSQLException
- if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result setUnsupportedEncodingException
- if UTF-8 is not supportedIllegalArgumentException
- if the dbType is not foundpublic void setBlob(String dbType, PreparedStatement statement, int pos, byte[] bytes) throws SQLException, IllegalArgumentException
setBlob(String, PreparedStatement, int, String)
dbType
- The identifier of the db type usedstatement
- The satement where the blob will be setpos
- position in the statementbytes
- byte[] representing the blob, in UTF-8SQLException
- if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result setIllegalArgumentException
- if the dbType is not foundpublic void setBlob(String dbType, PreparedStatement statement, int pos, InputStream is, long length) throws SQLException, IllegalArgumentException
setBlob(String, PreparedStatement, int, String)
dbType
- The identifier of the db type usedstatement
- The satement where the blob will be setpos
- position in the statementis
- inputStream to put in the bloblength
- length of the streamSQLException
- if the columnLabel is not valid; if a database access error occurs or this method is called on a closed result setIllegalArgumentException
- if the dbType is not found