SQL and LDAP lookup functions. More...
Go to the source code of this file.
Functions | |
char * | smf_lookup_db4_query (char *database, char *key) |
function to get value by key from berkeley hash table | |
int | smf_lookup_db4_update (const char *database, const char *key, const char *value) |
Updates a key in a berkeley database. The database is created if it does not exist. Afterwards the key is created or updated with the given value. | |
int | smf_lookup_sql_connect (SMFSettings_T *settings) |
connect to sql server | |
void | smf_lookup_sql_disconnect (SMFSettings_T *settings) |
Disconnect from sql server. | |
SMFList_T * | smf_lookup_sql_query (SMFSettings_T *settings, const char *q,...) |
Query SQL server with given query string. | |
int | smf_lookup_ldap_connect (SMFSettings_T *settings) |
Open a connection to ldap server. | |
void | smf_lookup_ldap_disconnect (SMFSettings_T *settings) |
Disconnect from LDAP Server. | |
SMFList_T * | smf_lookup_ldap_query (SMFSettings_T *settings, const char *q,...) |
query LDAP Server with given query string | |
SQL and LDAP lookup functions.
Spmfilter implements a small, fast, and easy to use database API with thread-safe connection pooling. The library can connect transparently to multiple database systems, has zero configuration and connections are specified via a standard URL scheme.
Supported are variety of database systems:
Spmfilter cares completely around connection management, load balancing and fallback connections. Failed connections will be also reconnected again automatically.
Whether you are using a SQL database or a LDAP directory, all results are delivered as a SMFList_T back. Each element is a SMFDict_T dictionary, in which each key a SQL column or a LDAP attribute represents.
The only exception here is Berkeley DB, as this does not require a query language and is based on key/values.
In order to use database lookups, you have to set a appropriate backend in spmfilter.conf, this can be sql or ldap. If a valid backend is configured, spmfilter will automatically establish the connection.
char * smf_lookup_db4_query | ( | char * | database, |
char * | key | ||
) |
function to get value by key from berkeley hash table
database | path to database |
key | key for which the value should be returned |
int smf_lookup_db4_update | ( | const char * | database, |
const char * | key, | ||
const char * | value | ||
) |
Updates a key in a berkeley database. The database is created if it does not exist. Afterwards the key is created or updated with the given value.
database | The path of the database to update (resp. create) |
key | The key to update (resp. create) |
value | The new value of the key |
int smf_lookup_ldap_connect | ( | SMFSettings_T * | settings | ) |
Open a connection to ldap server.
settings | Pointer to SMFSettings_T |
void smf_lookup_ldap_disconnect | ( | SMFSettings_T * | settings | ) |
Disconnect from LDAP Server.
settings | Pointer to SMFSettings_T |
SMFList_T * smf_lookup_ldap_query | ( | SMFSettings_T * | settings, |
const char * | q, | ||
... | |||
) |
query LDAP Server with given query string
settings | Pointer to SMFSettings_T |
q | format string pointer for ldap query |
... | format string arguments |
int smf_lookup_sql_connect | ( | SMFSettings_T * | settings | ) |
connect to sql server
settings | Pointer to SMFSettings_T |
void smf_lookup_sql_disconnect | ( | SMFSettings_T * | settings | ) |
Disconnect from sql server.
settings | a SMFSettings_T object |
SMFList_T * smf_lookup_sql_query | ( | SMFSettings_T * | settings, |
const char * | q, | ||
... | |||
) |
Query SQL server with given query string.
settings | Pointer to SMFSettings_T |
q | format string for sql query for sql query |