]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/cats/myingres.h
d867fc9a6b7622c3e24c1d1f8beb7e0a1ad1335a
[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 two of the GNU 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 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 /* # line 6 "myingres.sh" */    /* host code */
29 /* ---typedefs--- */
30 typedef struct ing_field {
31    char          name[34];
32    int           max_length;
33    unsigned int  type;
34    unsigned int  flags;       // 1 == not null
35 } INGRES_FIELD;
36 typedef struct ing_row {
37     IISQLVAR *sqlvar;           /* ptr to sqlvar[sqld] for one row */
38     struct ing_row *next;
39     int row_number;
40 } ING_ROW;
41 typedef enum ing_status {
42     ING_COMMAND_OK,
43     ING_TUPLES_OK,
44     ING_NO_RESULT,
45     ING_NO_ROWS_PROCESSED,
46     ING_EMPTY_RESULT,
47     ING_ERROR
48 } ING_STATUS;
49 typedef struct ing_varchar {
50     short len;
51     char* value;
52 } ING_VARCHAR;
53 /* It seems, Bacula needs the complete query result stored in one data structure */
54 typedef struct ing_result {
55     IISQLDA *sqlda;             /* descriptor */
56     INGRES_FIELD *fields;
57     int num_rows;
58     int num_fields;
59     ING_STATUS status;
60     ING_ROW *first_row;
61     ING_ROW *act_row;           /* just for iterating */
62     char numrowstring[10];
63 } INGresult;
64 typedef struct ing_conn {
65     char dbname[24];
66     char user[32];
67     char password[32];
68     char connection_name[32];
69     int session_id;
70     char *msg;
71 } INGconn;
72 /* ---Prototypes--- */
73 int INGcheck(void);
74 short INGgetCols(B_DB *mdb, const char *stmt);
75 char *INGgetvalue(INGresult *res, int row_number, int column_number);
76 int INGgetisnull(INGresult *res, int row_number, int column_number);
77 int INGntuples(const INGresult *res);
78 int INGnfields(const INGresult *res);
79 char *INGfname(const INGresult *res, int column_number);
80 short INGftype(const INGresult *res, int column_number);
81 int INGexec(B_DB *mdb, INGconn *db, const char *query);
82 INGresult *INGquery(B_DB *mdb, INGconn *db, const char *query);
83 void INGclear(INGresult *res);
84 INGconn *INGconnectDB(char *dbname, char *user, char *passwd);
85 void INGdisconnectDB(INGconn *dbconn);
86 char *INGerrorMessage(const INGconn *conn);
87 char *INGcmdTuples(INGresult *res);
88 /* # line 102 "myingres.sh" */  
89 #endif /* _MYINGRES_SH */