attr-sql: Don't use database transactions in create_attribute_enumerator
authorTobias Brunner <tobias@strongswan.org>
Thu, 5 Sep 2013 15:03:11 +0000 (17:03 +0200)
committerTobias Brunner <tobias@strongswan.org>
Fri, 11 Oct 2013 13:16:05 +0000 (15:16 +0200)
There could, of course, be race conditions when enumerating the attributes,
but those probably don't matter (e.g. missing an attribute that was
concurrently added).

Transactions are more intended to revert multiple changes if anything
fails in the process.

src/libhydra/plugins/attr_sql/sql_attribute.c

index e91e1ed..cad5bfa 100644 (file)
@@ -346,8 +346,6 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
                u_int count;
                char *name;
 
-               this->db->execute(this->db, NULL, "BEGIN EXCLUSIVE TRANSACTION");
-
                /* in a first step check for attributes that match name and id */
                if (id)
                {
@@ -418,8 +416,6 @@ METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
                        pool_enumerator->destroy(pool_enumerator);
                }
 
-               this->db->execute(this->db, NULL, "END TRANSACTION");
-
                /* lastly try to find global attributes */
                if (!attr_enumerator)
                {
@@ -474,4 +470,3 @@ sql_attribute_t *sql_attribute_create(database_t *db)
                                          DB_UINT, now);
        return &this->public;
 }
-