|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The interface that must be implemented for any JDBC driver that can support OpMath Data Platform operations.
Classes implementing DB are assumed to be in-process or embedded drivers.
Copyright: (c) 2002 The Open Math Company Limited
The Terms of Distribution of this software are stipulated in the javadoc Overview for this project.
| Method Summary | |
String |
className()
Returns the name of the class of this DBObject object. |
void |
close()
Shut down the database server or driver. |
void |
connect(String user,
String pass)
Establish a connection to the database. |
void |
create(String table,
String values)
Creates a new row in the named table. |
void |
createTable(String table,
String sql)
Creates a new table within this database. |
void |
delete(String table,
String keyName,
long keyValue)
Deletes the row (or rows) with the specfied key name and value, in the named table. |
void |
delete(String table,
String keyName,
String keyValue)
Deletes the row (or rows) with the specfied key name and value, in the named table. |
void |
dropTable(String table)
Deletes a table within this database. |
Connection |
getConnection()
Returns the connection object for this DB instance. |
Class |
getDriver()
Returns the driver class of this DB. |
String |
getPath()
Returns the fully qualified path for the current connection. |
String |
getProtocol()
Returns the protocol for the current connection. |
boolean |
isAvailable()
Tests whether the database is responding. |
String |
maxIndex(String table,
String pkName)
Returns the highest value of the primary key for the named table. |
ResultSet |
query(String table,
String where,
String order)
Returns the rows from the named table, as found by the ad hoc query given in sql. |
ResultSet |
read(String table,
String keyName,
long keyValue)
Returns the rows from the named table whose field keyName
exactly matches keyValue. |
ResultSet |
read(String table,
String keyName,
String keyValue)
Returns the rows from the named table whose field keyName
exactly matches keyValue. |
ResultSet |
readAll(String table,
String order)
Returns all of the rows from the named table. |
void |
update(String table,
String pkName,
long pkValue,
String set)
Updates the row with the specfied primary key name and value, in the named table. |
void |
update(String table,
String pkName,
String pkValue,
String set)
Updates the row with the specfied primary key name and value, in the named table. |
| Method Detail |
public void connect(String user,
String pass)
throws SQLException
Establish a connection to the database. By default, autoCommit
will be set to true.
NOTE: It is assumed that only one simultaneous connection can be held by
any DB instance.
user - a String specifying the user name.pass - a String specifying the password.SQLException - if the connection could not be made.Connection.setAutoCommit(boolean)
public void close()
throws SQLException
Shut down the database server or driver.
SQLException - if the database could not be shut down.public boolean isAvailable()
Tests whether the database is responding.
boolean indicating database availability.
public Class getDriver()
throws ClassNotFoundException
Returns the driver class of this DB.
Class representing the database driver.ClassNotFoundException - if the driver class cannot be found.public String getProtocol()
Returns the protocol for the current connection.
Returns null if there is no current connection.
Class representing the database driver.public String getPath()
Returns the fully qualified path for the current connection.
Returns null if there is no current connection.
Class representing the database driver.
public Connection getConnection()
throws SQLException
Returns the connection object for this DB instance.
Connection object.SQLException - if the connection could not be made.public String className()
Returns the name of the class of this DBObject object.
String naming the class.
public void createTable(String table,
String sql)
throws SQLException
Creates a new table within this database.
table - a String the name of the new table.sql - a String carrying the SQL-92
code, specifying the table's column names and SQL-92 types.SQLException - if the table could not be created.
public void dropTable(String table)
throws SQLException
Deletes a table within this database.
table - a String the name of the new table.SQLException - if the table could not be deleted.
public String maxIndex(String table,
String pkName)
throws SQLException
Returns the highest value of the primary key for the named table. The value
is returned as a String, irrespective of its actual stored type.
table - a String naming the table.pkName - a String specifying the name of the primary key field.SQLException - if the operation could not be completed.
public void create(String table,
String values)
throws SQLException
Creates a new row in the named table.
The String values is used within the VALUES(..)
SQL sub-clause of the INSERT statement, and is a comma-separated list of values
that must be appropriate to the table definition.
table - a String the name of the table.values - a String the field values for the new row.SQLException - if the create operation could not be completed.
public ResultSet read(String table,
String keyName,
long keyValue)
throws SQLException
Returns the rows from the named table whose field keyName
exactly matches keyValue.
table - a String naming the table.keyName - a String specifying the name of the key field.keyValue - a long specifying the value of the key field.ResultSet carrying the retrieved data.SQLException - if the read operation could not be completed.
public ResultSet read(String table,
String keyName,
String keyValue)
throws SQLException
Returns the rows from the named table whose field keyName
exactly matches keyValue.
table - a String naming the table.keyName - a String specifying the name of the key field.keyValue - a String specifying the value of the key field.ResultSet carrying the retrieved data.SQLException - if the read operation could not be completed.
public ResultSet readAll(String table,
String order)
throws SQLException
Returns all of the rows from the named table.
The String order is a comma-seperated list of field names
(most significant field first), each with sort direction.
table - a String naming the table.order - a String specifying the sort field order.ResultSet carrying the retrieved data.SQLException - if the read operation could not be completed.
public ResultSet query(String table,
String where,
String order)
throws SQLException
Returns the rows from the named table, as found by the ad hoc query given in
sql. The String where is used within the WHERE
SQL sub-clause of the SELECT statement.
The String order is a comma-seperated list of field names
(most significant field first), each with sort direction.
table - a String naming the table.where - a String specifying the sort field order.order - a String specifying the sort field order.ResultSet carrying the retrieved data.SQLException - if the query operation could not be completed.
public void update(String table,
String pkName,
long pkValue,
String set)
throws SQLException
Updates the row with the specfied primary key name and value, in the named
table. The String where is used within the SET
SQL sub-clause of the UPDATE statement.
table - a String naming the table.keyName - a String specifying the name of the primary key field.keyValue - a long specifying the value of the primary key field.set - a String specifying the name-value pairs for the updated fields.SQLException - if the update operation could not be completed.
public void update(String table,
String pkName,
String pkValue,
String set)
throws SQLException
Updates the row with the specfied primary key name and value, in the named
table. The String where is used within the SET
SQL sub-clause of the UPDATE statement.
table - a String naming the table.keyName - a String specifying the name of the primary key field.keyValue - a String specifying the value of the primary key field.set - a String specifying the name-value pairs for the updated fields.SQLException - if the update operation could not be completed.
public void delete(String table,
String keyName,
long keyValue)
throws SQLException
Deletes the row (or rows) with the specfied key name and value, in the named table.
table - a String naming the table.keyName - a String specifying the name of the primary key field.keyValue - a long specifying the value of the primary key field.SQLException - if the delete operation could not be completed.
public void delete(String table,
String keyName,
String keyValue)
throws SQLException
Deletes the row (or rows) with the specfied key name and value, in the named table.
table - a String naming the table.keyName - a String specifying the name of the primary key field.keyValue - a String specifying the value of the primary key field.SQLException - if the delete operation could not be completed.
|
OpMath | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||