QOF: QOF-backend-SQLite support

QOF 0.7.5

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Files | Functions
QOF-backend-SQLite support
Query Object Framework » Backends: Permanent storage for QOF entities.

## Files
file | qof-sqlite.h
| Public interface of qof-backend-sqlite.

## Functions
void | qof_sqlite_provider_init (void)
| Initialises the SQLite backend. More...

## Detailed Description

The QOF SQLite backend is now mostly functional. This backend is designed for use by embedded systems where libxml2 is too large - other, larger, systems will be able to use a more comprehensive libgda backend that can connect with a variety of databases using plugins.

SQLite is typeless so the types defined for the various QOF parameter types act as more of a guide than a rule.

Since
  0.7.3 KVP support - a separate table in the sqlite file in order to support a value, a path and a type for each KvpValue and to support more than one value (more than one frame) per entity. i.e. a relational database arrangement where the entity record contains a reference to the kvp table. That reference id is the GUID of the entity. The KVP table name is preset and created as:

      CREATE TABLE sqlite_kvp
      ("kvp_id int primary key not null", "guid char(32)", "path mediumtext", "type mediumtext", "value text",
      END_DB_VERSION);

  Entity tables therefore do not contain kvp data. Although the KVP table uses an internal ID number, all lookups are done via the GUID of the entity.

## Function Documentation

void qof_sqlite_provider_init | ( | void |  | ) |

Initialises the SQLite backend.

Sets QOF SQLite Backend Version 0.3, access method = sqlite:

The ID in all SQLite tables created by QOF is the GUID of the entity, expressed as a hexadecimal string.

The version number only changes if:

1. QOF_OBJECT_VERSION changes
2. The QofBackendProvider struct is modified in QOF to support new members and SQLite can support the new function, or
3. The QofBackendOption settings are modified.

Initialises the backend and provides access to the functions that will load and save the data. Initialises default values for the QofBackendOption KvpFrame.

Instance KvpFrames are retrieved and stored as a separate table in the same SQLite file "sqlite_kvp". The primary key is an internal, sequential, identifier that does not need to be exposed. Each KvpValue is one record in the kvp table - frames are just a type of value. Records include fields for the path, type and value of the KvpValue as well as the GUID of the entity that holds the value.

Table name: sqlite_kvp Table values: internal_id, guid_as_string, path, type, value

At present, qof_sqlite has no QofBackendOption options and therefore no strings that are translatable.

Definition at line 1497 of file qof-sqlite.c.

1498 {
1499 QofBackendProvider *prov;
1500
1501 ENTER (" ");
1502 bindtextdomain (PACKAGE, LOCALE_DIR);
1503 prov = g_new0 (QofBackendProvider, 1);
1504 prov->provider_name = "QOF SQLite Backend Version 0.3";
1505 prov->access_method = ACCESS_METHOD;
1506 prov->partial_book_supported = TRUE;
1507 prov->backend_new = qsql_backend_new;
1508 prov->check_data_type = qsql_determine_file_type;
1509 prov->provider_free = qsql_provider_free;
1510 qof_backend_register_provider (prov);
1511 LEAVE (" ");
1512 }
qof_backend_register_provider
void qof_backend_register_provider(QofBackendProvider *)
Definition: qofsession.c:59
QofBackendProvider_s
Definition: qofbackend-p.h:238
QofBackendProvider_s::partial_book_supported
gboolean partial_book_supported
Partial QofBook handler.
Definition: qofbackend-p.h:254
LEAVE
#define LEAVE(format, args...)
Definition: qoflog.h:227
QofBackendProvider_s::provider_free
void(* provider_free)(QofBackendProvider *)
Definition: qofbackend-p.h:280
QofBackendProvider_s::backend_new
QofBackend *(* backend_new)(void)
Definition: qofbackend-p.h:260
QofBackendProvider_s::access_method
const gchar * access_method
Definition: qofbackend-p.h:247
QofBackendProvider_s::check_data_type
gboolean(* check_data_type)(const gchar *)
Distinguish two providers with same access method.
Definition: qofbackend-p.h:277
qsql_backend_new
static QofBackend * qsql_backend_new(void)
Starts the backend and creates the context.
Definition: qof-sqlite.c:1446
QofBackendProvider_s::provider_name
const gchar * provider_name
Definition: qofbackend-p.h:241
ENTER
#define ENTER(format, args...)
Definition: qoflog.h:217