]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/bdb_priv.h
Remove Ingres and DBI backends
[bacula/bacula] / bacula / src / cats / bdb_priv.h
1 /*
2    Bacula® - The Network Backup Solution
3
4    Copyright (C) 2011-2011 Free Software Foundation Europe e.V.
5
6    The main author of Bacula is Kern Sibbald, with contributions from
7    many others, a complete list can be found in the file AUTHORS.
8    This program is Free Software; you can redistribute it and/or
9    modify it under the terms of version three of the GNU Affero General Public
10    License as published by the Free Software Foundation and included
11    in the file LICENSE.
12
13    This program is distributed in the hope that it will be useful, but
14    WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16    General Public License for more details.
17
18    You should have received a copy of the GNU Affero General Public License
19    along with this program; if not, write to the Free Software
20    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
21    02110-1301, USA.
22
23    Bacula® is a registered trademark of Kern Sibbald.
24
25    The licensor of Bacula is the Free Software Foundation Europe
26    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
27    Switzerland, email:ftf@fsfeurope.org.
28 */
29 #ifndef __BDB_PRIV_H_
30 #define __BDB_PRIV_H_ 1
31
32 #ifndef _BDB_PRIV_INTERFACE_
33 #error "Illegal inclusion of catalog private interface"
34 #endif
35
36 /*
37  * Generic definition of a sql_row.
38  */
39 typedef char ** SQL_ROW;
40
41 /*
42  * Generic definition of a a sql_field.
43  */
44 typedef struct sql_field {
45    char *name;                        /* name of column */
46    int max_length;                    /* max length */
47    uint32_t type;                     /* type */
48    uint32_t flags;                    /* flags */
49 } SQL_FIELD;
50
51 class B_DB_PRIV: public B_DB {
52 protected:
53    int m_status;                      /* status */
54    int m_num_rows;                    /* number of rows returned by last query */
55    int m_num_fields;                  /* number of fields returned by last query */
56    int m_rows_size;                   /* size of malloced rows */
57    int m_fields_size;                 /* size of malloced fields */
58    int m_row_number;                  /* row number from xx_data_seek */
59    int m_field_number;                /* field number from sql_field_seek */
60    SQL_ROW m_rows;                    /* defined rows */
61    SQL_FIELD *m_fields;               /* defined fields */
62    bool m_allow_transactions;         /* transactions allowed */
63    bool m_transaction;                /* transaction started */
64
65 public:
66    /* methods */
67    B_DB_PRIV() {};
68    virtual ~B_DB_PRIV() {};
69
70    int sql_num_rows(void) { return m_num_rows; };
71    void sql_field_seek(int field) { m_field_number = field; };
72    int sql_num_fields(void) { return m_num_fields; };
73    virtual void sql_free_result(void) = 0;
74    virtual SQL_ROW sql_fetch_row(void) = 0;
75    virtual bool sql_query(const char *query, int flags=0) = 0;
76    virtual const char *sql_strerror(void) = 0;
77    virtual void sql_data_seek(int row) = 0;
78    virtual int sql_affected_rows(void) = 0;
79    virtual uint64_t sql_insert_autokey_record(const char *query, const char *table_name) = 0;
80    virtual SQL_FIELD *sql_fetch_field(void) = 0;
81    virtual bool sql_field_is_not_null(int field_type) = 0;
82    virtual bool sql_field_is_numeric(int field_type) = 0;
83    virtual bool sql_batch_start(JCR *jcr) = 0;
84    virtual bool sql_batch_end(JCR *jcr, const char *error) = 0;
85    virtual bool sql_batch_insert(JCR *jcr, ATTR_DBR *ar) = 0;
86 };
87
88 #endif /* __BDB_PRIV_H_ */