Click here to Skip to main content
Click here to Skip to main content

DarkSide SQL Mini Version 1, The embedded database

, 23 Mar 2006 BSD
Rate this:
Please Sign up or sign in to vote.
An embedded database library in C++.


Providing local data storage in an application is a real problem faced by many a C++ programmer. To avoid getting oneself confused with low-level file handling routines and chores like data indexing, most programmers tend to use commercial database systems even for minimum data handling purposes. If your application doesn't need the capabilities of a complete RDBMS server, then a small and efficient database library that plugs into your source code will seem an interesting solution. DarkSide SQL Mini is an effort to create such a library. You can take this as a beta release and I want developers to test this code and report bugs before the stable release. You may find even this beta release useful in many of your projects. The best thing about DarkSide SQL Mini is that, unlike other embedded database libraries, you don't have to learn a new set of APIs. It provides a subset of SQL that you can use to define schemas and manipulate data. All you have to learn to use are two classes (Database and ResultSet) and two member functions (execute() and executeQuery())!. Everything else is plain SQL.

Using the code

DarkSide SQL Mini is a source code library. Copy all CPP files in the \dsqlm_1\cpp folder to your projects working directory, add the \dsqlm_1\include directory to your include path, link your object code with dsqlm_1\libdb41s.lib and you are done. You have a nice database system embedded in your application. Now on to some SQL lessons...

First include dsqlm.h in your CPP file:

#include "dsqlm.h"
using namespace dsqlm;

Next create a database object:

Database db("zoo");

This will create the folder zoo, if it does not exist. To create a table, call the CREATE TABLE command.

db.execute("CREATE TABLE animals(name varchar(40) indexed,age int,dob date)");

Data is inserted using the INSERT command:

db.execute("INSERT INTO animals VALUES('Joe',2,'2001-2-20')");

SELECT command is used to search and retrieve data:

