What is the SQLClient library?
The SQLClient library is designed to provide a simple interface to SQL
databases for GNUstep applications. It does not attempt the sort of
abstraction provided by the much more sophisticated GDL2 library
but rather allows applications to directly execute SQL queries and statements.
SQLClient provides for the Objective-C programmer much the same thing that
JDBC provides for the Java programmer (though SQLClient is a bit faster,
easier to use, and easier to add new database backends for than JDBC).
The major features of the SQLClient library are -
* Simple API for executing queries and statements...
a variable length sequence of comma separated strings and other
objects (NSNumber, NSDate, NSData) are concatenated into a single
SQL statement and executed.
* Simple API for combining multiple SQL statements into a single
transaction which can be used to minimise client-server interactions
to get the best possible performance from your database.
* Supports multiple sumultaneous named connections to a database server
in a thread-safe manner.
* Supports multiple simultaneous connections to different database
servers with backend driver bundles loaded for different database
engines. Clear, simple subclassing of the abstract base class to
enable easy implementation of new backend bundles.
* Configuration for all connections held in one place and referenced
by connection name for ease of configuration control. Changes via
NSUserDefaults can even allow reconfiguration of client instances
within a running application.
* Thread safe operation... The base class supports locking such that
a single instance can be shared between multiple threads.
What backend bundles are available?
Current backend bundles are -
* ECPG - a bundle using the embedded SQL interface for postgres.
This is based on a similar code which has been in production
use for over eighteen months, so it should be reliable.
* Postgres - a bundle using the libpq native interface for postgres.
This is the preferred backend as it allows 'SELECT FOR UPDATE',
which the ECPG backend cannot support due to limitations in the
postgres implementation of cursors. Now well tested efficient,
and in use in large commercial systems.
* MySQL - a bundle using the mysqlclient library for *recent* MySQL.
I don't use MySQL... but the test program ran successfully with a
vanilla install of the MySQL packages for recent Debian unstable.
* SQLite - a bundle using the sqlite3 library which supports an
SQL-like API for direct access to a database file (rather than
acting as a client of a database server process).
Not as functional as the other backends (doesn't support dates
for instance), but good enough for many purposes and very
'lightweight'. See http://www.sqlite.org
* Oracle - a bundle using embedded SQL for Oracle.
Completely untested... may even need some work to compile...
but this *is* based on code which was working about a year ago.
No support for BLOBs yet.
Where can you get it? How can you install it?
The SQLClient library is currently available at
or via CVS from the GNUstep CVS repository (See <https://savannah.gnu.org/cvs/?group=gnustep>. Check out gnustep/dev-libs/SQLClient).
To build this library you must have a basic GNUstep environment set up...
* The gnustep-make package must have been built and installed.
* The gnustep-base package must have been built and installed.
* The Performance library (from the dev-libs area in GNUstep CVS)
must have been built and installed.
* If this environment is in place, all you should need to do is
run 'make' to configure and build the library, 'make install'
to install it.
* Then you can run the test programs.
* Your most likely problems are that the configure script may
not detect the database libraries you want... Please figure
out how to modify configure.ac so that it will detect the
required headers and libraries on your system, and supply a patch.
Bug reports, patches, and contributions (eg a backend bundle for a new database)
should be entered on the GNUstep project page