the Madhatter database Engine has grown to its present
Because I'm having fun, thats why!!!
through quite a lot of effort and quite a lot of inspiration.
its present state the engine itself is fully functional, though
with some minor bugs. I have been working on some visual aspects
of the engine for some time and have not done any work on the table
code in a while.
The code has progressed from including the cpp and
h files into
a project to access the tables, up to now, were we have a dll and two
components. The Dll can be used or the source files depending
the desires of the developer. The two components are the engine
a nonvisual component (MHDBEngine), and a StringGrid (MHDBStringGrid).
I hope the functionality of these two will approach
the ease of
use of the BDE, while maintaing a small footprint on the pc.
I do not intend to give microsoft any competition. I just want
serviceable DBE, designed to handle a million or so records, small
Both exaamples below will populate a string grid
object that has
been derived from TStringGrid. this object is designed to function
with the madhatter database engine.
The following code is an example of utilizing the
DLL for the
database activity. In the Project cpp we add the path to the
"mhdb001.lib". this is the library for the "mhdb001.dll".
is of course made available in the search path.
WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
catch (Exception &exception)
This is the Inclulde directive to be added to the
top of the Unit. We must
ensure that the other h files that are linked to this file are available
project folder or the paths are correct in the declaration. These
"MHDBFields.h", "MHDBFields.h", "MHDBInternals.h", "MHDBVer.h".
void __fastcall TForm1::Open1Click(TObject *Sender)
MHDBTable *TablePtr = new MHDBTable ();
if (OpenDialog1->Execute ())
TablePtr->TableName (OpenDialog1->FileName.c_str ());
Thats all there is to it. Im sure that things
will be different in a year,
but for now I am happy.
The code below is for utilizing both components.
We do not have to do
much other than drag and drop here. The include files must be
void __fastcall TForm1::EngineComponent1Click(TObject *Sender)
if (OpenDialog1->Execute ())
MHDBEngine1->Table->TableName (OpenDialog1->FileName.c_str ());
The code that is displayed here will show the direction that I am going
in. It has bugs and is very
immature. Please allow it the luxury of experiencing its
own adolescence. If you wish to comment
feel free to email me at (firstname.lastname@example.org) . I don't respond
well to reports about my stupidity
or comments such as "why reinvent the wheel". If you aint figured
it out, you never will.
The code below was written in C++ with the borland builder 5.0 .
CODE - update Nov / 15 / 2003
The datalink is very functional but I am sure it still has a crash or
two left in it.
The problematic code is in the GUI code. I have not found it necessary
to edit the
engine in quite a while. though I have not edited much of the code
at all in a while either.
(Still in developement) Ver. 0.1.6 build 13
DownLoad the Datalink
The DLL is being rewritten. New stuff soon
Progress not perfection ;-)
note - January/02/2006/11.03pm , I havent been doing to much thes few months.
but I do have some sql functionality. The parsing engine is a bitch. I can do
the select stuff as well as some search functions from sql. I have also done
the code to go to and from csv file format. This will open up the file format
for wider usage, as I am no longer restricted to the mtb format. I dont know know
if I will do any other file formats as yet. For what I am intending, I would think that
the cvs funtion is adequate for importing and exporting.
note - july/12/2005/9.48pm , I have started a rewrite of the dll. the
direction I was going in was not very comfortable and I guess I understand
the process a little more now.
note - july/3/2005/10.04pm , I now have a working SQL engine.
not very complete but it is working and is creating a result set for
note - feb/20/2005/9.49pm , Search functions are working and I am doing
some work on the restructure methods.
note - Jan/01/2005/9.30pm , New version posted that addresses some major
that were present in the new table function and processing.
note - august/31/2004/11:41pm , I have returned to the code after some
five or six months
attending to my wifes illness. I remedied many of the bugs that
were frustrating me then.
It would seem I only needed a break. I have some work to do on
the create table function,
in the GUI. But the project as a whole is working. By the
way, the Table generator is
renamed to Datalink.
note - Jan/18/2.23am , The documentaion is coming along slowly. The
Dll has made a progression
to another version. As well as the table generator. Bugs, Bugs, Bugs.
note - dec/5/11.28pm , I think that I am ready for some documentation
to accompany the project.
I am presently working on an html howto manual.
note - dec/3/10.00pm , Please update your copy of the Table Generator
if you have version 0.0.3
or earlier. The restructure function is now working adequately.
note - nov/23/11.00pm , I am concentrating on the restructure function
of the Table Generator.
This will allow the user to change or edit the table as they please.
The methods developed for
the Table Generator will find their way into the database engine as
coded methods to restructure
the the table directly from the MHDBE.
note - nov/23/7.23pm , Please update your copy of the Table Generator
if you have version 0.0.1 .
the version 0.0.2 that is posted now has fixed a bug on the post function.
note - nov/21/4.38pm , The table Generator is being developed
primarily to test the table access and
manipulation of the table properties. During the developement
of this progrm I realized that it would
be useful as a utility to accompany the database engine. Also
the MHDBE DLL is very stable and is
posted as well. I do need to write a howto text or html file
to accompany the downloads. this will
be posted as soon as possible.
note - nov/15/2:15am , When I translated the TString objects to
a vector I missed some items in
the create table function. I have been working on this for half
a day and I feel like a dunce. The new
code is posted.
note - nov/15/12:24am , An error has crept into the create table function.
I havent used it in a week
or so. I have been utilizing table files created previously and
I havent kept up with this function. I have
to back track a bit to find the error.
note - nov/12/10:00pm , The files are separating into the subsets.
I have a working version of a DLL.
The records vector is not exported due to some process I dont fully
understand as yet. I have a work
around in place until I can solve the problem.
note - nov/08/8:45pm , I just got rid of the TSringlist objects
and utilized a vector for the list objects.
I seem to have shaved 20 milliseconds off the load time for the above
file. I'll post the new code in a day
or so. The code is now independant of the VCL library.
note - nov/02/10:30pm , Just some performance parameters
for opening the table.
3546 records Size (741,376 bytes)
load table avg 116 MSec (nonvisual)
load table avg 1010 MSec (visual - string grid)
platform win98, 128mb ram, 450mz amd processor
note - oct/26/6:30pm , The flogging has gone well and the code below
has survived after an allnight run.
During this process the test platform generated a file of 3249 records.
The test platform is a while loop
that randomly selects the next, prior, post and delete methods of the
note - oct/22/6:30pm , The flogging has uncovered an error in the code..
It seems to add a lot of blank
records to the file. I am presently working on this, so dont
look for an update on the code for a couple of
note - oct/19 1am , going on to 300,000 iterations with no exceptions.
When I get to a million I'll clean up
the code and post it. 1 million without the gui and am flogging
the gui now. The present code will load
1700 records (418kb) in under 2 seconds on an AMD 450 with 128 mb ram.
note - oct/18/03 , I have begun to flog the core using a 10000 iteration
while loop. At present the
exception count is about 20 or so. The exceptions are occuring
with the delete and the post function.
My goal is for an all nighter with no exceptions. The public
functions of the table class are selected at
random as well as the fiields being randomly loaded. The
core is quite useable at this time but needs
a lot of testing.
note - oct/12/03
The division of labor has begun. Below is the core of the engine
as I see it. I have begun to separate
the engine from the visual operations such as displaying the edits,
listboxes, stringgrids and such.
I will post the visual header later as it develops.