gdbm with c programmin Books & Tutorial.


 
Thread Tools Search this Thread
Top Forums Programming gdbm with c programmin Books & Tutorial.
# 1  
Old 09-06-2012
gdbm with c programmin Books & Tutorial.

Hello,

Could you please tell me if there are any books/tutorial on
gdbm programming with C for beginners.

So far, I've found few tutorials and one of those:
http://www.network-theory.co.uk/docs...cintro_22.html
is easy to understand but very short in treatment as it dealt with
three api(s) and others seem difficult so it would better to follow
books/detail tutorial.


Thanks.

Last edited by vectrum; 09-06-2012 at 05:19 PM..
# 2  
Old 09-06-2012
It is good to know relational databases, generally, and SQL, and simpler C/C++/JAVA APIs, before diving into the combination. The APIs are more orderly in C++/JAVA, while C APIs run on assumptions and man pages. Starting with a simple API to learn C/C++/JAVA is a good start, before going into complex APIs.

Generally, gdbm allows you to create container objects with hash based search. Ther are many different container types. They all act much like a RDBMS table with one index only. You can index data a second way by creating a second, indexing container to search using a different key. Data storage can be by pointer outside the containers, so two containers can point to the same row or tuple of data. However, you need reverse pointers in the data so a delete on one key can delete in the other container, too.

Besides hash, which is great for fast random lookup but requires some configuration for size, there is linear-hash, tree, unsorted, array, linked-list (one way or forward-backward) containers, each with different advantages. Trees are always sorted and tolerate all amounts of data well without configuration. Unsorted linked list is very fast to insert and slow to query, update, delete specific item. Hash has a patterened disorder when examining all items.
This User Gave Thanks to DGPickett For This Post:
# 3  
Old 09-06-2012
Thank you. I'm looking for something like storing and retrieving few names and telephone numbers through c code.

I'm planning to use sqlite but like to test dbm/gdmb first as it doesn't use any dedicated shell or clent/server kind of thing, so a small database can be created without much overhead. I tried nosql mongodb but, as it uses javascript for its query language and I
don't know javascript so couldn't proceed to nosql.
# 4  
Old 09-07-2012
The erliest and most basic are the tsearch(), bsearch(), lsearch(), hsearch(), qsort() family:
Man Page for tsearch (linux Section 3) - The UNIX and Linux Forums

C++ Standard Template libs has many very basic containers (no hash):
STL Containers - C++ Reference
map - C++ Reference

To get the hash, many of my employers have had roguewave h++ libraries: RWTPtrHashTable<T>

Don't overlook the fine container objects in JAVA, like tree map:
TreeMap (Java Platform SE 6)

Google reveals a myriad of open source containers/lists/maps/trees/tables. Some RDBMS implement a multi-column index as containers of containers of containers, so each column can be looked up even if others are not there (so the whole container is iterated). Many good wiki on the high level concepts of hash and such, very good to know first, so API controls make sense.

Finally, awk and bash have associative arrays or lookup vectors, which are hash maps (learn the lingo or get out). Just be careful you are not in the simple "array addressed by integer" tutorial! I am sure PERL has all this, too, so read the wiki and pick your poison. Do you grasp the array, linked list (sorted and unsorted), tree and hash basic concepts?
These 2 Users Gave Thanks to DGPickett For This Post:
# 5  
Old 09-07-2012
Thanks for your detailed and meticulous explanation.
I've found two tutorial sets that can be of good help but those are on
dbm rather than gdbm so little bit of R&D needs to be done. Smilie

Berkeley DB Reference Guide: Adding elements to a database

The content the following link points has got very striking similarities with
a book, Beginning Linux Programming by Mathew and I got confused as I failed to understand
who copied whom. Did Professor Fuller copy the content of the book or Neil Mathew
et al copy the content of the tutorial note for his book?

http://snap.nlc.dcccd.edu/learn/full...ap7/chap7.html
# 6  
Old 09-10-2012
OO programming says lists should be in container objects. I saw a huge case statement several places today, and each should have been something like a containater lookup. It is less code and faster! Done right, the compiler can do the searches at compile time.

BDB is a modest RDBMS. but gdbm is GNU dbm is more at the container level.

If you can manage persistent objects, perhaps storing them in mmap()'s of flat files, then your containers can have the behaviors of an RDBMS.
# 7  
Old 09-10-2012
Quote:
Originally Posted by DGPickett
Done right, the compiler can do the searches at compile time.
What kind of container can be searched at compile time?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Web Development

Vue JS 2 Tutorial by The Net Ninja: A Recommended Vue.js Video Tutorial Series

A number of people have asked me how to get started with Vue.js and my reply before today was to Google "Vue.js". That has changed and my recommendation to anyone who wants to learn the fastest growing, easiest to learn and use Vue.js web dev framework is to watch this video tutorial series: ... (0 Replies)
Discussion started by: Neo
0 Replies

2. Shell Programming and Scripting

PHP read large string & split in multidimensional arrays & assign fieldnames & write into MYSQL

Hi, I hope the title does not scare people to look into this thread but it describes roughly what I'm trying to do. I need a solution in PHP. I'm a programming beginner, so it might be that the approach to solve this, might be easier to solve with an other approach of someone else, so if you... (0 Replies)
Discussion started by: lowmaster
0 Replies

3. AIX

books & documents

can someone tell me the name of the books for aix it is better if some one provide me links to any useful document (2 Replies)
Discussion started by: alokjyotibal
2 Replies

4. UNIX for Dummies Questions & Answers

Problem installing gdbm

I'm trying to install gdbm on a MacPro running Leopard. But when I do the make install, I get this error: /usr/bin/install -c -m 644 -o root -g root gdbm.h \ /usr/include/gdbm.h install: root: Invalid argument make: *** Error 67 Any ideas? Thanks (1 Reply)
Discussion started by: Shan Hollen
1 Replies

5. Shell Programming and Scripting

Books on PHP & APACHE

Can anybody please suggest me a good book to learn PHP and Apache. I want to use it for general programming and espeacially as front end tool for INFORMIX RDBMS. The book should guide me from the basics, as I am a beginer for PHP & Apache on SUSE Linux 9.0. (1 Reply)
Discussion started by: V.V.KUMAR
1 Replies

6. IP Networking

socket programmin

I was trying to write proxy code but i here is a problem typedef struct req_msg { char *host;//hostname char *filename;//filename char *modified;//date char *data; char *request; }req_msg; while(take_responce(req,request)!=0) // take_responce gets responce from http server //... (0 Replies)
Discussion started by: yogesh_powar
0 Replies

7. Shell Programming and Scripting

file editting with shell programmin

Hello, I have several handreds of text files. The format of file looks like: column1 column2 column3 column4 column5 id1 definition1 name1 fieldid comm1 id2 definition2 name2 fieldid ... (4 Replies)
Discussion started by: ssshen
4 Replies

8. Shell Programming and Scripting

Tk tutorial

Anyone know any good website with a step by step instructions on writing Perl GUI scripts with Tk ??? (3 Replies)
Discussion started by: perleo
3 Replies

9. Shell Programming and Scripting

Books on Shell programmin

Can Anyone suggest few good books on Unix Shell Programming and C on Unix. Thanks Prasad (5 Replies)
Discussion started by: pswar70
5 Replies
Login or Register to Ask a Question