]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/myingres.h
Update version date
[bacula/bacula] / bacula / src / cats / myingres.h
1 /*
2    Bacula® - The Network Backup Solution
3    Copyright (C) 2009-2010 Free Software Foundation Europe e.V.
4    The main author of Bacula is Kern Sibbald, with contributions from
5    many others, a complete list can be found in the file AUTHORS.
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    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    General Public License for more details.
14    You should have received a copy of the GNU Affero General Public License
15    along with this program; if not, write to the Free Software
16    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17    02110-1301, USA.
18    Bacula® is a registered trademark of Kern Sibbald.
19    The licensor of Bacula is the Free Software Foundation Europe
20    (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
21    Switzerland, email:ftf@fsfeurope.org.
22 */
23 #ifndef _MYINGRES_SH
24 #define _MYINGRES_SH
25 #include <eqpname.h>
26 #include <eqdefcc.h>
27 #include <eqsqlda.h>
28
29 /* ---typedefs--- */
30 typedef struct ing_timestamp {
31    unsigned short year;
32    unsigned char month;
33    unsigned char day;
34    unsigned int secs;
35    unsigned int nsecs;
36    unsigned char tzh;
37    unsigned char tzm;
38 } ING_TIMESTAMP;
39 typedef struct ing_field {
40    char *name;
41    int max_length;
42    unsigned int type;
43    unsigned int flags;          /* 1 == not null */
44 } INGRES_FIELD;
45 typedef struct ing_row {
46    IISQLVAR *sqlvar;            /* ptr to sqlvar[sqld] for one row */
47    struct ing_row *next;
48    int row_number;
49 } ING_ROW;
50 typedef enum ing_status {
51    ING_COMMAND_OK,
52    ING_TUPLES_OK,
53    ING_NO_RESULT,
54    ING_NO_ROWS_PROCESSED,
55    ING_EMPTY_RESULT,
56    ING_ERROR
57 } ING_STATUS;
58 typedef struct ing_varchar {
59    short len;
60    char* value;
61 } ING_VARCHAR;
62 /* It seems, Bacula needs the complete query result stored in one data structure */
63 typedef struct ing_result {
64    IISQLDA *sqlda;              /* descriptor */
65    INGRES_FIELD *fields;
66    int num_rows;
67    int num_fields;
68    ING_STATUS status;
69    ING_ROW *first_row;
70    ING_ROW *act_row;            /* just for iterating */
71 } INGresult;
72 typedef struct ing_conn {
73    char *dbname;
74    char *user;
75    char *password;
76    int session_id;
77    char *msg;
78 } INGconn;
79 /* ---Prototypes--- */
80 int INGgetCols(INGconn *dbconn, const char *query, bool transaction);
81 char *INGgetvalue(INGresult *ing_res, int row_number, int column_number);
82 bool INGgetisnull(INGresult *ing_res, int row_number, int column_number);
83 int INGntuples(const INGresult *ing_res);
84 int INGnfields(const INGresult *ing_res);
85 char *INGfname(const INGresult *ing_res, int column_number);
86 short INGftype(const INGresult *ing_res, int column_number);
87 int INGexec(INGconn *dbconn, const char *query, bool transaction);
88 INGresult *INGquery(INGconn *dbconn, const char *query, bool transaction);
89 void INGclear(INGresult *ing_res);
90 void INGcommit(const INGconn *dbconn);
91 INGconn *INGconnectDB(char *dbname, char *user, char *passwd, int session_id);
92 void INGsetDefaultLockingMode(INGconn *dbconn);
93 void INGdisconnectDB(INGconn *dbconn);
94 char *INGerrorMessage(const INGconn *dbconn);
95 char *INGcmdTuples(INGresult *ing_res);
96 /* # line 109 "myingres.sh" */  
97 #endif /* _MYINGRES_SH */