I need to turn in a project for my programming class. We have to make a database manager in pure C language. We have to use linked lists and files. The program has to: create/modify/delete a table, add fields (names and types), and add/modify/delete entries. There needs to be a file/list for tables and another file/list for all entries. Any help (codes, examples, algorithm, etc) will be appreciated. Help needed ASAP!!
Database manager in borland C?
I am not going to use the complete syntax rules of c, but only C friently pseudo code
ptr2savefunction, ptr2comparefunction and ptr2loadfunction are function pointers to functions which can load, compare and save the values of a node_val_t. They can take various arguments, which I am not going to specofy here just to be brief. You may need many implementations of these functions.
struct node_val_t
{
void * value
ptr2savefunction * saver
ptr2loadfunction * loader
ptr2comparefunction * comparer
}
struct ll_node_t
{
node_val_t * payLoad
ll_node_t * next
ll_node_t * prev //Only if the list is doubly linked.
}
Then, make the functions to insert, delete, find values in a linked list.
A table is just a linked list of linked list of node_val_t objects.
So you need a master linked list per table; each element in this linked list is indexing a row ( record ). Each record is also another linked list, where each element is a value, of some sort.
On insert, you would have to insert a row into the table. When you do this, you create a new node_val_t and set its payload to a second new linked list ( that contains the row data ). Each of the elements of the linked list have to ben then initialized. The function pointers can be set based on the type of data each of the cells contain.
This is just one way of doing this. Of course, my example is not complete, but should give you an example of where to start.
Reply:What database are you going to be working with, or are you implementing the database itself?
floral bouquets
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment