home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
DBObject.hxx
< prev
next >
Wrap
Text File
|
1996-05-31
|
2KB
|
92 lines
/*---------------------------------------------------------------------------
*
* (c) Westmount Technology 1994
*
* File: @(#)DBObject.hxx 1.6
* Author: frmo
* Description: Base Class for all Database Classes
* uses RogueWave class library
*---------------------------------------------------------------------------
SccsId = @(#)DBObject.hxx 1.6 06 Feb 1996 Copyright 1994 Westmount Technology */
#ifndef DBOBJECT_HXX
#define DBOBJECT_HXX
#ifndef __RWCSTRING_H__
#include "rw/cstring.h"
#endif
class DBObject {
public:
enum State {
CREATED, // just created
TYPE_ERROR, // constructed with unkown type
NORMAL, // everything OK
SQL_ERROR // SQL error occured
};
DBObject(const RWCString &className);
virtual ~DBObject();
// Connect database
//
static int connectDB(const char *dbName);
// Start database actions
//
static int beginWork();
// Commit the previous database actions
//
static int commit();
// Roll back the previous actions
//
static int rollback();
// Return class name
//
const char * getClassName();
// The state this object is in
//
State getState();
// Reset the state of the object to CREATED.
//
void resetState();
// Process the SQL status (sqlca.sql_code). Set the state
// accordingly. Returns -1 if the sql status indicates an error,
// else 0.
//
int processSqlStatus();
// Returns 1 if the sqlca.sql_code indicated that no rows
// were found, else 0.
//
int notFound();
// Strip trailing spaces from string
//
static void stripTrailingSpaces(char *str);
protected:
State dbState;
private:
RWCString className; // class name
};
inline DBObject::State DBObject::getState()
{
return dbState;
}
inline const char *DBObject::getClassName()
{
return className;
}
#endif /* DBOBJECT_HXX */