Package org.neo4j.jdbc.impl
Class Neo4jConnectionImpl
- java.lang.Object
-
- org.neo4j.jdbc.impl.Neo4jConnectionImpl
-
- All Implemented Interfaces:
AutoCloseable,Connection,Wrapper,Neo4jConnection
public abstract class Neo4jConnectionImpl extends Object implements Neo4jConnection
- Since:
- 3.2.0
- Author:
- Gianmarco Laggia @ Larus B.A.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringFASTEST_STATEMENT-
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNeo4jConnectionImpl(Properties properties, String url, int defaultHoldability)Default constructor with properties.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort(Executor executor)protected voidcheckAutoCommit()Method to check if we are into autocommit mode.protected voidcheckClosed()Check if this connection is closed or not.protected voidcheckConcurrencyParams(int resultSetConcurrency)Check if the concurrency parameter conform to specification.protected voidcheckHoldabilityParams(int resultSetHoldability)Check if the holdability parameter conform to specification.protected voidcheckReadOnly(String query)Check if can execute the query into the current mode (ie.protected voidcheckTransactionIsolation(int level)Check if the transaction isolation level parameter conform to specification.protected voidcheckTypeParams(int resultSetType)Check if the resultset type parameter conform to specification.voidclearWarnings()Neo4jArraycreateArrayOf(String typeName, Object[] elements)BlobcreateBlob()ClobcreateClob()NClobcreateNClob()SQLXMLcreateSQLXML()StructcreateStruct(String typeName, Object[] attributes)protected voiddoSetReadOnly(boolean readOnly)StringgetCatalog()Default implementation of getCatalog.PropertiesgetClientInfo()StringgetClientInfo(String name)intgetFlattening()Get the flattening sample rows (-1 if no flattening).intgetHoldability()intgetNetworkTimeout()PropertiesgetProperties()Get the properties for this connection.protected booleangetReadOnly()StringgetSchema()intgetTransactionIsolation()Default implementation of getTransactionIsolation.Map<String,Class<?>>getTypeMap()StringgetUrl()Get the connection url.StringgetUserName()Get the user of this connection.SQLWarninggetWarnings()static booleanhasDebug(Properties properties)booleanisReadOnly()booleanisWrapperFor(Class<?> iface)StringnativeSQL(String sql)Default implementation of nativeSQL.CallableStatementprepareCall(String sql)CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)PreparedStatementprepareStatement(String sql, int autoGeneratedKeys)Default implementation of preparedStatement(String, int).PreparedStatementprepareStatement(String sql, int[] columnIndexes)PreparedStatementprepareStatement(String sql, String[] columnNames)voidreleaseSavepoint(Savepoint savepoint)voidrollback(Savepoint savepoint)voidsetCatalog(String catalog)Default implementation of setCatalog.voidsetClientInfo(String name, String value)voidsetClientInfo(Properties properties)voidsetHoldability(int holdability)voidsetNetworkTimeout(Executor executor, int milliseconds)voidsetReadOnly(boolean readOnly)SavepointsetSavepoint()SavepointsetSavepoint(String name)voidsetSchema(String schema)voidsetTransactionIsolation(int level)Default implementation of setTransactionIsolation.voidsetTypeMap(Map<String,Class<?>> map)<T> Tunwrap(Class<T> iface)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.Connection
beginRequest, close, commit, createStatement, createStatement, createStatement, endRequest, getAutoCommit, getMetaData, isClosed, isValid, prepareStatement, prepareStatement, prepareStatement, rollback, setAutoCommit, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid
-
-
-
-
Field Detail
-
FASTEST_STATEMENT
protected static final String FASTEST_STATEMENT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Neo4jConnectionImpl
protected Neo4jConnectionImpl(Properties properties, String url, int defaultHoldability)
Default constructor with properties.- Parameters:
properties- driver propertiesurl- connection urldefaultHoldability- connection holdability
-
-
Method Detail
-
hasDebug
public static boolean hasDebug(Properties properties)
-
getUrl
public String getUrl()
Get the connection url.- Specified by:
getUrlin interfaceNeo4jConnection- Returns:
- String the connection url
-
getProperties
public Properties getProperties()
Get the properties for this connection.- Specified by:
getPropertiesin interfaceNeo4jConnection- Returns:
- Properties the properties for this connection
-
getUserName
public String getUserName()
Get the user of this connection.- Specified by:
getUserNamein interfaceNeo4jConnection- Returns:
- String
-
getFlattening
public int getFlattening()
Get the flattening sample rows (-1 if no flattening).- Specified by:
getFlatteningin interfaceNeo4jConnection- Returns:
- int
-
checkClosed
protected void checkClosed() throws SQLExceptionCheck if this connection is closed or not. If it's closed, then we throw a SQLException, otherwise we do nothing.- Throws:
SQLException- sqlexception
-
checkAutoCommit
protected void checkAutoCommit() throws SQLExceptionMethod to check if we are into autocommit mode. If we do, then it throw an exception. This method is for using into commit and rollback method.- Throws:
SQLException- sqlexception
-
checkReadOnly
protected void checkReadOnly(String query) throws SQLException
Check if can execute the query into the current mode (ie. readonly or not). If we can't an SQLException is throw.- Parameters:
query- Cypher query- Throws:
SQLException- sqlexception
-
checkHoldabilityParams
protected void checkHoldabilityParams(int resultSetHoldability) throws SQLExceptionCheck if the holdability parameter conform to specification. If it doesn't, we throw an exception.Connection.setHoldability(int)- Parameters:
resultSetHoldability- The holdability value to check- Throws:
SQLException- sqlexception
-
checkConcurrencyParams
protected void checkConcurrencyParams(int resultSetConcurrency) throws SQLExceptionCheck if the concurrency parameter conform to specification. If it doesn't, we throw an exception.- Parameters:
resultSetConcurrency- The concurrency value to check- Throws:
SQLException- sqlexception
-
checkTypeParams
protected void checkTypeParams(int resultSetType) throws SQLExceptionCheck if the resultset type parameter conform to specification. If it doesn't, we throw an exception.- Parameters:
resultSetType- The concurrency value to check- Throws:
SQLException- sqlexception
-
checkTransactionIsolation
protected void checkTransactionIsolation(int level) throws SQLExceptionCheck if the transaction isolation level parameter conform to specification. If it doesn't, we throw an exception.- Parameters:
level- The transaction isolation level value to check- Throws:
SQLException- sqlexception
-
setReadOnly
public void setReadOnly(boolean readOnly) throws SQLException- Specified by:
setReadOnlyin interfaceConnection- Throws:
SQLException
-
isReadOnly
public boolean isReadOnly() throws SQLException- Specified by:
isReadOnlyin interfaceConnection- Throws:
SQLException
-
doSetReadOnly
protected void doSetReadOnly(boolean readOnly) throws SQLException- Throws:
SQLException
-
getReadOnly
protected boolean getReadOnly() throws SQLException- Throws:
SQLException
-
setHoldability
public void setHoldability(int holdability) throws SQLException- Specified by:
setHoldabilityin interfaceConnection- Throws:
SQLException
-
getHoldability
public int getHoldability() throws SQLException- Specified by:
getHoldabilityin interfaceConnection- Throws:
SQLException
-
setCatalog
public void setCatalog(String catalog) throws SQLException
Default implementation of setCatalog. Neo4j doesn't implement catalog feature, so we do nothing to avoid some tools exception.- Specified by:
setCatalogin interfaceConnection- Throws:
SQLException
-
getCatalog
public String getCatalog() throws SQLException
Default implementation of getCatalog. Neo4j doesn't implement catalog feature, so returnnull(@seeConnection.getCatalog())- Specified by:
getCatalogin interfaceConnection- Throws:
SQLException
-
getTransactionIsolation
public int getTransactionIsolation() throws SQLExceptionDefault implementation of getTransactionIsolation.- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
setTransactionIsolation
public void setTransactionIsolation(int level) throws SQLExceptionDefault implementation of setTransactionIsolation.- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
Default implementation of preparedStatement(String, int). We're just ignoring the autoGeneratedKeys param.- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
nativeSQL
public String nativeSQL(String sql) throws SQLException
Default implementation of nativeSQL. Here we should implement some hacks for JDBC tools if needed. This method must be used before running a query.- Specified by:
nativeSQLin interfaceConnection- Throws:
SQLException
-
unwrap
public <T> T unwrap(Class<T> iface) throws SQLException
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
isWrapperFor
public boolean isWrapperFor(Class<?> iface) throws SQLException
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
getWarnings
public SQLWarning getWarnings() throws SQLException
- Specified by:
getWarningsin interfaceConnection- Throws:
SQLException
-
clearWarnings
public void clearWarnings() throws SQLException- Specified by:
clearWarningsin interfaceConnection- Throws:
SQLException
-
getSchema
public String getSchema() throws SQLException
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
getTypeMap
public Map<String,Class<?>> getTypeMap() throws SQLException
- Specified by:
getTypeMapin interfaceConnection- Throws:
SQLException
-
setTypeMap
public void setTypeMap(Map<String,Class<?>> map) throws SQLException
- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException
-
setSavepoint
public Savepoint setSavepoint() throws SQLException
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
setSavepoint
public Savepoint setSavepoint(String name) throws SQLException
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
rollback
public void rollback(Savepoint savepoint) throws SQLException
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
releaseSavepoint
public void releaseSavepoint(Savepoint savepoint) throws SQLException
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException
-
prepareCall
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
createClob
public Clob createClob() throws SQLException
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createBlob
public Blob createBlob() throws SQLException
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createNClob
public NClob createNClob() throws SQLException
- Specified by:
createNClobin interfaceConnection- Throws:
SQLException
-
createSQLXML
public SQLXML createSQLXML() throws SQLException
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
setClientInfo
public void setClientInfo(String name, String value) throws SQLClientInfoException
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
setClientInfo
public void setClientInfo(Properties properties) throws SQLClientInfoException
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
getClientInfo
public String getClientInfo(String name) throws SQLException
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
getClientInfo
public Properties getClientInfo() throws SQLException
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
createArrayOf
public Neo4jArray createArrayOf(String typeName, Object[] elements) throws SQLException
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createStruct
public Struct createStruct(String typeName, Object[] attributes) throws SQLException
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
setSchema
public void setSchema(String schema) throws SQLException
- Specified by:
setSchemain interfaceConnection- Throws:
SQLException
-
abort
public void abort(Executor executor) throws SQLException
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
public int getNetworkTimeout() throws SQLException- Specified by:
getNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
-