LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2008, 05:11 AM   #1
xemous
Member
 
Registered: Jun 2004
Posts: 80

Rep: Reputation: 15
Thumbs up SeekingAdvice: Embedded Database in C


Hi.


I'll get right to it.

I need to write a program in C/nCurses for my dad. It needs a database back end. There are two requirements that I need some form of database backend for.

Requirements: ( 0 )
0. Store a category.
1. Store liquor lines.
2. Store the units for each line.
3. Store the cases and costs for each unit.

Eg.
Beer -< Category

Victoria Bitter <- Liquor Line

375ml stubby <- Unit type
24pk <- Case type
6pk <- Case type

800mls <- Unit type
18pk <- Case type

Requirements: ( 1 )
0. Account / Customer Details. ( same thing )
1. Invoice report for some Account / Customer

So basically it's two databases, and 4 tables for the first one and 2 for the second one. I've done stuff like this before in SQL so I'm used to SQL style but I can figure out any database language.

I did write some low level file handling stuff for a subject in computer science, basically writing our records to pages and flushing pages out to binary, and writing some indexes for it. It was hard!

I don't wanna write all my own low level file handling, I need something to embed thats free software and good but I can't find anything except some experimental thing some university in some country is writing but there's no source code.

If you guys know any good stuff thats well documented I'd appreciate it. I gotta get this thing done ASAP my dad needs something fast.
 
Old 05-31-2008, 05:30 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Why embedded - how small is 'embedded' and what CPU?

A key/value database (like the sleepycat DB) is fairly small - but I get the impression you want a relational DB.

You can get x86-family or ARM processors that consume under 8W (12-15W with hard disks) and these have better specs than a top-of-line desktop from 8 years ago - definitely capable of running a relational database like PostGRESQL or MySQL (but check the project websites to see what CPUs they've been built and tested on). Given the rather steep price of these small boards for the embedded market, you may be better off buying a Mac Mini or the generic PC clone equivalent - that way you have a single warranty and a nice box.

The database is the easy part - making a nice friendly web interface is the tough part. My guess is 2 weeks solid work + testing and that's assuming you already know what you're doing and don't have to spend too much time reading.
 
Old 05-31-2008, 05:36 AM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Have a look at SQLite.
No seperate database server process or so. Just a library that will store your (multiple) tables and indexes in one binary file.

Open source, and avaibable as a package on most distributions.
 
Old 05-31-2008, 05:36 AM   #4
huwnet
Member
 
Registered: Jan 2006
Location: England
Distribution: Arch
Posts: 119

Rep: Reputation: Disabled
What about using SQLite?

Edit: I see Hko just beat me to it!
 
Old 05-31-2008, 05:37 AM   #5
xemous
Member
 
Registered: Jun 2004
Posts: 80

Original Poster
Rep: Reputation: 15
I don't mean embedded as in it's on a small device.

Sorry I just googled and got the meaning of the term. It's not what I want.
I can use a separate database and write a C client with ncurses but I think it'd be easier if I could include a database library into the C program and do everything from within without starting up a database server.

Like #include <some database library>

I'm trying to avoid using a separate database server for it just 'cause but if thats the way to go then I can do that too.

The programs very basic so will be the UI it's going to run on a laptop.
 
Old 05-31-2008, 05:38 AM   #6
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Is there anything wrong with using SQLite for what you want to do?
 
Old 05-31-2008, 06:06 AM   #7
xemous
Member
 
Registered: Jun 2004
Posts: 80

Original Poster
Rep: Reputation: 15
Thumbs up

No SQLite is perfect. It's what I wanted.

I typed up the previous response while the other two were being written.


I'll post an update when the programs completed.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Open Source Database meets needs of embedded industry. LXer Syndicated Linux News 0 10-26-2006 02:54 AM
LXer: Create an embedded Derby database Ajax application LXer Syndicated Linux News 0 07-24-2006 06:21 AM
LXer: Linux gains skinny database for mobile, embedded apps LXer Syndicated Linux News 0 06-01-2006 06:21 AM
experiences with embedded mysql? XML instead of a database? SerfurJ Programming 2 12-11-2004 08:06 AM
Embedded SQL -Unable to connect to PostgreSQL database vikram_cvk Linux - Software 1 05-30-2004 06:14 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration