The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Loading...
Searching...
No Matches
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 */
22RCSIDH(sql_fbapi_h, "$Id: 275b858f8091266b7f9c9c4649a182af2e511ae3 $")
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#define DUPLICATE_KEY_SQL_CODE -803
36
37#if defined(_LP64) || defined(__LP64__) || defined(__arch64__)
38#define ISC_LONG_FMT "d"
39#define ISC_ULONG_FMT "u"
40#else
41#define ISC_LONG_FMT "l"
42#define ISC_ULONG_FMT "ul"
43#endif
44
45typedef struct {
46 isc_db_handle dbh;
47 isc_stmt_handle stmt;
48 isc_tr_handle trh;
49
50 ISC_STATUS status[20]; //!< Magic interbase status code array (holds multiple error codes used
51 //!< to construct more detailed error messages.
52
53 ISC_LONG sql_code;
54 XSQLDA *sqlda_out;
57 char *tpb;
59 char *dpb;
61 char *error;
62
65
66
71int fb_sql_query(rlm_sql_firebird_conn_t *conn, char const *query);
74void fb_free_sqlda(XSQLDA *sqlda);
#define RCSIDH(h, id)
Definition build.h:484
static const conf_parser_t config[]
Definition base.c:183
Prototypes and functions for the SQL module.
sql_rcode_t
Action to take at end of an SQL query.
Definition rlm_sql.h:44
char ** rlm_sql_row_t
Definition rlm_sql.h:59
int fb_sql_query(rlm_sql_firebird_conn_t *conn, char const *query)
Definition sql_fbapi.c:396
isc_tr_handle trh
Definition sql_fbapi.h:48
int fb_connect(rlm_sql_firebird_conn_t *conn, rlm_sql_config_t const *config)
Definition sql_fbapi.c:271
isc_stmt_handle stmt
Definition sql_fbapi.h:47
int fb_rollback(rlm_sql_firebird_conn_t *conn)
Definition sql_fbapi.c:447
int fb_error(rlm_sql_firebird_conn_t *conn)
Definition sql_fbapi.c:63
isc_db_handle dbh
Definition sql_fbapi.h:46
int fb_fetch(rlm_sql_firebird_conn_t *conn)
Definition sql_fbapi.c:331
void fb_free_sqlda(XSQLDA *sqlda)
Definition sql_fbapi.c:111
rlm_sql_row_t row
Definition sql_fbapi.h:63
sql_rcode_t fb_store_row(rlm_sql_firebird_conn_t *conn)
Definition sql_fbapi.c:133
int fb_disconnect(rlm_sql_firebird_conn_t *conn)
int fb_commit(rlm_sql_firebird_conn_t *conn)
Definition sql_fbapi.c:456
int fb_affected_rows(rlm_sql_firebird_conn_t *conn)
Definition sql_fbapi.c:413
int fb_free_result(rlm_sql_firebird_conn_t *conn)
void fb_free_statement(rlm_sql_firebird_conn_t *conn)
Definition sql_fbapi.c:440