Database/Structures and Indexes - Btree? 
Author Message
 Database/Structures and Indexes - Btree?

I have an application that currently uses ADO to communicate with a back-end
database.  While under Windows this is sufficient, I'd prefer to use a means
that is compatible on other OS systems.

Therefore, my thought was to use a structure to represent a record in a
database.  For example:

struct tagTMyRecord {
  long Id;
  char Tag[30];
  long NumberData;
  char StringData[64];
  BYTE Reserved[48];

Quote:
} TMyRecord;

struct tagTMyRec2 {
  long Id;
  long NumberData;
  char data[12];

Quote:
} TMyRec2;

Each of the above structures represent two types of database records.  In
both structures, I'd like to use the "Id" as a primary key that will ALWAYS
be unique for each record and then use the "NumberData" field as a secondary
key.  Additionally, would prefer to use "Tag" as another secondary key in
the first structure since it is also a unique value.

Therefore, I'd like to store my data in a format like:

  tmyrecord.dat - Database file
  tmyrecord.ix1 - Index File #1 (id lookup)
  tmyrecord.ix2 - Index File #2 (numberdata lookup)
  tmyrecord.ix3 - Index File #3 (tag lookup)

  tmyrec2.dat - Database file
  tmyrec2.ix1 - Index File #1 (id lookup)
  tmyrec2.ix2 - Index File #2 (numberdata lookup)

My goal is to develop or preferrably locate a pre-existing package, library,
or free code that would support doing something like this.  I've been
thinking about ways which Templates could be used where for each database I
want to create, I could have something like:

CMyDatabase<TMyRecord> myRecDb;
CMyDatabase<TMyRec2> myRec2Db;

The database class would enable me to insert, retreive, delete, and update
an existing record in the database using either the primary key or any
secondary key.  Regardless of the type of transaction that is being done
(insert/delete/update), the index files will be updated (if applicable) any
time a change is performed against a record - thus keeping the index and
database files in sync.

This is a high-level what I am trying to accomplish.  I've found a few
packages already, but none that offers the flexibility that I am really
after.

It's important to note that this implementation should work in a
multi-threaded environment when multiple threads are accessing the database
files.  My hopes are to expand this further to allow multiple processes to
access the database files concurrently using a common lbrary interface of
functions that provide simplied database calls for manipulating application
data.

If anyone can offer any input, I'd greatly appreciate it.

Thanks
Chris



Wed, 24 Aug 2005 06:17:31 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Want tools to print tables structure and index seen on Database Explorer

2. Which database for Multidimensional index structure

3. Which database for Multidimensional index structure

4. Index question (best index structures for a table)

5. Btree indexes. (question)

6. multi-column btree index for real values

7. reverse order on secondary btree indexes

8. btree indexing

9. btree indexes d3nt/ap

10. patch to allow btree indices on BYTEA

11. Problem with btree index?

12. 6.4/04 btree index corruption after system crash


 
Powered by phpBB® Forum Software