+/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2009 The OpenLDAP Foundation.
+ * Copyright 1999-2011 The OpenLDAP Foundation.
* Portions Copyright 1999 Dmitry Kovalev.
* Portions Copyright 2002 Pierangelo Mararati.
* All rights reserved.
* sql-wrap.h
*/
-RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, char* query, int timeout );
+RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, const char* query, int timeout );
#define backsql_BindParamStr( sth, par_ind, io, str, maxlen ) \
SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
(io), SQL_C_CHAR, SQL_VARCHAR, \
- (SQLUINTEGER)(maxlen), 0, (SQLPOINTER)(str), \
- (SQLUINTEGER)(maxlen), NULL )
+ (SQLULEN)(maxlen), 0, (SQLPOINTER)(str), \
+ (SQLLEN)(maxlen), NULL )
#define backsql_BindParamBerVal( sth, par_ind, io, bv ) \
SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
(io), SQL_C_CHAR, SQL_VARCHAR, \
- (SQLUINTEGER)(bv)->bv_len, 0, \
+ (SQLULEN)(bv)->bv_len, 0, \
(SQLPOINTER)(bv)->bv_val, \
- (SQLUINTEGER)(bv)->bv_len, NULL )
+ (SQLLEN)(bv)->bv_len, NULL )
#define backsql_BindParamInt( sth, par_ind, io, val ) \
SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
(io), SQL_C_ULONG, SQL_INTEGER, \
- 0, 0, (SQLPOINTER)(val), 0, (SQLINTEGER*)NULL )
+ 0, 0, (SQLPOINTER)(val), 0, (SQLLEN*)NULL )
+
+#define backsql_BindParamNumID( sth, par_ind, io, val ) \
+ SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
+ (io), BACKSQL_C_NUMID, SQL_INTEGER, \
+ 0, 0, (SQLPOINTER)(val), 0, (SQLLEN*)NULL )
#ifdef BACKSQL_ARBITRARY_KEY
#define backsql_BindParamID( sth, par_ind, io, id ) \
backsql_BindParamBerVal( (sth), (par_ind), (io), (id) )
#else /* ! BACKSQL_ARBITRARY_KEY */
#define backsql_BindParamID( sth, par_ind, io, id ) \
- backsql_BindParamInt( (sth), (par_ind), (io), (id) )
+ backsql_BindParamNumID( (sth), (par_ind), (io), (id) )
#endif /* ! BACKSQL_ARBITRARY_KEY */
RETCODE backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx );