| java.lang.Object org.relique.jdbc.csv.CsvConnection
CsvConnection | public class CsvConnection implements Connection(Code) | | This class implements the Connection interface for the CsvJdbc driver.
author: Zoran Milakovic |
Method Summary | |
public void | clearWarnings() Clears all warnings reported for this Connection object. | public void | close() Releases this Connection object's database and JDBC
resources immediately instead of waiting for them to be automatically
released.
Calling the method close on a Connection
object that is already closed is a no-op.
Note: A Connection object is automatically
closed when it is garbage collected. | public void | commit() Makes all changes made since the previous
commit/rollback permanent and releases any database locks
currently held by this Connection object. | public Array | createArrayOf(String typeName, Object[] elements) | public Blob | createBlob() | public Clob | createClob() | public NClob | createNClob() | public SQLXML | createSQLXML() | public Statement | createStatement() Creates a Statement object for sending
SQL statements to the database.
SQL statements without parameters are normally
executed using Statement objects. | public Statement | createStatement(int resultSetType, int resultSetConcurrency) Creates a Statement object that will generate
ResultSet objects with the given type and concurrency. | public Statement | createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) | public Struct | createStruct(String typeName, Object[] attributes) | public boolean | getAutoCommit() Retrieves the current auto-commit mode for this Connection
object. | protected String | getCarriageReturnEscape() | public String | getCatalog() Retrieves this Connection object's current catalog name. | protected String | getCharset() | public Properties | getClientInfo() | public String | getClientInfo(String name) | protected String | getExtension() | public int | getHoldability() Retrieves the current holdability of ResultSet objects created
using this Connection object. | protected String | getLineBreakEscape() | protected long | getMaxFileSize() | public DatabaseMetaData | getMetaData() Retrieves a DatabaseMetaData object that contains
metadata about the database to which this
Connection object represents a connection. | protected String | getPath() | protected char | getSeperator() | public int | getTransactionIsolation() Retrieves this Connection object's current
transaction isolation level. | public Map | getTypeMap() Retrieves the Map object associated with this
Connection object. | protected boolean | getUseQuotes() | protected boolean | getUseQuotesEscape() | public SQLWarning | getWarnings() Retrieves the first warning reported by calls on this
Connection object. | public boolean | isClosed() Retrieves whether this Connection object has been
closed. | public boolean | isReadOnly() Retrieves whether this Connection
object is in read-only mode. | protected boolean | isSuppressHeaders() | protected boolean | isTrimString() | public boolean | isValid(int timeout) | public boolean | isWrapperFor(Class> iface) | public String | nativeSQL(String sql) Converts the given SQL statement into the system's native SQL grammar.
A driver may convert the JDBC SQL grammar into its system's
native SQL grammar prior to sending it. | public CallableStatement | prepareCall(String sql) Creates a CallableStatement object for calling
database stored procedures.
The CallableStatement object provides
methods for setting up its IN and OUT parameters, and
methods for executing the call to a stored procedure.
Note: This method is optimized for handling stored
procedure call statements. | public CallableStatement | prepareCall(String sql, int resultSetType, int resultSetConcurrency) Creates a CallableStatement object that will generate
ResultSet objects with the given type and concurrency. | public CallableStatement | prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) | public PreparedStatement | prepareStatement(String sql) Creates a PreparedStatement object for sending
parameterized SQL statements to the database.
A SQL statement with or without IN parameters can be
pre-compiled and stored in a PreparedStatement object. | public PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency) Creates a PreparedStatement object that will generate
ResultSet objects with the given type and concurrency. | public PreparedStatement | prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) | public PreparedStatement | prepareStatement(String sql, int autoGeneratedKeys) | public PreparedStatement | prepareStatement(String sql, int[] columnIndexes) | public PreparedStatement | prepareStatement(String sql, String[] columnNames) | public void | releaseSavepoint(Savepoint savepoint) | public void | rollback() Undoes all changes made in the current transaction
and releases any database locks currently held
by this Connection object. | public void | rollback(Savepoint savepoint) | public void | setAutoCommit(boolean autoCommit) Sets this connection's auto-commit mode to the given state.
If a connection is in auto-commit mode, then all its SQL
statements will be executed and committed as individual
transactions. | public void | setCatalog(String catalog) Sets the given catalog name in order to select
a subspace of this Connection object's database
in which to work. | public void | setClientInfo(Properties properties) | public void | setClientInfo(String name, String value) | public void | setHoldability(int holdability) Changes the holdability of ResultSet objects
created using this Connection object to the given
holdability. | public void | setReadOnly(boolean readOnly) Puts this connection in read-only mode as a hint to the driver to enable
database optimizations. | public Savepoint | setSavepoint() | public Savepoint | setSavepoint(String name) | public void | setTransactionIsolation(int level) Attempts to change the transaction isolation level for this
Connection object to the one given. | public void | setTypeMap(Map<String, Class<?>> arg0) | public T | unwrap(Class<T> iface) |
CsvConnection | protected CsvConnection(String path) throws SQLException(Code) | | Creates a new CsvConnection that takes the supplied path
Parameters: path - directory where the CSV files are located |
CsvConnection | protected CsvConnection(String path, Properties info) throws SQLException(Code) | | Creates a new CsvConnection that takes the supplied path and properties
Parameters: path - directory where the CSV files are located Parameters: info - set of properties containing custom options |
clearWarnings | public void clearWarnings() throws SQLException(Code) | | Clears all warnings reported for this Connection object.
After a call to this method, the method getWarnings
returns null until a new warning is
reported for this Connection object.
exception: SQLException - if a database access error occurs |
close | public void close() throws SQLException(Code) | | Releases this Connection object's database and JDBC
resources immediately instead of waiting for them to be automatically
released.
Calling the method close on a Connection
object that is already closed is a no-op.
Note: A Connection object is automatically
closed when it is garbage collected. Certain fatal errors also
close a Connection object.
exception: SQLException - if a database access error occurs |
commit | public void commit() throws SQLException(Code) | | Makes all changes made since the previous
commit/rollback permanent and releases any database locks
currently held by this Connection object.
This method should be
used only when auto-commit mode has been disabled.
exception: SQLException - if a database access error occurs or thisConnection object is in auto-commit mode See Also: CsvConnection.setAutoCommit |
createStatement | public Statement createStatement() throws SQLException(Code) | | Creates a Statement object for sending
SQL statements to the database.
SQL statements without parameters are normally
executed using Statement objects. If the same SQL statement
is executed many times, it may be more efficient to use a
PreparedStatement object.
Result sets created using the returned Statement
object will by default be type TYPE_FORWARD_ONLY
and have a concurrency level of CONCUR_READ_ONLY .
a new default Statement object exception: SQLException - if a database access error occurs |
createStatement | public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException(Code) | | Creates a Statement object that will generate
ResultSet objects with the given type and concurrency.
This method is the same as the createStatement method
above, but it allows the default result set
type and concurrency to be overridden.
Parameters: resultSetType - a result set type; one ofResultSet.TYPE_FORWARD_ONLY ,ResultSet.TYPE_SCROLL_INSENSITIVE , orResultSet.TYPE_SCROLL_SENSITIVE Parameters: resultSetConcurrency - a concurrency type; one ofResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE a new Statement object that will generateResultSet objects with the given type andconcurrency exception: SQLException - if a database access error occursor the given parameters are not ResultSet constants indicating type and concurrency |
createStatement | public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException(Code) | | |
getAutoCommit | public boolean getAutoCommit() throws SQLException(Code) | | Retrieves the current auto-commit mode for this Connection
object.
the current state of this Connection object'sauto-commit mode exception: SQLException - if a database access error occurs See Also: CsvConnection.setAutoCommit |
getCarriageReturnEscape | protected String getCarriageReturnEscape()(Code) | | |
getCharset | protected String getCharset()(Code) | | Accessor method for the charset property
current value for the suppressHeaders property |
getExtension | protected String getExtension()(Code) | | Accessor method for the extension property
current value for the extension property |
getHoldability | public int getHoldability() throws SQLException(Code) | | Retrieves the current holdability of ResultSet objects created
using this Connection object.
the holdability, one of ResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT throws: SQLException - if a database access occurs since: 1.4 See Also: CsvConnection.setHoldability See Also: java.sql.ResultSet |
getLineBreakEscape | protected String getLineBreakEscape()(Code) | | |
getMaxFileSize | protected long getMaxFileSize()(Code) | | |
getMetaData | public DatabaseMetaData getMetaData() throws SQLException(Code) | | Retrieves a DatabaseMetaData object that contains
metadata about the database to which this
Connection object represents a connection.
The metadata includes information about the database's
tables, its supported SQL grammar, its stored
procedures, the capabilities of this connection, and so on.
a DatabaseMetaData object for thisConnection object exception: SQLException - if a database access error occurs |
getPath | protected String getPath()(Code) | | Accessor method for the path property
current value for the path property |
getSeperator | protected char getSeperator()(Code) | | Accessor method for the separator property
current value for the separator property |
getTransactionIsolation | public int getTransactionIsolation() throws SQLException(Code) | | Retrieves this Connection object's current
transaction isolation level.
the current transaction isolation level, which will be oneof the following constants:Connection.TRANSACTION_READ_UNCOMMITTED ,Connection.TRANSACTION_READ_COMMITTED ,Connection.TRANSACTION_REPEATABLE_READ ,Connection.TRANSACTION_SERIALIZABLE , orConnection.TRANSACTION_NONE . exception: SQLException - if a database access error occurs See Also: CsvConnection.setTransactionIsolation |
getTypeMap | public Map getTypeMap() throws SQLException(Code) | | Retrieves the Map object associated with this
Connection object.
Unless the application has added an entry, the type map returned
will be empty.
the java.util.Map object associatedwith this Connection object exception: SQLException - if a database access error occurs See Also: CsvConnection.setTypeMap |
getUseQuotes | protected boolean getUseQuotes()(Code) | | |
getUseQuotesEscape | protected boolean getUseQuotesEscape()(Code) | | |
getWarnings | public SQLWarning getWarnings() throws SQLException(Code) | | Retrieves the first warning reported by calls on this
Connection object. If there is more than one
warning, subsequent warnings will be chained to the first one
and can be retrieved by calling the method
SQLWarning.getNextWarning on the warning
that was retrieved previously.
This method may not be
called on a closed connection; doing so will cause an
SQLException to be thrown.
Note: Subsequent warnings will be chained to this
SQLWarning.
the first SQLWarning object or null if there are none exception: SQLException - if a database access error occurs orthis method is called on a closed connection See Also: SQLWarning |
isClosed | public boolean isClosed() throws SQLException(Code) | | Retrieves whether this Connection object has been
closed. A connection is closed if the method close
has been called on it or if certain fatal errors have occurred.
This method is guaranteed to return true only when
it is called after the method Connection.close has
been called.
This method generally cannot be called to determine whether a
connection to a database is valid or invalid. A typical client
can determine that a connection is invalid by catching any
exceptions that might be thrown when an operation is attempted.
true if this Connection objectis closed; false if it is still open exception: SQLException - if a database access error occurs |
isReadOnly | public boolean isReadOnly() throws SQLException(Code) | | Retrieves whether this Connection
object is in read-only mode.
true if this Connection objectis read-only; false otherwise exception: SQLException - if a database access error occurs |
isSuppressHeaders | protected boolean isSuppressHeaders()(Code) | | Accessor method for the suppressHeaders property
current value for the suppressHeaders property |
isTrimString | protected boolean isTrimString()(Code) | | Accessor method for the trimString property
current value for the trimString property |
nativeSQL | public String nativeSQL(String sql) throws SQLException(Code) | | Converts the given SQL statement into the system's native SQL grammar.
A driver may convert the JDBC SQL grammar into its system's
native SQL grammar prior to sending it. This method returns the
native form of the statement that the driver would have sent.
Parameters: sql - an SQL statement that may contain one or more '?'parameter placeholders the native form of this statement exception: SQLException - if a database access error occurs |
prepareCall | public CallableStatement prepareCall(String sql) throws SQLException(Code) | | Creates a CallableStatement object for calling
database stored procedures.
The CallableStatement object provides
methods for setting up its IN and OUT parameters, and
methods for executing the call to a stored procedure.
Note: This method is optimized for handling stored
procedure call statements. Some drivers may send the call
statement to the database when the method prepareCall
is done; others
may wait until the CallableStatement object
is executed. This has no
direct effect on users; however, it does affect which method
throws certain SQLExceptions.
Result sets created using the returned CallableStatement
object will by default be type TYPE_FORWARD_ONLY
and have a concurrency level of CONCUR_READ_ONLY .
Parameters: sql - an SQL statement that may contain one or more '?'parameter placeholders. Typically this statement is a JDBCfunction call escape string. a new default CallableStatement object containing thepre-compiled SQL statement exception: SQLException - if a database access error occurs |
prepareCall | public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException(Code) | | Creates a CallableStatement object that will generate
ResultSet objects with the given type and concurrency.
This method is the same as the prepareCall method
above, but it allows the default result set
type and concurrency to be overridden.
Parameters: sql - a String object that is the SQL statement tobe sent to the database; may contain on or more ? parameters Parameters: resultSetType - a result set type; one ofResultSet.TYPE_FORWARD_ONLY ,ResultSet.TYPE_SCROLL_INSENSITIVE , orResultSet.TYPE_SCROLL_SENSITIVE Parameters: resultSetConcurrency - a concurrency type; one ofResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE a new CallableStatement object containing thepre-compiled SQL statement that will produce ResultSet objects with the given type and concurrency exception: SQLException - if a database access error occursor the given parameters are not ResultSet constants indicating type and concurrency |
prepareStatement | public PreparedStatement prepareStatement(String sql) throws SQLException(Code) | | Creates a PreparedStatement object for sending
parameterized SQL statements to the database.
A SQL statement with or without IN parameters can be
pre-compiled and stored in a PreparedStatement object. This
object can then be used to efficiently execute this statement
multiple times.
Note: This method is optimized for handling
parametric SQL statements that benefit from precompilation. If
the driver supports precompilation,
the method prepareStatement will send
the statement to the database for precompilation. Some drivers
may not support precompilation. In this case, the statement may
not be sent to the database until the PreparedStatement
object is executed. This has no direct effect on users; however, it does
affect which methods throw certain SQLException objects.
Result sets created using the returned PreparedStatement
object will by default be type TYPE_FORWARD_ONLY
and have a concurrency level of CONCUR_READ_ONLY .
Parameters: sql - an SQL statement that may contain one or more '?' INparameter placeholders a new default PreparedStatement object containing thepre-compiled SQL statement exception: SQLException - if a database access error occurs |
prepareStatement | public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException(Code) | | Creates a PreparedStatement object that will generate
ResultSet objects with the given type and concurrency.
This method is the same as the prepareStatement method
above, but it allows the default result set
type and concurrency to be overridden.
Parameters: sql - a String object that is the SQL statement tobe sent to the database; may contain one or more ? INparameters Parameters: resultSetType - a result set type; one ofResultSet.TYPE_FORWARD_ONLY ,ResultSet.TYPE_SCROLL_INSENSITIVE , orResultSet.TYPE_SCROLL_SENSITIVE Parameters: resultSetConcurrency - a concurrency type; one ofResultSet.CONCUR_READ_ONLY orResultSet.CONCUR_UPDATABLE a new PreparedStatement object containing thepre-compiled SQL statement that will produce ResultSet objects with the given type and concurrency exception: SQLException - if a database access error occursor the given parameters are not ResultSet constants indicating type and concurrency |
rollback | public void rollback() throws SQLException(Code) | | Undoes all changes made in the current transaction
and releases any database locks currently held
by this Connection object. This method should be
used only when auto-commit mode has been disabled.
exception: SQLException - if a database access error occurs or thisConnection object is in auto-commit mode See Also: CsvConnection.setAutoCommit |
setAutoCommit | public void setAutoCommit(boolean autoCommit) throws SQLException(Code) | | Sets this connection's auto-commit mode to the given state.
If a connection is in auto-commit mode, then all its SQL
statements will be executed and committed as individual
transactions. Otherwise, its SQL statements are grouped into
transactions that are terminated by a call to either
the method commit or the method rollback .
By default, new connections are in auto-commit
mode.
The commit occurs when the statement completes or the next
execute occurs, whichever comes first. In the case of
statements returning a ResultSet object,
the statement completes when the last row of the
ResultSet object has been retrieved or the
ResultSet object has been closed. In advanced cases, a
single statement may return multiple results as well as output
parameter values. In these cases, the commit occurs when all results and
output parameter values have been retrieved.
NOTE: If this method is called during a transaction, the
transaction is committed.
Parameters: autoCommit - true to enable auto-commit mode;false to disable it exception: SQLException - if a database access error occurs See Also: CsvConnection.getAutoCommit |
setCatalog | public void setCatalog(String catalog) throws SQLException(Code) | | Sets the given catalog name in order to select
a subspace of this Connection object's database
in which to work.
If the driver does not support catalogs, it will
silently ignore this request.
Parameters: catalog - the name of a catalog (subspace in thisConnection object's database) in which to work exception: SQLException - if a database access error occurs See Also: CsvConnection.getCatalog |
setHoldability | public void setHoldability(int holdability) throws SQLException(Code) | | Changes the holdability of ResultSet objects
created using this Connection object to the given
holdability.
Parameters: holdability - a ResultSet holdability constant; one ofResultSet.HOLD_CURSORS_OVER_COMMIT orResultSet.CLOSE_CURSORS_AT_COMMIT throws: SQLException - if a database access occurs, the given parameteris not a ResultSet constant indicating holdability,or the given holdability is not supported since: 1.4 See Also: CsvConnection.getHoldability See Also: java.sql.ResultSet |
setReadOnly | public void setReadOnly(boolean readOnly) throws SQLException(Code) | | Puts this connection in read-only mode as a hint to the driver to enable
database optimizations.
Note: This method cannot be called during a transaction.
Parameters: readOnly - true enables read-only mode;false disables it exception: SQLException - if a database access error occurs or thismethod is called during a transaction |
setTransactionIsolation | public void setTransactionIsolation(int level) throws SQLException(Code) | | Attempts to change the transaction isolation level for this
Connection object to the one given.
The constants defined in the interface Connection
are the possible transaction isolation levels.
Note: If this method is called during a transaction, the result
is implementation-defined.
Parameters: level - one of the following Connection constants:Connection.TRANSACTION_READ_UNCOMMITTED ,Connection.TRANSACTION_READ_COMMITTED ,Connection.TRANSACTION_REPEATABLE_READ , orConnection.TRANSACTION_SERIALIZABLE .(Note that Connection.TRANSACTION_NONE cannot be usedbecause it specifies that transactions are not supported.) exception: SQLException - if a database access error occursor the given parameter is not one of the Connection constants See Also: DatabaseMetaData.supportsTransactionIsolationLevel See Also: CsvConnection.getTransactionIsolation |
|
|