ResultSet rslt = db.executeQuery("SELECT * FROM animals WHERE age > 1");
while( {
  cout << rslt.getString(1) << rslt.getString(3) << endl;

The above code will print the name and date of birth of all animals whose age is above 1. In addition to these commands, DarkSide SQL Mini supports DELETE, DROP TABLE, DROP DATABASE and OPTIMIZE commands. The installation contains detailed documentation on the library.

In the demo code, you will find a complete working program that demonstrates the use of various DarkSide SQL commands. Follow the instructions in DarkSide SQL Mini Help files to compile this code.

If you need a complete RDBMS server, you can download DarkSide SQL server for free.


  • Created: Nov 23rd, 2003
  • Updated: Nov 27th, 2003: Fixed bug in logical expression parsing.


This article, along with any associated source code and files, is licensed under The BSD License


About the Author

No Biography provided

Comments and Discussions

GeneralOne Kind Information Sir PinmemberGovindanHari3-Apr-09 3:17 
QuestionAgain bugs sir.... PinmemberGovindanHari3-Apr-09 3:09 
AnswerRe: Again bugs sir.... PinmemberVijay Mathew Pandyalakal3-Apr-09 3:24 
GeneralRe: Again bugs sir.... PinmemberGovindanHari4-Apr-09 3:58 
GeneralRe: Again bugs sir.... PinmemberGovindanHari4-Apr-09 4:47 
Generalerror LNK2005 PinmemberGovindanHari2-Apr-09 22:37 
GeneralRe: error LNK2005 PinmemberVijay Mathew Pandyalakal2-Apr-09 22:56 
Questionerror C2059 PinmemberGovindanHari2-Apr-09 7:14 
AnswerRe: error C2059 PinmemberVijay Mathew Pandyalakal2-Apr-09 20:27 
If you are using MFC, then you will have to change the names of type definitions like INT, FLOAT, BOOL etc. Change them to something like DSQL_INT, DSQL_FLOAT, DSQL_BOOL etc.
Questioncompile error PinmemberGovindanHari2-Apr-09 5:58 
AnswerRe: compile error PinmemberVijay Mathew Pandyalakal2-Apr-09 20:23 
GeneralSqlite Pinmembernewmodel27-Mar-06 5:20 
GeneralRe: Sqlite [modified] PinmemberVijay Mathew Pandyalakal27-Mar-06 16:47 
GeneralRe: Sqlite Pinmembernewmodel27-Mar-06 22:36 
GeneralRe: Sqlite PinmemberVijay Mathew Pandyalakal28-Mar-06 16:25 
Generalsource code of the library: libdb41s.lib Pinmemberozmanothman9-Nov-04 17:04 
GeneralRe: source code of the library: libdb41s.lib PinmemberVijay Mathew Pandyalakal9-Nov-04 17:35 
GeneralRe: source code of the library: libdb41s.lib Pinmemberozmanothman10-Nov-04 4:50 
Generalwarning massage Pinmemberozmanothman6-Nov-04 10:37 
GeneralRe: warning massage PinmemberVijay Mathew Pandyalakal7-Nov-04 17:49 assembly? Pinmemberarachno5-Nov-04 8:39 
AnswerRe: .net assembly? PinmemberVijay Mathew Pandyalakal5-Nov-04 17:36 
GeneralCompile error PinmemberChong Ching Yu6-Jan-04 21:16 
GeneralRe: Compile error PinmemberVijay Mathew Pandyalakal8-Jan-04 1:42 
GeneralRe: Compile error PinmemberChong Ching Yu8-Jan-04 17:31 
GeneralRe: Compile error PinmemberVijay Mathew Pandyalakal9-Jan-04 4:33 
QuestionDarkSide Server Link? Pinmemberlbills6-Jan-04 3:11 
AnswerRe: DarkSide Server Link? PinmemberVijay Mathew Pandyalakal8-Jan-04 1:39 
Generalcompile errors PinmemberRene De La Garza2-Jan-04 6:45 
GeneralRe: compile errors PinmemberVijay Mathew Pandyalakal3-Jan-04 1:49 
GeneralCompile Error PinmemberGilfrog13-Dec-03 10:29 
GeneralRe: Compile Error PinmemberVijay Mathew Pandyalakal18-Dec-03 2:46 
QuestionWhere? PinmemberDewey Vozel10-Dec-03 4:20 
AnswerRe: Where? PinmemberVijay Mathew Pandyalakal11-Dec-03 19:06 
GeneralRe: Where? PinmemberDewey Vozel12-Dec-03 3:38 
QuestionWhat is the source of the library? PinmemberBill Seddon9-Dec-03 22:00 
AnswerRe: What is the source of the library? PinmemberVijay Mathew Pandyalakal11-Dec-03 19:10 
GeneralRe: What is the source of the library? PinsussTimSmith_S12-Jan-04 10:04 
GeneralRe: What is the source of the library? PinmemberVijay Mathew Pandyalakal12-Jan-04 18:18 
AnswerRe: What is the source of the library? Beware License PinmemberNeville Franks10-Mar-04 0:39 
GeneralLink not accessible PinmemberPerry Bruins2-Dec-03 20:35 
GeneralUNICODE support PinmemberJoão Paulo Figueira1-Dec-03 5:32 
GeneralRe: UNICODE support PinmemberVijay Mathew Pandyalakal1-Dec-03 19:12 
GeneralRe: UNICODE support PinmemberJohann Gerell1-Dec-03 23:50 
GeneralRe: UNICODE support PinmemberVijay Mathew Pandyalakal4-Dec-03 1:29 
GeneralRe: UNICODE support PinsitebuilderUwe Keim4-Dec-03 23:21 
GeneralA similar library exists: SQLite - An Embeddable SQL Database Engine PinmemberOlan Patrick Barnes1-Dec-03 5:29 
GeneralReally contructive ! Pinmemberemilio_g1-Dec-03 23:02 
GeneralRe: Really contructive ! PinmemberOlan Patrick Barnes2-Dec-03 3:38 
GeneralRe: Really contructive ! PinmemberVijay Mathew Pandyalakal4-Dec-03 1:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.150327.1 | Last Updated 23 Mar 2006
Article Copyright 2003 by AnOldGreenHorn
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid