All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sql_fbapi.h
Go to the documentation of this file.
1 /*
2  * sql_fbapi.h Part of Firebird rlm_sql driver
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Copyright 2006 The FreeRADIUS server project
19  * Copyright 2006 Vitaly Bodzhgua <vitaly@eastera.net>
20  */
21 
22 
23 #ifndef _SQL_FBAPI_H_
24 #define _SQL_FBAPI_H_
25 
26 RCSIDH(sql_fbapi_h, "$Id: f3e272cf555f9c2be7db983188034acc92ace67e $")
27 
28 #include <stdlib.h>
29 #include <string.h>
30 #include <ibase.h>
31 
32 #include <freeradius-devel/radiusd.h>
33 #include "rlm_sql.h"
34 
35 #define IS_ISC_ERROR(status) ((status[0] == 1) && (status[1] > 0))
36 
37 #define DEADLOCK_SQL_CODE -913
38 #define DOWN_SQL_CODE -902
39 
40 #if defined(_LP64) || defined(__LP64__) || defined(__arch64__)
41 #define ISC_LONG_FMT "d"
42 #define ISC_ULONG_FMT "u"
43 #else
44 #define ISC_LONG_FMT "l"
45 #define ISC_ULONG_FMT "ul"
46 #endif
47 
48 typedef struct rlm_sql_firebird_conn {
49  isc_db_handle dbh;
50  isc_stmt_handle stmt;
51  isc_tr_handle trh;
52 
53  ISC_STATUS status[20]; //!< Magic interbase status code array (holds multiple error codes used
54  //!< to construct more detailed error messages.
55 
56  ISC_LONG sql_code;
57  XSQLDA *sqlda_out;
60  char *tpb;
61  int tpb_len;
62  char *dpb;
63  int dpb_len;
64  char *error;
65 
67  int *row_sizes;
69 
70 #ifdef _PTHREAD_H
71  pthread_mutex_t mut;
72 #endif
74 
75 
81 int fb_sql_query(rlm_sql_firebird_conn_t *conn, char const *query);
84 void fb_free_sqlda(XSQLDA *sqlda);
90 
91 #endif
#define RCSIDH(h, id)
Definition: build.h:136
int fb_connect(rlm_sql_firebird_conn_t *conn, rlm_sql_config_t *config)
Definition: sql_fbapi.c:350
Prototypes and functions for the SQL module.
char ** rlm_sql_row_t
Definition: rlm_sql.h:59
int fb_free_result(rlm_sql_firebird_conn_t *conn)
int fb_affected_rows(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:503
int fb_error(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:83
struct rlm_sql_firebird_conn rlm_sql_firebird_conn_t
rlm_sql_row_t row
Definition: sql_fbapi.h:66
int fb_init_socket(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:326
int fb_rollback(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:547
isc_tr_handle trh
Definition: sql_fbapi.h:51
int fb_commit(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:563
void fb_store_row(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:151
int fb_sql_query(rlm_sql_firebird_conn_t *conn, char const *query)
Definition: sql_fbapi.c:484
isc_stmt_handle stmt
Definition: sql_fbapi.h:50
void fb_free_statement(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:540
void fb_free_sqlda(XSQLDA *sqlda)
Definition: sql_fbapi.c:129
int fb_close_cursor(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:534
int fb_disconnect(rlm_sql_firebird_conn_t *conn)
int fb_fetch(rlm_sql_firebird_conn_t *conn)
Definition: sql_fbapi.c:404
isc_db_handle dbh
Definition: sql_fbapi.h:49
ISC_STATUS status[20]
Magic interbase status code array (holds multiple error codes used to construct more detailed error m...
Definition: sql_fbapi.h:53