]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
driver-sqlpool: Use init_full when available
authorAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 31 Aug 2018 09:43:11 +0000 (12:43 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 14 Nov 2018 08:12:47 +0000 (10:12 +0200)
src/lib-sql/driver-sqlpool.c

index f262ed0fff2fcd7a368d9351359f0fd8ba7f7770..1bf1dbbcd6ff52c92af7948e01e269971b2d8114 100644 (file)
@@ -264,10 +264,22 @@ sqlpool_add_connection(struct sqlpool_db *db, struct sqlpool_host *host,
 {
        struct sql_db *conndb;
        struct sqlpool_connection *conn;
+       const char *error;
+       int ret = 0;
 
        host->connection_count++;
 
-       conndb = db->driver->v.init(host->connect_string);
+       if (db->driver->v.init_full == NULL) {
+               conndb = db->driver->v.init(host->connect_string);
+       } else {
+               struct sql_settings set = {
+                       .connect_string = host->connect_string,
+               };
+               ret = db->driver->v.init_full(&set, &conndb, &error);
+       }
+       if (ret < 0)
+               i_fatal("sqlpool: %s", error);
+
        i_array_init(&conndb->module_contexts, 5);
 
        conndb->state_change_callback = sqlpool_state_changed;