For SQLite

The following arguments are used to connect to an SQLite database:

Table 2. 

Argument name Description Required
DB_NAME Name of the database. This should be the name of the database file without the ".db" extension. However when opening a database, if a file named after the DB_NAME value exists then it is used (so beware, for example if DB_NAME is set to "mydb" and a file named "mydb" exists but is not an SQLite database, then an error will occur). Using the ":memory:" database name will result in a database residing purely in memory, the database ceases to exist as soon as the database connection is closed (every memory database is distinct from every other); refer to SQLite's in memory databases for more information. Yes
APPEND_DB_EXTENSION Defines if the '.db' extension need to be appended to the name of the database. Defaults to TRUE if not specified. No
DB_DIR The directory where the database file is; if not specified, the current working directory is used. No
EXTRA_FUNCTIONS If set to TRUE (or unspecified), then some extra functions defined by Libgda are added. The functions are: gda_file_exists(), gda_hex_print(), gda_hex(), gda_rmdiacr(), gda_lower() and gda_upper(); see below for more information about them. No
EXTRA_COLLATIONS If set to TRUE (or unspecified), then some extra collations defined by Libgda are added. They are: LOCALE (the strings are compared taking into account UTF8 sorting and the current locale) and DCASE (before comparison, all the diacritical signs (for example accents) are removed from the strings and they are converted to lower case). No
REGEXP If set to TRUE (or unspecified), then the regexp() and regexp_match() functions are defined. The regexp() function is used by SQL statement with a construct as "x REGEXP y", and the regexp_match() is more general. The default for this option is TRUE. See below for more information about this function. No
FK Defines if foreign keys are enforced, by default, they are. No
EXTENSIONS Defines if SQLite extensions are allowed to be loaded, using the load_extension() function, default is to deny loading extensions. No



The gda_file_exists() function

This function accepts a filename as argument, and returns 0 if the file with that filename does not exist, or 1 if it does.

The gda_hex_print() function

This function accepts at most 2 arguments, in that order:

  • a blob value

  • a length (not mandatory)

It returns a string suitable to be printed (where all the non ascii characters are converted to the "\xyz" syntax where "xyz" is the decimal value of the character), limited to the specified length if any.

The gda_hex() function

This function accepts at most 2 arguments, in that order:

  • a blob value

  • a length (not mandatory)

It returns a hex dump string of the blob value, limited to the specified length if any.

The gda_rmdiacr() function

This function accepts at most 2 arguments, in that order:

  • a string value

  • a case conversion to do (not mandatory), as a string which must be 'upper' or 'lower'

It returns a string where all the diacritical signs (for example accents) from the input string, and optionally converts the string to upper or lower case if specified. This function takes into account the current locale and is useful to do some text search.

The gda_upper() and gda_lower() functions

These function accept one string argument and convert it to upper or lower case, taking into account the locale (the standard SQLite upper() and lower() functions only operating on ASCII characters).

The regexp_match() function

This function accepts at most 3 arguments, in that order:

  • the string on which the regular expression will be applied

  • the regular expression to apply

  • the options (not mandatory)

The options are specified as a string where each character corresponds to a boolean flag (the presence of the character meaning the flag is set). They are:

  • 'i': specifies a case insensitive matching

  • 'm': specifies that the the "start of line" and "end of line" constructs match immediately following or immediately before any newline in the string, respectively, as well as at the very start and end of the string

  • 'v': specifies that instead of returning 0 or 1 as a result for matching or non matching, the function returns the string which actually matches, or NULL if not match was found

This function is implemented using GLib's Perl-compatible regular expressions implementation: GRegex, itself based on the PCRE library.

Also refer to the SQLite's provider's limitations.