From 0a9f51f58d1e20f92ad2f6a21c70ca04304a7f93 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 13 Jun 2011 13:54:56 -0700 Subject: [PATCH] ITS#6657/6691 use proper SQL length data type --- servers/slapd/back-sql/add.c | 2 +- servers/slapd/back-sql/back-sql.h | 2 +- servers/slapd/back-sql/proto-sql.h | 12 ++++++------ servers/slapd/back-sql/sql-wrap.c | 6 +++--- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/servers/slapd/back-sql/add.c b/servers/slapd/back-sql/add.c index 4afd12af52..af617000fb 100644 --- a/servers/slapd/back-sql/add.c +++ b/servers/slapd/back-sql/add.c @@ -1219,7 +1219,7 @@ backsql_add( Operation *op, SlapReply *rs ) if ( !BACKSQL_IS_ADD( oc->bom_expect_return ) ) { SWORD ncols; - SQLINTEGER value_len; + SQLLEN value_len; if ( BACKSQL_CREATE_NEEDS_SELECT( bi ) ) { SQLFreeStmt( sth, SQL_DROP ); diff --git a/servers/slapd/back-sql/back-sql.h b/servers/slapd/back-sql/back-sql.h index 638267a7de..936bd7703a 100644 --- a/servers/slapd/back-sql/back-sql.h +++ b/servers/slapd/back-sql/back-sql.h @@ -183,7 +183,7 @@ typedef struct { UDWORD *col_prec; SQLSMALLINT *col_type; char **cols; - SQLINTEGER *value_len; + SQLLEN *value_len; } BACKSQL_ROW_NTS; /* diff --git a/servers/slapd/back-sql/proto-sql.h b/servers/slapd/back-sql/proto-sql.h index 1302c6d24e..2d8852f051 100644 --- a/servers/slapd/back-sql/proto-sql.h +++ b/servers/slapd/back-sql/proto-sql.h @@ -189,25 +189,25 @@ RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, const char* query, int time #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, (SQLINTEGER*)NULL ) + 0, 0, (SQLPOINTER)(val), 0, (SQLLEN*)NULL ) #ifdef BACKSQL_ARBITRARY_KEY #define backsql_BindParamID( sth, par_ind, io, id ) \ diff --git a/servers/slapd/back-sql/sql-wrap.c b/servers/slapd/back-sql/sql-wrap.c index 078af55094..cd73ad5b18 100644 --- a/servers/slapd/back-sql/sql-wrap.c +++ b/servers/slapd/back-sql/sql-wrap.c @@ -148,7 +148,7 @@ backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx ) } else { SQLCHAR colname[ 64 ]; SQLSMALLINT name_len, col_type, col_scale, col_null; - UDWORD col_prec; + SQLLEN col_prec; int i; #ifdef BACKSQL_TRACE @@ -180,8 +180,8 @@ backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx ) 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; } -- 2.39.5