]> git.sur5r.net Git - openldap/blob - servers/slapd/back-sql/sql-wrap.h
1a57bc5739152e0de9a2b6e642db733011af02d8
[openldap] / servers / slapd / back-sql / sql-wrap.h
1 /* $OpenLDAP$ */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3  *
4  * Copyright 1999-2004 The OpenLDAP Foundation.
5  * Portions Copyright 1999 Dmitry Kovalev.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /* ACKNOWLEDGEMENTS:
17  * This work was initially developed by Dmitry Kovalev for inclusion
18  * by OpenLDAP Software.
19  */
20 #ifndef __BACKSQL_SQL_WRAP_H__
21 #define __BACKSQL_SQL_WRAP_H__
22
23 #include "back-sql.h"
24 #include "sql-types.h"
25
26 RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, char* query, int timeout );
27
28 #define backsql_BindParamStr( sth, par_ind, str, maxlen )               \
29         SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),               \
30                         SQL_PARAM_INPUT,                                \
31                         SQL_C_CHAR, SQL_VARCHAR,                        \
32                         (SQLUINTEGER)(maxlen), 0, (SQLPOINTER)(str),    \
33                         (SQLUINTEGER)(maxlen), NULL )
34
35 #define backsql_BindParamID( sth, par_ind, id )                         \
36         SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),               \
37                         SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,      \
38                         0, 0, (SQLPOINTER)(id), 0, (SQLINTEGER*)NULL )
39
40 RETCODE backsql_BindRowAsStrings( SQLHSTMT sth, BACKSQL_ROW_NTS *row );
41 RETCODE backsql_FreeRow( BACKSQL_ROW_NTS *row );
42 void backsql_PrintErrors( SQLHENV henv, SQLHDBC hdbc, SQLHSTMT sth, int rc );
43
44 int backsql_init_db_env( backsql_info *si );
45 int backsql_free_db_env( backsql_info *si );
46 int backsql_get_db_conn( Operation *op, SQLHDBC *dbh );
47 int backsql_free_db_conn( Operation *op );
48
49 #endif /* __BACKSQL_SQL_WRAP_H__ */
50