|
|
This simple database object is designed to be easy to use, run fast and make very small table files.
STFreeBase *FreeBase; FreeBase = new STFreeBase(); FreeBase->New(); FreeBase->AddField("Name = ftString = 60"); FreeBase->AddField("Phone = ftString = 20"); FreeBase->AddField("ANumber = ftInt"); FreeBase->Create("MyTable.fdb"); delete FreeBase; |
STFreeBase *FreeBase; int SetNumber; FreeBase = new STFreeBase(); FreeBase->Open("MyFirstTable.fdb"); FreeBase->Append(); FreeBase->SetValue(1,(void *)"Roy Souther"); FreeBase->SetValue(2,(void *)"308-3287"); SetNumber = 456; FreeBase->SetValue(3,(void *)&SetNumber); FreeBase->Post(); FreeBase->Close(); delete FreeBase; |
STFreeBase *FreeBase; uint ALoopCounter; int PrintNumber; char PrintText[50]; FreeBase = new STFreeBase(); FreeBase->Open("MyFirstTable.fdb"); FreeBase->First(); for(ALoopCounter = 0;ALoopCounter < FreeBase->RecordCount();ALoopCounter++) { FreeBase->GetValue(1,PrintText); printf("Name = %20s ",PrintText); FreeBase->GetValue(2,PrintText); printf("\tPhone = %13s",PrintText); FreeBase->GetValue(3,&PrintNumber); printf("\tNumber = %d\n",PrintNumber); FreeBase->Next(); } FreeBase->Close(); delete FreeBase; |
STFreeBase ()
| STFreeBase |
Constructor.
~STFreeBase ()
| ~STFreeBase |
Destructor.
void AddField (const char *NewFieldToAdd)
| AddField |
After initalizing a new table using New you then add fields by passing text strings to AddField then create the table using Create. Added fields use text that is a string of three parts 1) The name of the field, 2) the type of data in the field, 3) the size of the field if needed. The name of the field must be 20 chars or less. Field data types can be one the these ftString, ftChar, ftInt, ftBool, ftStr, ftBlob.
void Create (const char *NewTableName)
| Create |
After initalizing a new table using New you then add fields by passing text strings to AddField then create the table using Create.
void Open (const char *OpenTableName)
| Open |
Use Open to connect to a table that was previously created.
void Close ()
| Close |
Use when you are done using a table. This will close the file and free memory. It must be used every time you open a table.
void New ()
| New |
After initalizing a new table using New you then add fields by passing text strings to AddField then create the table using Create.
void Next ()
| Next |
Advance to the next record in the open table.
void Previous ()
| Previous |
Reverse back to the previous record in the open table.
void First ()
| First |
Move to the first record in the table.
void Last ()
| Last |
Move to the last record in the table.
void Post ()
| Post |
Commit the changes to the table.
DWORD RecordCount ()
| RecordCount |
Returns the number of records in the table.
DWORD RecordNumber ()
| RecordNumber |
Returns the current record number in the table.
DWORD SizeOfCell (DWORD FieldIndex)
| SizeOfCell |
Returns the size in bytes of a data field at the given index.
char * FieldName (DWORD FieldNumberToName)
| FieldName |
Returns the name of the field at a given index.
DWORD FieldNumber (const char *FieldNameToNumber)
| FieldNumber |
Finds the index of a field and returns the number.
BYTE GetFieldType (DWORD FieldIndex)
| GetFieldType |
Returns the type of field.
bool GetValue (DWORD FieldIndex,void *Container)
| GetValue |
Fills a continer with the value in the cell at a given in index in the current record.
void SetValue (DWORD FieldIndex,void *Container)
| SetValue |
Fills a cell with the value in a given continer at a given in index in the current record.
void Append ()
| Append |
Creats a new empty record at the end of the open table.
DWORD GetVersionInt ()
| GetVersionInt |
Returns the version number of STFreeBase. Does not work yet.
bool GoToRecord (DWORD RecordToGoTo)
| GoToRecord |
Move to the give record in the open table. If given record does not exist no move happens and the position in the table remains the same.
Generated by: root on UtopiaPlanitia.Ept on Mon Dec 10 22:55:12 2001, using kdoc 2.0a53. |