]> git.sur5r.net Git - openldap/blob - servers/slapd/back-sql/sql-wrap.h
Converted ch_malloc, ch_calloc and ch_realloc calls to SLAP_MALLOC,
[openldap] / servers / slapd / back-sql / sql-wrap.h
1 #ifndef __BACKSQL_SQL_WRAP_H__
2 #define __BACKSQL_SQL_WRAP_H__
3
4 /*
5  *       Copyright 1999, Dmitry Kovalev <mit@openldap.org>, All rights reserved.
6  *
7  *       Redistribution and use in source and binary forms are permitted only
8  *       as authorized by the OpenLDAP Public License.  A copy of this
9  *       license is available at http://www.OpenLDAP.org/license.html or
10  *       in file LICENSE in the top-level directory of the distribution.
11  */
12
13 #include "back-sql.h"
14 #include "sql-types.h"
15
16 RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, char* query, int timeout );
17
18 #define backsql_BindParamStr( sth, par_ind, str, maxlen )               \
19         SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),               \
20                         SQL_PARAM_INPUT,                                \
21                         SQL_C_CHAR, SQL_VARCHAR,                        \
22                         (SQLUINTEGER)(maxlen), 0, (SQLPOINTER)(str),    \
23                         (SQLUINTEGER)(maxlen), NULL )
24
25 #define backsql_BindParamID( sth, par_ind, id )                         \
26         SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind),               \
27                         SQL_PARAM_INPUT, SQL_C_ULONG, SQL_INTEGER,      \
28                         0, 0, (SQLPOINTER)(id), 0, (SQLINTEGER*)NULL )
29
30 RETCODE backsql_BindRowAsStrings( SQLHSTMT sth, BACKSQL_ROW_NTS *row );
31 RETCODE backsql_FreeRow( BACKSQL_ROW_NTS *row );
32 void backsql_PrintErrors( SQLHENV henv, SQLHDBC hdbc, SQLHSTMT sth, int rc );
33
34 int backsql_init_db_env( backsql_info *si );
35 int backsql_free_db_env( backsql_info *si );
36 int backsql_get_db_conn( Backend *be, Connection *ldapc, SQLHDBC *dbh );
37 int backsql_free_db_conn( Backend *be, Connection *ldapc );
38
39 #endif /* __BACKSQL_SQL_WRAP_H__ */
40