home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
DBObject.hxx
< prev
next >
Wrap
Text File
|
1997-06-12
|
2KB
|
96 lines
/*---------------------------------------------------------------------------
*
* (c) Westmount Technology 1994
*
* File: @(#)DBObject.hxx /main/titanic/1
* Author: frmo
* Description: Base Class for all Database Classes
* uses RogueWave class library
*---------------------------------------------------------------------------
SccsId = @(#)DBObject.hxx /main/titanic/1 12 Jun 1997 Copyright 1994 Westmount Technology */
#ifndef DBOBJECT_HXX
#define DBOBJECT_HXX
#ifdef WIN32
#include <sqlproto.h>
#endif
#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 */