home *** CD-ROM | disk | FTP | other *** search
- -----------------------------------------------------------------------------
- --
- -- (c) Westmount Technology 1994
- --
- -- File: @(#)DBObject.4gh /main/hindenburg/1
- -- Author:
- -- Description: Base Class for all Database Classes
- --
- -----------------------------------------------------------------------------
-
- INCLUDE SYSTEM "ixconn.4gh"
- INCLUDE SYSTEM "ixstmt.4gh"
- INCLUDE SYSTEM "ixnum.4gh"
- INCLUDE SYSTEM "ixstring.4gh"
-
- CLASS DBObject
-
- PUBLIC CONSTANT
- CREATED SMALLINT = 1, -- just created
- NORMAL SMALLINT = 2, -- everything OK
- SQL_ERROR SMALLINT = 3 -- SQL error occured
-
- -- The connection object
- --
- SHARED PRIVATE VARIABLE conn ixSQLConnect
-
- -- The SQL statement that caused dbState to be SQL_ERROR
- --
- PUBLIC VARIABLE errorStmt ixSQLStmt
-
- PROTECTED FUNCTION DBObject()
-
- -- Connect database using (implicit) connection object.
- -- Also set the shared conn object
- --
- SHARED FUNCTION connectDB(dbName CHAR(*), connObj ixSQLConnect: NULL)
- RETURNING INTEGER
-
- -- Disconnect the connection object from the database.
- --
- SHARED FUNCTION disconnectDB() RETURNING VOID
-
- -- Get the connection object
- --
- SHARED FUNCTION getConnection() RETURNING ixSQLConnect
-
- -- Commit the previous database actions
- --
- SHARED FUNCTION commit() RETURNING INTEGER
-
- -- Roll back the previous actions
- --
- SHARED FUNCTION rollback() RETURNING INTEGER
-
- -- Get the (case sensitive) class name
- --
- FUNCTION getClassName() RETURNING ixString
-
- -- The state this object is in
- --
- FUNCTION getState() RETURNING SMALLINT
-
- -- Reset the state of the object to CREATED
- --
- FUNCTION resetState() RETURNING VOID
-
- -- Process the SQL status after executing stmt.
- -- Set the dbState accordingly.
- -- Returns -1 if the SQL status indicates an error, else 0.
- --
- FUNCTION processSqlStatus(stmt ixSQLStmt) RETURNING INTEGER
-
- -- Get the ODBC error message when a SQL stmt failed.
- --
- SHARED FUNCTION getODBCErrMsg(stmt ixSQLStmt) RETURNING CHAR(*)
-
- -- The (case sensitive) name of the class
- --
- PROTECTED VARIABLE className ixString
-
- PRIVATE VARIABLE dbState SMALLINT
-
- END CLASS
-