public abstract class JdbcConnectionResource extends java.lang.Object implements EnvCleanup
Modifier and Type | Field and Description |
---|---|
protected ConnectionEntry |
_conn |
protected java.lang.String |
_driver |
protected int |
_flags |
protected java.lang.String |
_host |
protected boolean |
_isEmulatePrepares |
protected int |
_port |
protected java.lang.String |
_socket |
protected SqlParseToken |
_sqlParseToken |
protected java.lang.String |
_url |
Modifier | Constructor and Description |
---|---|
protected |
JdbcConnectionResource(Env env) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Implements the EnvCleanup interface.
|
protected void |
clearErrors() |
protected void |
close()
Closes the connection.
|
void |
closeStatement(java.sql.Statement stmt) |
boolean |
commit()
commits the transaction of the current connection
|
protected abstract ConnectionEntry |
connectImpl(Env env,
java.lang.String host,
java.lang.String userName,
java.lang.String password,
java.lang.String dbname,
int port,
java.lang.String socket,
int flags,
java.lang.String driver,
java.lang.String url,
boolean isNewLink,
boolean isEmulatePrepares)
Connects to the underlying database.
|
protected boolean |
connectInternal(Env env,
java.lang.String host,
java.lang.String userName,
java.lang.String password,
java.lang.String dbname,
int port,
java.lang.String socket,
int flags,
java.lang.String driver,
java.lang.String url,
boolean isNewLink,
boolean isEmulatePrepares)
Set the current underlying connection and
corresponding information: host, port and
database name.
|
protected java.sql.Statement |
createJavaStatement(Env env) |
protected JdbcResultResource |
createResult(java.sql.Statement stmt,
java.sql.ResultSet rs)
Creates a database-specific result.
|
protected JdbcStatementResource |
createStatement(Env env) |
protected JdbcStatementResource |
createStatementResource(Env env) |
StringValue |
error(Env env)
Returns the error string for the most recent function call.
|
int |
getAffectedRows()
Returns the affected rows from the last query.
|
boolean |
getAutoCommit() |
protected java.lang.String |
getCatalog() |
protected JdbcResultResource |
getCatalogs(Env env)
Returns JdbcResultResource of available databases
|
java.lang.String |
getCharacterSetName()
Returns the client encoding.
|
java.lang.String |
getClientEncoding()
Alias for getCharacterSetName
|
java.lang.String |
getClientInfo()
Deprecated.
|
protected java.lang.String |
getClientInfo(Env env) |
java.sql.Connection |
getConnection(Env env)
Returns the connection
|
java.lang.String |
getDbName() |
java.lang.String |
getDriver() |
protected java.lang.String |
getDriverName() |
protected int |
getErrorCode()
Returns the last error code.
|
protected java.lang.String |
getErrorMessage()
Returns the last error message.
|
protected java.sql.SQLException |
getException() |
int |
getFieldCount() |
java.lang.String |
getHost() |
java.lang.String |
getHostInfo()
returns the URL string for the given connection
IE: jdbc:mysql://localhost:3306/test
XXX: PHP returns Localhost via UNIX socket
|
protected java.sql.Connection |
getJavaConnection(Env env)
Returns the unwrapped SQL connection
associated to this statement.
|
java.lang.String |
getPassword() |
int |
getPort() |
protected JdbcResultResource |
getResultResource()
Get the current result resource
|
JdbcResultResource |
getResultSet() |
protected java.lang.String |
getServerInfo()
returns the server version
|
protected Value |
getServerStat(Env env) |
JdbcTableMetaData |
getTableMetaData(Env env,
java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Returns the table metadata.
|
java.lang.String |
getUrl() |
protected java.lang.String |
getURL()
Returns the data source.
|
java.lang.String |
getUserName() |
protected java.sql.SQLWarning |
getWarnings()
This function was added for PostgreSQL pg_last_notice
|
protected static int |
infoToVersion(java.lang.String info) |
boolean |
isConnected() |
boolean |
isEmulatePrepares() |
protected boolean |
isSeekable()
Returns true if this connection supports TYPE_SCROLL_INSENSITIVE.
|
protected void |
keepResourceValues(java.sql.Statement stmt)
This function is overriden in Postgres to keep
result set references for php/430a (see also php/1f33)
|
protected boolean |
keepStatementOpen()
This function is overriden in Postgres to keep
statement references for php/430a
|
protected SqlParseToken |
parseSqlToken(java.lang.String sql,
SqlParseToken prevToken)
Parse a token from a string containing a SQL statement.
|
boolean |
ping(Env env)
Pings the database
|
protected JdbcPreparedStatementResource |
prepare(Env env,
java.lang.String query) |
protected StringValue |
realEscapeString(Env env,
StringValue str)
Escape the given string for SQL statements.
|
protected Value |
realQuery(Env env,
java.lang.String sql)
Execute a single query.
|
boolean |
rollback()
rolls the current transaction back
NOTE: quercus doesn't seem to support the idea
of savepoints
|
protected void |
saveErrors(java.sql.SQLException e) |
void |
setAffectedRows(int i) |
boolean |
setAutoCommit(boolean mode)
sets auto-commmit to true or false
|
void |
setCatalog(Env env,
java.lang.String name)
Sets the catalog
|
boolean |
setClientEncoding(java.lang.String encoding)
Set encoding on the client side of the connection.
|
protected void |
setResultResource(JdbcResultResource rs)
Set the current result resource
|
protected void |
setWarnings(java.sql.SQLWarning warnings)
Set the current SQL warnings.
|
java.lang.Object |
toObject()
Converts to an object.
|
java.lang.String |
toString()
Converts to a string.
|
JdbcConnectionResource |
validateConnection(Env env) |
protected ConnectionEntry _conn
protected java.lang.String _host
protected int _port
protected java.lang.String _driver
protected java.lang.String _url
protected int _flags
protected java.lang.String _socket
protected boolean _isEmulatePrepares
protected SqlParseToken _sqlParseToken
protected JdbcConnectionResource(Env env)
protected JdbcPreparedStatementResource prepare(Env env, java.lang.String query)
protected JdbcStatementResource createStatementResource(Env env) throws java.sql.SQLException
java.sql.SQLException
protected final JdbcStatementResource createStatement(Env env) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String getDriverName()
public StringValue error(Env env)
public boolean isConnected()
public java.lang.String getHost()
public java.lang.String getUserName()
public java.lang.String getPassword()
public java.lang.String getDbName()
public int getPort()
public java.lang.String getDriver()
public java.lang.String getUrl()
public boolean isEmulatePrepares()
protected final boolean connectInternal(Env env, java.lang.String host, java.lang.String userName, java.lang.String password, java.lang.String dbname, int port, java.lang.String socket, int flags, java.lang.String driver, java.lang.String url, boolean isNewLink, boolean isEmulatePrepares)
host
- server hostport
- server portdbname
- database nameprotected abstract ConnectionEntry connectImpl(Env env, java.lang.String host, java.lang.String userName, java.lang.String password, java.lang.String dbname, int port, java.lang.String socket, int flags, java.lang.String driver, java.lang.String url, boolean isNewLink, boolean isEmulatePrepares)
protected StringValue realEscapeString(Env env, StringValue str)
str
- a stringpublic int getAffectedRows()
public void setAffectedRows(int i)
public int getFieldCount()
protected JdbcResultResource getCatalogs(Env env)
protected java.lang.String getCatalog()
public java.lang.String getCharacterSetName()
public java.lang.String getClientEncoding()
public boolean setClientEncoding(java.lang.String encoding)
protected java.lang.String getClientInfo(Env env)
public java.lang.String getClientInfo()
public final java.sql.Connection getConnection(Env env)
protected java.sql.Connection getJavaConnection(Env env) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String getURL()
protected int getErrorCode()
protected java.lang.String getErrorMessage()
protected java.sql.SQLException getException()
public java.lang.String getHostInfo() throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String getServerInfo() throws java.sql.SQLException
java.sql.SQLException
public JdbcTableMetaData getTableMetaData(Env env, java.lang.String catalog, java.lang.String schema, java.lang.String table) throws java.sql.SQLException
java.sql.SQLException
protected static int infoToVersion(java.lang.String info)
public void closeStatement(java.sql.Statement stmt)
protected void close()
public void cleanup()
cleanup
in interface EnvCleanup
public JdbcConnectionResource validateConnection(Env env)
protected java.sql.Statement createJavaStatement(Env env) throws java.sql.SQLException
java.sql.SQLException
protected SqlParseToken parseSqlToken(java.lang.String sql, SqlParseToken prevToken)
protected JdbcResultResource createResult(java.sql.Statement stmt, java.sql.ResultSet rs)
public JdbcResultResource getResultSet()
public boolean getAutoCommit()
public boolean setAutoCommit(boolean mode)
public boolean commit()
public boolean rollback()
public void setCatalog(Env env, java.lang.String name) throws java.sql.SQLException
java.sql.SQLException
public java.lang.Object toObject()
public java.lang.String toString()
toString
in class java.lang.Object
protected void keepResourceValues(java.sql.Statement stmt)
protected boolean keepStatementOpen()
protected JdbcResultResource getResultResource()
protected void setResultResource(JdbcResultResource rs)
protected java.sql.SQLWarning getWarnings()
public boolean ping(Env env)
protected void setWarnings(java.sql.SQLWarning warnings)
warnings
- the new SQL warningsprotected void clearErrors()
protected void saveErrors(java.sql.SQLException e)
protected boolean isSeekable()