/* * Copyright (c) 1995 Gunther Schadow. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef TABLE_H_ #define TABLE_H_ #include #include typedef int result; #define FAIL -1 #define SUCCESS 0 struct ora_rowid { char rowid[18]; short indicator; }; typedef struct ora_rowid oid_t; class Table { public: Table(); virtual ~Table(); /* * Set the database with use() prior to any instantiation of a Table! */ static void use(const char *dbname); static void use(SqlMgr *); static SqlMgr *database(); SqlMgr *operator -> (); /* * Basic functionality insert(), update(), delete() and retrieve(). * The function retrieve(const char*) reads the first row while next() * gets any other row. */ virtual void insert() =0; virtual result retrieve(const char *clause = "") =0; virtual result next() =0; virtual u_int retrieve_count(); virtual u_int retrieve_level(); virtual oid_t object_id(); virtual void update() =0; // update this record virtual void update(const char *clause) =0; // make others equal virtual void remove() =0; // remove this record //static void remove(const char *clause); // remove some records /* * Additional static functions are defined for each class. These are: * * static void const char *owner(const char *); * static void const char *owner(); * static void create(); * static void drop(); */ enum TabType { table, view }; /* * The cursor() function returns the retrieve cursor or FAIL (= -1) * if noone is allocated. */ SqlHandle cursor() { return Cursor; } protected: static SqlMgr *Database; SqlHandle Cursor; /* * Oracle pseudo columns */ oid_t the_oid; u_int the_rownum; u_int the_level; private: static char* Dbname; }; #ifndef OUTLINE # include "Table.icc" #endif #endif /* ! TABLE_H_ */