1 /*
2    BAREOS® - Backup Archiving REcovery Open Sourced
3 
4    Copyright (C) 2018-2018 Bareos GmbH & Co. KG
5 
6    This program is Free Software; you can redistribute it and/or
7    modify it under the terms of version three of the GNU Affero General Public
8    License as published by the Free Software Foundation and included
9    in the file LICENSE.
10 
11    This program is distributed in the hope that it will be useful, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14    Affero General Public License for more details.
15 
16    You should have received a copy of the GNU Affero General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19    02110-1301, USA.
20 */
21 #ifndef BAREOS_CATS_SQL_POOLING_H_
22 #define BAREOS_CATS_SQL_POOLING_H_
23 bool db_sql_pool_initialize(const char *db_drivername,
24                             const char *db_name,
25                             const char *db_user,
26                             const char *db_password,
27                             const char *db_address,
28                             int db_port,
29                             const char *db_socket,
30                             bool disable_batch_insert,
31                             bool try_reconnect,
32                             bool exit_on_fatal,
33                             int min_connections,
34                             int max_connections,
35                             int increment_connections,
36                             int idle_timeout,
37                             int validate_timeout);
38 void DbSqlPoolDestroy(void);
39 void DbSqlPoolFlush(void);
40 BareosDb *DbSqlGetNonPooledConnection(JobControlRecord *jcr,
41                                        const char *db_drivername,
42                                        const char *db_name,
43                                        const char *db_user,
44                                        const char *db_password,
45                                        const char *db_address,
46                                        int db_port,
47                                        const char *db_socket,
48                                        bool mult_db_connections,
49                                        bool disable_batch_insert,
50                                        bool try_reconnect,
51                                        bool exit_on_fatal,
52                                        bool need_private = false);
53 BareosDb *DbSqlGetPooledConnection(JobControlRecord *jcr,
54                                    const char *db_drivername,
55                                    const char *db_name,
56                                    const char *db_user,
57                                    const char *db_password,
58                                    const char *db_address,
59                                    int db_port,
60                                    const char *db_socket,
61                                    bool mult_db_connections,
62                                    bool disable_batch_insert,
63                                    bool try_reconnect,
64                                    bool exit_on_fatal,
65                                    bool need_private = false);
66 void DbSqlClosePooledConnection(JobControlRecord *jcr, BareosDb *mdb, bool abort = false);
67 
68 #endif // BAREOS_CATS_SQL_POOLING_H_
69