Foreword about abstraction

Variables syntax in SQL
NULL handling when using variables
SQL identifiers
Binary large objects (BLOBs)

Libgda aims both at making it easier to use databases and, for applications written using it, at making it easier to switch to a different database or to to be able to use different types of databases with a minimum or no code modifications. To achieve the 2nd goal, Libgda proposes an abstraction of most of database's engine features, which has to be understood to write portable code.

Variables syntax in SQL

Each database engine has its own way of specifying variables (i.e. place holders) in SQL code (for example: $<number>, :<name>, ?<number>, or ?). Libgda has specified yet another format for variables which can be used with all the databases and which has the following advantages:

  • allow to specify a name (and optionally a description)

  • allow to specify a type, see gda_g_type_from_string()

  • allow to specify if the variable can be NULL

For more information, refer to the GdaSqlParser object's documentation