aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/database
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-09-04 13:46:09 +0200
committerMartin Willi <martin@strongswan.org>2009-09-04 13:46:09 +0200
commit7daf5226b74e14a6e0f1a888b0be26f3d246f9f8 (patch)
tree6436de2e84e7a677ecfb83db4bf44766cc273d9f /src/libstrongswan/database
parent7d1b0304467bc668b592ccd6680fd9615efbb5b2 (diff)
downloadstrongswan-7daf5226b74e14a6e0f1a888b0be26f3d246f9f8.tar.bz2
strongswan-7daf5226b74e14a6e0f1a888b0be26f3d246f9f8.tar.xz
removed trailing spaces ([[:space:]]+$)
Diffstat (limited to 'src/libstrongswan/database')
-rw-r--r--src/libstrongswan/database/database.h12
-rw-r--r--src/libstrongswan/database/database_factory.c12
-rw-r--r--src/libstrongswan/database/database_factory.h6
3 files changed, 15 insertions, 15 deletions
diff --git a/src/libstrongswan/database/database.h b/src/libstrongswan/database/database.h
index 16472d869..42f1f8d5b 100644
--- a/src/libstrongswan/database/database.h
+++ b/src/libstrongswan/database/database.h
@@ -63,12 +63,12 @@ enum db_driver_t {
char *atext;
database_t *db;
enumerator_t *enumerator;
-
+
db = lib->database->create("mysql://user:pass@host/database");
affected = db->execute(db, &rowid, "INSERT INTO table VALUES (?, ?)",
DB_INT, 77, DB_TEXT, "a text");
printf("inserted %d row, new row ID: %d\n", affected, rowid);
-
+
enumerator = db->query(db, "SELECT aint, atext FROM table WHERE aint > ?",
DB_INT, 10, // 1 argument to SQL string
DB_INT, DB_TEXT); // 2 enumerated types in query
@@ -83,7 +83,7 @@ enum db_driver_t {
@endcode
*/
struct database_t {
-
+
/**
* Run a query which returns rows, such as a SELECT.
*
@@ -93,7 +93,7 @@ struct database_t {
* @return enumerator as defined with arguments, NULL on failure
*/
enumerator_t* (*query)(database_t *this, char *sql, ...);
-
+
/**
* Execute a query which dows not return rows, such as INSERT.
*
@@ -103,7 +103,7 @@ struct database_t {
* @return number of affected rows, < 0 on failure
*/
int (*execute)(database_t *this, int *rowid, char *sql, ...);
-
+
/**
* Get the database implementation type.
*
@@ -113,7 +113,7 @@ struct database_t {
* @return database implementation type
*/
db_driver_t (*get_driver)(database_t *this);
-
+
/**
* Destroy a database connection.
*/
diff --git a/src/libstrongswan/database/database_factory.c b/src/libstrongswan/database/database_factory.c
index ef6927874..c0c666138 100644
--- a/src/libstrongswan/database/database_factory.c
+++ b/src/libstrongswan/database/database_factory.c
@@ -29,12 +29,12 @@ struct private_database_factory_t {
* public functions
*/
database_factory_t public;
-
+
/**
* list of registered database_t implementations
*/
linked_list_t *databases;
-
+
/**
* mutex to lock access to databases
*/
@@ -49,7 +49,7 @@ static database_t* create(private_database_factory_t *this, char *uri)
enumerator_t *enumerator;
database_t *database = NULL;
database_constructor_t create;
-
+
this->mutex->lock(this->mutex);
enumerator = this->databases->create_enumerator(this->databases);
while (enumerator->enumerate(enumerator, &create))
@@ -103,15 +103,15 @@ static void destroy(private_database_factory_t *this)
database_factory_t *database_factory_create()
{
private_database_factory_t *this = malloc_thing(private_database_factory_t);
-
+
this->public.create = (database_t*(*)(database_factory_t*, char *url))create;
this->public.add_database = (void(*)(database_factory_t*, database_constructor_t))add_database;
this->public.remove_database = (void(*)(database_factory_t*, database_constructor_t))remove_database;
this->public.destroy = (void(*)(database_factory_t*))destroy;
-
+
this->databases = linked_list_create();
this->mutex = mutex_create(MUTEX_TYPE_DEFAULT);
-
+
return &this->public;
}
diff --git a/src/libstrongswan/database/database_factory.h b/src/libstrongswan/database/database_factory.h
index 8875adad7..04ca3da13 100644
--- a/src/libstrongswan/database/database_factory.h
+++ b/src/libstrongswan/database/database_factory.h
@@ -44,21 +44,21 @@ struct database_factory_t {
* @return database_t instance, NULL if not supported/failed
*/
database_t* (*create)(database_factory_t *this, char *uri);
-
+
/**
* Register a database constructor.
*
* @param create database constructor to register
*/
void (*add_database)(database_factory_t *this, database_constructor_t create);
-
+
/**
* Unregister a previously registered database constructor.
*
* @param create database constructor to unregister
*/
void (*remove_database)(database_factory_t *this, database_constructor_t create);
-
+
/**
* Destroy a database_factory instance.
*/