com.iisc.jwc.jsheet.db
Class JSDatabase

java.lang.Object
  extended bycom.iisc.jwc.jsheet.db.JSDatabase

public class JSDatabase
extends java.lang.Object

JSDatabase allows database access via the JSServer.


Constructor Summary
JSDatabase(com.iisc.jwc.orb.CDatabase cdb)
          For internal use only!
 
Method Summary
 JSDbCursor describeColumns(java.lang.String tableName)
          Describes the columns in a table.
 JSDbCursor describeTables()
          Describes the tables in the database.
 void disconnect()
          Disconnects from the database.
 JSDbCursor runQuery(java.lang.String queryText, boolean scrollable)
          Runs the SQL query.
 JSDbCursor runQueryFile(java.lang.String fileName, boolean scrollable)
          Runs the SQL that is contained within the specified file.
 void runSQL(java.lang.String sqlText)
          Runs the specified SQL statement.
 void runSQLFile(java.lang.String fileName)
          Runs the SQL that is contained within the specified file.
 JSValue sqlGetInfo(int info)
          Use this function to return information about the current connection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSDatabase

public JSDatabase(com.iisc.jwc.orb.CDatabase cdb)
For internal use only!

Parameters:
cdb - for internal use only!
Method Detail

describeColumns

public JSDbCursor describeColumns(java.lang.String tableName)
                           throws JSDbException
Describes the columns in a table. It produces a result set that contains a list of the columns from the specified table and information about each column. The result set returned by this command contains at least 12 columns with the following information. The result set is ordered by Qualifier, Owner, and Table.
Result Set ColumnContent
1Table qualifier
2Table owner
3Table name
4Column name
5Column type
6Data source-dependent data type name
7Column precision
8Column length
9Column scaling factor
10Column radix
11Column null status
12Remarks

Parameters:
tableName - Column information is retrieved for the specified table.
Returns:
A cursor containing a list of columns in the table.
Throws:
JSDbException - An exception occured while communicating with the database.

describeTables

public JSDbCursor describeTables()
                          throws JSDbException
Describes the tables in the database. Each row in the result set contains the name of each table, the table's owner, the table type, and any remarks provided with the table. The table types can be: TABLE, VIEW, SYSTEM TABLE, ALIAS, SYNONYM, or a data source specific table type. This method produces a cursor containing a result set containing a list of the tables in the current database and information about each table. The result set returned by this command contains five columns with the following information. The result set is ordered by Qualifier, Owner, Name, and Type.
Result Set ColumnContent
1Table qualifier
2Table owner
3Table name
4Table type (returns a string; TABLE, VIEW, SYSTEM TABLE, ALIAS, SYNONYM, or a data source specific table type)
5Remarks

Returns:
A cursor containing a list of tables in the current database.
Throws:
JSDbException - An exception occured while communicating with the database.

disconnect

public void disconnect()
                throws JSException
Disconnects from the database.

Throws:
JSException - An exception occured while disconnecting from the database.

runQuery

public JSDbCursor runQuery(java.lang.String queryText,
                           boolean scrollable)
                    throws JSDbException
Runs the SQL query. The results can be a scrollable or non-scrollable cursor.

Parameters:
queryText - The sql statement to run.
scrollable - Specifies if the cursor should be scrollable. Scrollable cursors allow you to move forward and backward through the result set. Non-scrollable cursors allow you to only move forward through the result set. If the value is true, the cursor is scrollable. Otherwise, the cursor is not scrollable.
Returns:
A cursor that can be used to traverse the result set.
Throws:
JSDbException - An exception occured while running the SQL.

runQueryFile

public JSDbCursor runQueryFile(java.lang.String fileName,
                               boolean scrollable)
                        throws JSDbException
Runs the SQL that is contained within the specified file. The results can be a scrollable or non-scrollable cursor.

Parameters:
fileName - Name of the file that contains the SQL.
scrollable - Specifies if the cursor should be scrollable. Scrollable cursors allow you to move forward and backward through the result set. Non-scrollable cursors allow you to only move forward through the result set. If the value is true, the cursor is scrollable. Otherwise, the cursor is not scrollable.
Returns:
A cursor that can be used to traverse the result set.
Throws:
JSDbException - An exception occured while running the SQL.

runSQL

public void runSQL(java.lang.String sqlText)
            throws JSDbException
Runs the specified SQL statement.

Parameters:
sqlText - The SQL statement to run.
Throws:
JSDbException - An exception occured while running the SQL.

runSQLFile

public void runSQLFile(java.lang.String fileName)
                throws JSDbException
Runs the SQL that is contained within the specified file.

Parameters:
fileName - Name of the file that contains the SQL.
Throws:
JSDbException - An exception occured while running the SQL.

sqlGetInfo

public JSValue sqlGetInfo(int info)
                   throws JSDbException
Use this function to return information about the current connection. The information shown in the following table can be returned. For an ODBC connection, you can return additional pieces of information about the driver and the current datasource. Refer to the Microsoft ODBC Programmer's Reference manual for more information.
ArgumentInformation Returned
2Data source name
8Fetch direction (the return value can be an accumulation of the following values: 1 = next, 2 = first, 4 = last, 8 = previous, 16 = absolute, or 32 = relative)
16Database name
17DBMS name
18DBMS version
23Cursor commit behavior (0 = close and delete cursors, 1 = close cursor, or 2 = preserve cursor position)
24Cursor rollback behavior (0 = close and delete cursors, 1 = close cursor, or 2 = preserve cursor position)
30Maximum column name length
31Maximum cursor name length
32Maximum owner name length
35Maximum table name length
38Outjoins supported (Y = outer joins supported or N = outer joins not supported)
44Scroll options (The return value can be an accumulation of the following values: 1 = forward only, 2 = key set driven, 4 = dynamic, 8 = mixed, or 16 = static)
48Transaction capabilities
0 = transaction not supported
1 = transaction for SELECT, UPDATE, INSERT, and DELETE supported
2 = all Data Definition Language and Data Manipulation Language statements supported
47A character string that is the user name recognized in a particular database. This user name can differ from the login name.
72Isolation levels supported. Depending on the connection type, the return value is an accumulation fo the following values:
1 = Read Uncommited
2 = Read Committed
4 = Repeatable Read
8 = Serializable
16 = Versioning

Parameters:
info - The type of information to retrieve (see table).
Returns:
The specified information (see table).
Throws:
JSDbException - An exception occured while communicating with the database.

Email JSheet Support

www.jsheet.com
Copyright 1995 - 2003 Investment Intelligence Systems Limited.