The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
sql_fbapi.h
Go to the documentation of this file.
1 #pragma once
2 /*
3  * sql_fbapi.h Part of Firebird rlm_sql driver
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * @copyright 2006 The FreeRADIUS server project
20  * @copyright 2006 Vitaly Bodzhgua (vitaly@eastera.net)
21  */
22 RCSIDH(sql_fbapi_h, "$Id: 1f229ad69b38ba5dac3c42976f2f09f2595cc198 $")
23 
24 #include <stdlib.h>
25 #include <string.h>
26 #include <ibase.h>
27 
28 #include <freeradius-devel/server/base.h>
29 #include "rlm_sql.h"
30 
31 #define IS_ISC_ERROR(status) ((status[0] == 1) && (status[1] > 0))
32 
33 #define DEADLOCK_SQL_CODE -913
34 #define DOWN_SQL_CODE -902
35 
36 #if defined(_LP64) || defined(__LP64__) || defined(__arch64__)
37 #define ISC_LONG_FMT "d"
38 #define ISC_ULONG_FMT "u"
39 #else
40 #define ISC_LONG_FMT "l"
41 #define ISC_ULONG_FMT "ul"
42 #endif
43 
44 typedef struct {
45  isc_db_handle dbh;
46  isc_stmt_handle stmt;
47  isc_tr_handle trh;
48 
49  ISC_STATUS status[20]; //!< Magic interbase status code array (holds multiple error codes used
50  //!< to construct more detailed error messages.
51 
52  ISC_LONG sql_code;
53  XSQLDA *sqlda_out;
56  char *tpb;
57  int tpb_len;
58  char *dpb;
59  int dpb_len;
60  char *error;
61 
63  int *row_sizes;
65 
68 
69 
75 int fb_sql_query(rlm_sql_firebird_conn_t *conn, char const *query);
78 void fb_free_sqlda(XSQLDA *sqlda);
#define RCSIDH(h, id)
Definition: build.h:445
static const conf_parser_t config[]
Definition: base.c:188
Prototypes and functions for the SQL module.
char ** rlm_sql_row_t
Definition: rlm_sql.h:57
int fb_init_socket(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:322
int fb_sql_query(rlm_sql_firebird_conn_t *conn, char const *query)
Definition: sql_fbapi.c:479
void fb_store_row(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:149
isc_tr_handle trh
Definition: sql_fbapi.h:47
int fb_connect(rlm_sql_firebird_conn_t *conn, rlm_sql_config_t const *config)
Definition: sql_fbapi.c:345
isc_stmt_handle stmt
Definition: sql_fbapi.h:46
int fb_rollback(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:544
int fb_error(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:81
isc_db_handle dbh
Definition: sql_fbapi.h:45
int fb_fetch(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:399
int fb_close_cursor(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:531
void fb_free_sqlda(XSQLDA *sqlda)
Definition: sql_fbapi.c:127
rlm_sql_row_t row
Definition: sql_fbapi.h:62
int fb_disconnect(rlm_sql_firebird_conn_t *conn)
int fb_commit(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:558
int fb_affected_rows(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:498
pthread_mutex_t mut
Definition: sql_fbapi.h:66
int fb_free_result(rlm_sql_firebird_conn_t *conn)
void fb_free_statement(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:537