Package org.neo4j.jdbc
Class Neo4jStatement
- java.lang.Object
-
- org.neo4j.jdbc.Neo4jStatement
-
- All Implemented Interfaces:
AutoCloseable,Statement,Wrapper,Loggable
- Direct Known Subclasses:
Neo4jPreparedStatement
public abstract class Neo4jStatement extends Object implements Statement, Loggable
- Since:
- 3.0.0
- Author:
- AgileLARUS
-
-
Field Summary
Fields Modifier and Type Field Description protected List<String>batchStatementsprotected Neo4jConnectionconnectionprotected ResultSetcurrentResultSetprotected intcurrentUpdateCountprotected booleandebugprotected intdebugLevelprotected int[]resultSetParams-
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNeo4jStatement(Neo4jConnection connection)Default constructor with JDBC connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBatch(String sql)voidcancel()protected voidcheckClosed()Check if this statement is closed or not.voidclearBatch()voidclearWarnings()Some tool call this method.voidclose()voidcloseOnCompletion()booleanexecute(String sql, int autoGeneratedKeys)booleanexecute(String sql, int[] columnIndexes)booleanexecute(String sql, String[] columnNames)intexecuteUpdate(String sql, int autoGeneratedKeys)intexecuteUpdate(String sql, int[] columnIndexes)intexecuteUpdate(String sql, String[] columnNames)Neo4jConnectiongetConnection()intgetDebugLevel()intgetFetchDirection()intgetFetchSize()ResultSetgetGeneratedKeys()intgetMaxFieldSize()intgetMaxRows()booleangetMoreResults()If there's a result set to consume, it's truebooleangetMoreResults(int current)intgetQueryTimeout()Added just for value memorizationResultSetgetResultSet()Like javadoc said, this method should be called one time.intgetResultSetConcurrency()intgetResultSetHoldability()intgetResultSetType()intgetUpdateCount()/!\ Like javadoc said, this method should be called one times.SQLWarninggetWarnings()Some tool call this method, so for now just respond null.booleanhasDebug()booleanisClosed()booleanisCloseOnCompletion()booleanisPoolable()booleanisWrapperFor(Class<?> iface)voidsetCursorName(String name)voidsetDebug(boolean debug)voidsetDebugLevel(int level)voidsetEscapeProcessing(boolean enable)voidsetFetchDirection(int direction)voidsetFetchSize(int rows)Some tools call this method, so this just a workaround to make it work.voidsetMaxFieldSize(int max)voidsetMaxRows(int max)voidsetPoolable(boolean poolable)voidsetQueryTimeout(int seconds)Added just for value memorization<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.Statement
enquoteIdentifier, enquoteLiteral, enquoteNCharLiteral, execute, executeBatch, executeLargeBatch, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeLargeUpdate, executeQuery, executeUpdate, getLargeMaxRows, getLargeUpdateCount, isSimpleIdentifier, setLargeMaxRows
-
-
-
-
Field Detail
-
connection
protected Neo4jConnection connection
-
currentResultSet
protected ResultSet currentResultSet
-
currentUpdateCount
protected int currentUpdateCount
-
debug
protected boolean debug
-
debugLevel
protected int debugLevel
-
resultSetParams
protected int[] resultSetParams
-
-
Constructor Detail
-
Neo4jStatement
protected Neo4jStatement(Neo4jConnection connection)
Default constructor with JDBC connection.- Parameters:
connection- The JDBC connection
-
-
Method Detail
-
checkClosed
protected void checkClosed() throws SQLExceptionCheck if this statement is closed or not. If it is, we throw an exception.- Throws:
SQLException- sqlexception
-
getConnection
public Neo4jConnection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceStatement- Throws:
SQLException
-
getUpdateCount
public int getUpdateCount() throws SQLException/!\ Like javadoc said, this method should be called one times. Bolt statement always return two results : ResulSet and updatecount. Because each time we retrieve a data we set it to the default value here we have two cases : - if there a resultset : we tell it by responding -1 - otherwise we give the updatecount and reset its value to default- Specified by:
getUpdateCountin interfaceStatement- Throws:
SQLException
-
getResultSet
public ResultSet getResultSet() throws SQLException
Like javadoc said, this method should be called one time.- Specified by:
getResultSetin interfaceStatement- Throws:
SQLException
-
getMaxRows
public int getMaxRows() throws SQLException- Specified by:
getMaxRowsin interfaceStatement- Throws:
SQLException
-
setMaxRows
public void setMaxRows(int max) throws SQLException- Specified by:
setMaxRowsin interfaceStatement- Throws:
SQLException
-
isClosed
public boolean isClosed() throws SQLException- Specified by:
isClosedin interfaceStatement- Throws:
SQLException
-
close
public void close() throws SQLException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceStatement- 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
-
setFetchSize
public void setFetchSize(int rows) throws SQLExceptionSome tools call this method, so this just a workaround to make it work. If you set the fetch at Integer.MIN_VALUE, or if you put maxRows to -1, there is no exception. It's pretty much the same hack as the mysql connector.- Specified by:
setFetchSizein interfaceStatement- Throws:
SQLException
-
getMoreResults
public boolean getMoreResults() throws SQLExceptionIf there's a result set to consume, it's true- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getWarnings
public SQLWarning getWarnings() throws SQLException
Some tool call this method, so for now just respond null. It will be possible to implement this an explain.- Specified by:
getWarningsin interfaceStatement- Throws:
SQLException
-
clearWarnings
public void clearWarnings() throws SQLExceptionSome tool call this method.- Specified by:
clearWarningsin interfaceStatement- Throws:
SQLException
-
getQueryTimeout
public int getQueryTimeout() throws SQLExceptionAdded just for value memorization- Specified by:
getQueryTimeoutin interfaceStatement- Returns:
- the current query timeout limit in seconds; zero means there is no limit
- Throws:
SQLException- if a database error occurs
-
setQueryTimeout
public void setQueryTimeout(int seconds) throws SQLExceptionAdded just for value memorization- Specified by:
setQueryTimeoutin interfaceStatement- Parameters:
seconds- the new query timeout limit in seconds; zero means there is no limit- Throws:
SQLException- if a database error occurs
-
addBatch
public void addBatch(String sql) throws SQLException
- Specified by:
addBatchin interfaceStatement- Throws:
SQLException
-
clearBatch
public void clearBatch() throws SQLException- Specified by:
clearBatchin interfaceStatement- Throws:
SQLException
-
getResultSetConcurrency
public int getResultSetConcurrency() throws SQLException- Specified by:
getResultSetConcurrencyin interfaceStatement- Throws:
SQLException
-
getResultSetType
public int getResultSetType() throws SQLException- Specified by:
getResultSetTypein interfaceStatement- Throws:
SQLException
-
getResultSetHoldability
public int getResultSetHoldability() throws SQLException- Specified by:
getResultSetHoldabilityin interfaceStatement- Throws:
SQLException
-
execute
public boolean execute(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
public boolean execute(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
execute
public boolean execute(String sql, String[] columnNames) throws SQLException
- Specified by:
executein interfaceStatement- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, int[] columnIndexes) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
executeUpdate
public int executeUpdate(String sql, String[] columnNames) throws SQLException
- Specified by:
executeUpdatein interfaceStatement- Throws:
SQLException
-
getMaxFieldSize
public int getMaxFieldSize() throws SQLException- Specified by:
getMaxFieldSizein interfaceStatement- Throws:
SQLException
-
setMaxFieldSize
public void setMaxFieldSize(int max) throws SQLException- Specified by:
setMaxFieldSizein interfaceStatement- Throws:
SQLException
-
setEscapeProcessing
public void setEscapeProcessing(boolean enable) throws SQLException- Specified by:
setEscapeProcessingin interfaceStatement- Throws:
SQLException
-
setCursorName
public void setCursorName(String name) throws SQLException
- Specified by:
setCursorNamein interfaceStatement- Throws:
SQLException
-
setFetchDirection
public void setFetchDirection(int direction) throws SQLException- Specified by:
setFetchDirectionin interfaceStatement- Throws:
SQLException
-
getFetchDirection
public int getFetchDirection() throws SQLException- Specified by:
getFetchDirectionin interfaceStatement- Throws:
SQLException
-
getFetchSize
public int getFetchSize() throws SQLException- Specified by:
getFetchSizein interfaceStatement- Throws:
SQLException
-
getMoreResults
public boolean getMoreResults(int current) throws SQLException- Specified by:
getMoreResultsin interfaceStatement- Throws:
SQLException
-
getGeneratedKeys
public ResultSet getGeneratedKeys() throws SQLException
- Specified by:
getGeneratedKeysin interfaceStatement- Throws:
SQLException
-
cancel
public void cancel() throws SQLException- Specified by:
cancelin interfaceStatement- Throws:
SQLException
-
setPoolable
public void setPoolable(boolean poolable) throws SQLException- Specified by:
setPoolablein interfaceStatement- Throws:
SQLException
-
isPoolable
public boolean isPoolable() throws SQLException- Specified by:
isPoolablein interfaceStatement- Throws:
SQLException
-
closeOnCompletion
public void closeOnCompletion() throws SQLException- Specified by:
closeOnCompletionin interfaceStatement- Throws:
SQLException
-
isCloseOnCompletion
public boolean isCloseOnCompletion() throws SQLException- Specified by:
isCloseOnCompletionin interfaceStatement- Throws:
SQLException
-
setDebugLevel
public void setDebugLevel(int level)
- Specified by:
setDebugLevelin interfaceLoggable
-
getDebugLevel
public int getDebugLevel()
- Specified by:
getDebugLevelin interfaceLoggable
-
-