[an error occurred while processing this directive]

Siag Office

Shohei Mail

Webresolve

Pen

Dwatch

XMagick

Myhtml

Simple Database Library

Sdbsiod

mod_log_sdb

mod_sql_sdb

Sdbgrey

Ulric's Router Construction Kit

neXtaw

Mowitz

Kylie

O3read

Ucron

Parsecgi

Mr Big


Ulric's stuff


IPv6 Certification Badge for ulriceriksson
 

LibSDB

This is libsdb, the simple database library, which provides a way to support multiple database management systems in an application with negligeable overhead, in terms of code as well as system resources. It is mainly intended for use on Unix, but the ODBC driver works on Windows as well.

Supported databases:

  • Gdbm
  • Ingres
  • Lago
  • Microsoft SQL
  • Mimer
  • MiniSQL
  • Mysql
  • Sqlite versions 2 and 3
  • Postgresql
  • Oracle
  • Shsql/quisp
  • Sybase
  • Text (built-in plaintext engine)
There is also a driver for ODBC which can be used for any database supported by UnixODBC, including Sybase.

A proxy daemon allows an application to use sdb without linking with libsdb and database client libraries.

Recent development

Release 0.7.0 added support for Shsql. Release 0.8.0 updated the Oracle support to version 11g. Release 0.9.0 added support for Microsoft SQL and Sybase through the FreeTDS library.

[an error occurred while processing this directive]

All changes

Installation

See INSTALL for installation instructions.

Database interface

The database interface is a single function, sdb_query. Synopsis:
        int sdb_query(char *url, char *query,
                int (*callback)(int, char **, void *), void *closure)
url is a string which identifies the driver and any necessary options such as the name of the database and user. The set of options is driver specific. Examples:
        mysql:host=XXX:db=XXX:uid=XXX:pwd=XXX
        postgres:host=XXX:db=XXX:port=XXX
        oracle:uid=XXX:pwd=XXX OR oracle:uid=username/password@instance
        sqlite:db=/full/path/to/db
        lago:host=XXX:port=XXX:db=XXX:uid=XXX:pwd=XXX
        mimer:
        odbc:dsn=postgresql
	gdbm:db=foo.db
Some drivers also get parameters from environment variables, such as ORACLE_SID. query is an SQL string sent to the database, such as
        select count(*) from crontab where host='myhost'
sdb_query calls the callback once for each row returned. No rows does not necessarily indicate an error condition; for example
        delete from crontab where host='myhost'
does not return anything. sdb_query returns the number of rows or -1 for error. The callback takes three arguments, an integer indicating the number of columns in the reply, an array of pointers to the fields and a pointer to some arbitrary data that the callback might need. Values are always returned as strings. Synopsis:
        int callback(int n, char **p, void *closure)
The file sdb_client.c contains a very simple line-mode client. It gets the url from the environment variable SDB_URL. Example:
sh-2.03$ ./sdb_client oracle:uid=system/manager@ulric
sdb> select * from counters
serialno 1 
serial 17 
Return code: 2
sdb> update counters set value=2 where name='serialno'
Return code: 0
sdb> select * from counters
serialno 2 
serial 17 
Return code: 2
sdb>

Download

The latest version of libsdb is available here.

Freshmeat project page

There is a mailing list: sdb@siag.nu. To subscribe, send mail to majordomo@siag.nu with the message body:

subscribe sdb

Programs using LibSDB

Siag Office
Ucron
mod_auth_sdb, authentication module for Apache
Squid authentication module
Kannel: Open Source WAP and SMS gateway
The Siod Scheme interpreter with LibSDB support
Proftpd authentication module
An Apache module for logging to a SQL database
Sdbgrey, a greylisting policy server for postfix.

Author: Ulric Eriksson (ulric@siag.nu)
[an error occurred while processing this directive]
                                                                                                                                                                                                                                                                               
 

Valid HTML 4.01! Powered By ...?
Google