/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2007 The OpenLDAP Foundation.
+ * Copyright 1999-2011 The OpenLDAP Foundation.
* Portions Copyright 1999 Dmitry Kovalev.
* Portions Copyright 2002 Pierangelo Masarati.
* Portions Copyright 2004 Mark Adamson.
}
RETCODE
-backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, char *query, int timeout )
+backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, const char *query, int timeout )
{
RETCODE rc;
} else {
SQLCHAR colname[ 64 ];
SQLSMALLINT name_len, col_type, col_scale, col_null;
- UDWORD col_prec;
+ SQLLEN col_prec;
int i;
#ifdef BACKSQL_TRACE
goto nomem;
}
- row->value_len = (SQLINTEGER *)ber_memcalloc_x( row->ncols,
- sizeof( SQLINTEGER ), ctx );
+ row->value_len = (SQLLEN *)ber_memcalloc_x( row->ncols,
+ sizeof( SQLLEN ), ctx );
if ( row->value_len == NULL ) {
goto nomem;
}
* TimesTen : Turn off autocommit. We must explicitly
* commit any transactions.
*/
- SQLSetConnectOption( *dbhp, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF );
+ SQLSetConnectOption( *dbhp, SQL_AUTOCOMMIT,
+ BACKSQL_AUTOCOMMIT_ON( bi ) ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF );
/*
* See if this connection is to TimesTen. If it is,
return LDAP_SUCCESS;
}
+static void *backsql_db_conn_dummy;
+
+static void
+backsql_db_conn_keyfree(
+ void *key,
+ void *data )
+{
+ (void)backsql_close_db_handle( (SQLHDBC)data );
+}
+
int
backsql_free_db_conn( Operation *op, SQLHDBC dbh )
{
Debug( LDAP_DEBUG_TRACE, "==>backsql_free_db_conn()\n", 0, 0, 0 );
(void)backsql_close_db_handle( dbh );
+ ldap_pvt_thread_pool_setkey( op->o_threadctx,
+ &backsql_db_conn_dummy, (void *)SQL_NULL_HDBC,
+ backsql_db_conn_keyfree, NULL, NULL );
Debug( LDAP_DEBUG_TRACE, "<==backsql_free_db_conn()\n", 0, 0, 0 );
return LDAP_SUCCESS;
}
-static void *backsql_db_conn_dummy;
-
-static void
-backsql_db_conn_keyfree(
- void *key,
- void *data )
-{
- backsql_close_db_handle( (SQLHDBC)data );
-}
-
int
backsql_get_db_conn( Operation *op, SQLHDBC *dbhp )
{
}
if ( op->o_threadctx ) {
- void *data = NULL;
+ void *data = (void *)dbh;
- data = (void *)dbh;
ldap_pvt_thread_pool_setkey( op->o_threadctx,
&backsql_db_conn_dummy, data,
backsql_db_conn_keyfree, NULL, NULL );