Top Description Fields Constructors Methods
org.eclipse.jetty.session

public Class DatabaseAdaptor

extends Object
Class Inheritance
Imports
java.io.ByteArrayInputStream, .InputStream, java.sql.Blob, .Connection, .DatabaseMetaData, .Driver, .DriverManager, .ResultSet, .SQLException, .SQLFeatureNotSupportedException, java.util.Locale, javax.naming.InitialContext, .NamingException, javax.sql.DataSource, org.slf4j.Logger, .LoggerFactory

DatabaseAdaptor Handles differences between databases. Postgres uses the getBytes and setBinaryStream methods to access a "bytea" datatype, which can be up to 1Gb of binary data. MySQL is happy to use the "blob" type and getBlob() methods instead.

Field Summary

Modifier and TypeField and Description
protected String
private String
private DataSource
pack-priv String
private Driver
private String
pack-priv boolean
pack-priv boolean
private String
protected String
protected String
pack-priv static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
public String

Returns:

the converted identifier
convertIdentifier
(String
the raw identifier
identifier
)

Convert a camel case identifier into either upper or lower depending on the way the db stores identifiers.

public InputStream
getBlobInputStream(ResultSet result, String columnName)

public String
protected Connection

Returns:

the connection for the datasource
getConnection
()

Get a connection from the driver or datasource.

public String
public DataSource
public String
public String
public Driver
public String
public String
public String
public void
public boolean
public boolean

Returns:

true if db in use is oracle
isRowIdReserved
()

rowId is a reserved word for Oracle, so change the name of this column

public void
setBlobType(String blobType)

public void
public void
public void
setDriverInfo(String
the driver classname
driverClassName
,
String
the driver connection url
connectionUrl
)

Configure jdbc connection information via a jdbc Driver

public void
setDriverInfo(Driver
the driver class
driverClass
,
String
the driver connection url
connectionUrl
)

Configure jdbc connection information via a jdbc Driver

public void
setLongType(String longType)

public void
setStringType(String stringType)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_blobTypeback to summary
protected String _blobType
_connectionUrlback to summary
private String _connectionUrl
_datasourceback to summary
private DataSource _datasource
_dbNameback to summary
pack-priv String _dbName
_driverback to summary
private Driver _driver
_driverClassNameback to summary
private String _driverClassName
_isLowerback to summary
pack-priv boolean _isLower
_isUpperback to summary
pack-priv boolean _isUpper
_jndiNameback to summary
private String _jndiName
_longTypeback to summary
protected String _longType
_stringTypeback to summary
protected String _stringType
LOGback to summary
pack-priv static final Logger LOG

Constructor Detail

DatabaseAdaptorback to summary
public DatabaseAdaptor()

Method Detail

adaptToback to summary
public void adaptTo(DatabaseMetaData dbMeta) throws SQLException
convertIdentifierback to summary
public String convertIdentifier(String identifier)

Convert a camel case identifier into either upper or lower depending on the way the db stores identifiers.

Parameters
identifier:String

the raw identifier

Returns:String

the converted identifier

getBlobInputStreamback to summary
public InputStream getBlobInputStream(ResultSet result, String columnName) throws SQLException
getBlobTypeback to summary
public String getBlobType()
getConnectionback to summary
protected Connection getConnection() throws SQLException

Get a connection from the driver or datasource.

Returns:Connection

the connection for the datasource

Exceptions
SQLException:
if unable to get the connection
getConnectionUrlback to summary
public String getConnectionUrl()
getDatasourceback to summary
public DataSource getDatasource()
getDatasourceNameback to summary
public String getDatasourceName()
getDBNameback to summary
public String getDBName()
getDriverback to summary
public Driver getDriver()
getDriverClassNameback to summary
public String getDriverClassName()
getLongTypeback to summary
public String getLongType()
getStringTypeback to summary
public String getStringType()
initializeback to summary
public void initialize() throws Exception
isEmptyStringNullback to summary
public boolean isEmptyStringNull()
isRowIdReservedback to summary
public boolean isRowIdReserved()

rowId is a reserved word for Oracle, so change the name of this column

Returns:boolean

true if db in use is oracle

setBlobTypeback to summary
public void setBlobType(String blobType)
setDatasourceback to summary
public void setDatasource(DataSource ds)
setDatasourceNameback to summary
public void setDatasourceName(String jndi)
setDriverInfoback to summary
public void setDriverInfo(String driverClassName, String connectionUrl)

Configure jdbc connection information via a jdbc Driver

Parameters
driverClassName:String

the driver classname

connectionUrl:String

the driver connection url

setDriverInfoback to summary
public void setDriverInfo(Driver driverClass, String connectionUrl)

Configure jdbc connection information via a jdbc Driver

Parameters
driverClass:Driver

the driver class

connectionUrl:String

the driver connection url

setLongTypeback to summary
public void setLongType(String longType)
setStringTypeback to summary
public void setStringType(String stringType)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override