2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1999-2004 The OpenLDAP Foundation.
5 * Portions Copyright 1999 Dmitry Kovalev.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
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>.
17 * This work was initially developed by Dmitry Kovalev for inclusion
18 * by OpenLDAP Software.
20 #ifndef __BACKSQL_SQL_WRAP_H__
21 #define __BACKSQL_SQL_WRAP_H__
24 #include "sql-types.h"
26 RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, char* query, int timeout );
28 #define backsql_BindParamStr( sth, par_ind, str, maxlen ) \
29 SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
31 SQL_C_CHAR, SQL_VARCHAR, \
32 (SQLUINTEGER)(maxlen), 0, (SQLPOINTER)(str), \
33 (SQLUINTEGER)(maxlen), NULL )
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 )
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 );
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 );
49 #endif /* __BACKSQL_SQL_WRAP_H__ */