On Thu, Jun 7, 2012 at 3:08 AM, Simon Walter <si...@gikaku.com> wrote:
> On 06/07/2012 12:29 PM, Lars Nilsson wrote:
>> I've been happy using SQLAPI++ (http://www.sqlapi.com/) where I work.
>> Commercial and not open source, but it's cross-platform and supports a
>> dozen or so different databases.

> It looks nice. I'm looking for something open source. I'm fine using one of
> the SQL connectors. I just need to know which one works. How does SQLAPI++
> connect to MySQL? Is it thread safe?

It loads the libmysqlclient dll/so libraries under the hood, mapping
each database client library's particular function set to its own
internal function pointers. I believe it to be thread-safe (pthread
mutexes on Linux/Unix, Windows relies on mutex/critical section
objects). Instances of SAConnection objects should probably not be
used across threads simultaneously though (usual caveats when doing
multi-threaded programming apply, etc).

I do like the high-level abstraction of the databases, and the use of
exceptions for errors so every statement doesn't need to have a check
to see if it was successful (just wrap your sequence of operations in
a try/catch as makes sense for the application). I know it reduced my
database-specific lines of code quite a bit when I changed a MySQL
specific program to using SQLAPI++.

If one need to, it is always possible to get a native database handle
out that can be used with the database-specific API (at which point
your program would have to be linked with the required
database-specific client libraries, and so on), but it is not
something I have really needed personally. If at all possible, I stay
in the realm of SQLAPI++ which makes my program independent of the
database libraries (implies I do not use native handles). It means I
can compile my program without having Oracle installed for instance,
and as long as a user has some means of configuring my program so that
SA_Oracle_Client is passed to a connection object (mapping from string
to the enum value or whatever else make sense), it should just work,
given a proper connection string (as long as one handles the special
cases properly as outlined in database specific notes for the classes
and methods, etc)

I'm sorry if I sound like a sales person for SQLAPI++. I have no
relation to it, just a satisfied user.

Lars Nilsson

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to