Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

GDb.h

00001 /*hdr
00002 **      FILE:           GDb.h
00003 **      AUTHOR:         Matthew Allen
00004 **      DATE:           8/2/2000
00005 **      DESCRIPTION:    Db API definitions
00006 **
00007 **      Copyright (C) 2000 Matthew Allen
00008 **                      fret@memecode.com
00009 */
00010 
00011 #ifndef __GDB_H
00012 #define __GDB_H
00013 
00014 #include "GVariant.h"
00015 
00016 // Classes
00017 class GDbField
00018 {
00019 public:
00020     virtual ~GDbField() {};
00021 
00022     // Properties
00023     virtual char *Name() = 0;
00024     virtual bool Name(char *Str) = 0;
00025     virtual int Type() = 0;
00026     virtual bool Type(int NewType) = 0;
00027     virtual int Length() = 0;
00028     virtual bool Length(int NewLength) = 0;
00029     virtual char *Description() = 0;
00030     virtual bool Description(char *NewDesc) = 0;
00031 
00032     // Set/Get
00033     virtual bool Set(GVariant &v) = 0;
00034     virtual bool Get(GVariant &v) = 0;
00035 };
00036 
00037 class GDbRecordset
00038 {
00039 public:
00040     virtual ~GDbRecordset() {};
00041 
00042     // Props
00043     virtual char *Name() = 0;
00044 
00045     // Fields
00046     virtual GDbField *operator [](int Index) = 0;
00047     virtual GDbField *operator [](char *Name) = 0;
00048     virtual GDbField *InsertField(  char *Name,
00049                                     int Type,
00050                                     int Length = 0,
00051                                     int Index = -1) = 0; // default: append to the end
00052     virtual bool DeleteField(GDbField *Fld) = 0;
00053     virtual int Fields() = 0; // return number of fields
00054 
00055     // Markers
00056     virtual bool Bof() = 0;
00057     virtual bool Eof() = 0;
00058 
00059     // New/Edit
00060     virtual bool AddNew() = 0;
00061     virtual bool Edit() = 0;
00062     virtual bool Update() = 0;
00063     virtual void Cancel() = 0;
00064 
00065     // Moving around the records
00066     virtual bool MoveFirst() = 0;
00067     virtual bool MoveNext() = 0;
00068     virtual bool MovePrev() = 0;
00069     virtual bool MoveLast() = 0;
00070     virtual int SeekRecord(int i) = 0; // from the beginning
00071 
00072     // Numbers/Counts
00073     virtual int RecordIndex() = 0;
00074     virtual int Records() = 0;
00075     
00076     // Deleting
00077     virtual bool DeleteRecord() = 0; // delete's the current record
00078 };
00079 
00080 class GDb
00081 {
00082 public:
00083     virtual ~GDb() {}
00084 
00085     // Attaching to data
00086     virtual bool Connect(char *Init) = 0;
00087     virtual bool Disconnect() = 0;
00088 
00089     // Retrieving data
00090     virtual GDbRecordset *Open(char *Name) = 0;
00091     virtual GDbRecordset *TableAt(int i) = 0;
00092 };
00093 
00094 // Actual implementations
00095 extern GDb *OpenDbfDatabase(char *s);       // add 'GDb-Dbf.cpp' to your project
00096 extern GDb *OpenAdoDatabase(char *s);       // add 'GDb-Ado.cpp' to your project
00097 extern GDb *OpenCsvDatabase(char *s);       // add 'GDb-Csv.cpp' to your project
00098 extern GDb *OpenMetakitDatabase(char *s);   // add 'GDb-Metakit.cpp' to your project
00099 extern GDb *OpenBfsDatabase(char *s);       // add 'GDb-Bfs.cpp' and 'Bfs.cpp' to your project
00100 
00101 #endif

Generated on Wed Oct 26 14:46:48 2005 for Lgi by  doxygen 1.4.1