Commit 685bff04 authored by Howard Chu's avatar Howard Chu Committed by Quanah Gibson-Mount
Browse files

ITS#6657/6691 use proper SQL length data type (From Timo Teras @ iki.fi)

parent 6ecdeceb
...@@ -1217,7 +1217,7 @@ backsql_add( Operation *op, SlapReply *rs ) ...@@ -1217,7 +1217,7 @@ backsql_add( Operation *op, SlapReply *rs )
if ( !BACKSQL_IS_ADD( oc->bom_expect_return ) ) { if ( !BACKSQL_IS_ADD( oc->bom_expect_return ) ) {
SWORD ncols; SWORD ncols;
SQLINTEGER value_len; SQLLEN value_len;
if ( BACKSQL_CREATE_NEEDS_SELECT( bi ) ) { if ( BACKSQL_CREATE_NEEDS_SELECT( bi ) ) {
SQLFreeStmt( sth, SQL_DROP ); SQLFreeStmt( sth, SQL_DROP );
......
...@@ -183,7 +183,7 @@ typedef struct { ...@@ -183,7 +183,7 @@ typedef struct {
UDWORD *col_prec; UDWORD *col_prec;
SQLSMALLINT *col_type; SQLSMALLINT *col_type;
char **cols; char **cols;
SQLINTEGER *value_len; SQLLEN *value_len;
} BACKSQL_ROW_NTS; } BACKSQL_ROW_NTS;
/* /*
......
...@@ -189,25 +189,25 @@ RETCODE backsql_Prepare( SQLHDBC dbh, SQLHSTMT *sth, const char* query, int time ...@@ -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 ) \ #define backsql_BindParamStr( sth, par_ind, io, str, maxlen ) \
SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \ SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
(io), SQL_C_CHAR, SQL_VARCHAR, \ (io), SQL_C_CHAR, SQL_VARCHAR, \
(SQLUINTEGER)(maxlen), 0, (SQLPOINTER)(str), \ (SQLULEN)(maxlen), 0, (SQLPOINTER)(str), \
(SQLUINTEGER)(maxlen), NULL ) (SQLLEN)(maxlen), NULL )
#define backsql_BindParamBerVal( sth, par_ind, io, bv ) \ #define backsql_BindParamBerVal( sth, par_ind, io, bv ) \
SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \ SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
(io), SQL_C_CHAR, SQL_VARCHAR, \ (io), SQL_C_CHAR, SQL_VARCHAR, \
(SQLUINTEGER)(bv)->bv_len, 0, \ (SQLULEN)(bv)->bv_len, 0, \
(SQLPOINTER)(bv)->bv_val, \ (SQLPOINTER)(bv)->bv_val, \
(SQLUINTEGER)(bv)->bv_len, NULL ) (SQLLEN)(bv)->bv_len, NULL )
#define backsql_BindParamInt( sth, par_ind, io, val ) \ #define backsql_BindParamInt( sth, par_ind, io, val ) \
SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \ SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
(io), SQL_C_ULONG, SQL_INTEGER, \ (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 ) \ #define backsql_BindParamNumID( sth, par_ind, io, val ) \
SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \ SQLBindParameter( (sth), (SQLUSMALLINT)(par_ind), \
(io), BACKSQL_C_NUMID, SQL_INTEGER, \ (io), BACKSQL_C_NUMID, SQL_INTEGER, \
0, 0, (SQLPOINTER)(val), 0, (SQLINTEGER*)NULL ) 0, 0, (SQLPOINTER)(val), 0, (SQLLEN*)NULL )
#ifdef BACKSQL_ARBITRARY_KEY #ifdef BACKSQL_ARBITRARY_KEY
#define backsql_BindParamID( sth, par_ind, io, id ) \ #define backsql_BindParamID( sth, par_ind, io, id ) \
......
...@@ -148,7 +148,7 @@ backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx ) ...@@ -148,7 +148,7 @@ backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx )
} else { } else {
SQLCHAR colname[ 64 ]; SQLCHAR colname[ 64 ];
SQLSMALLINT name_len, col_type, col_scale, col_null; SQLSMALLINT name_len, col_type, col_scale, col_null;
UDWORD col_prec; SQLLEN col_prec;
int i; int i;
#ifdef BACKSQL_TRACE #ifdef BACKSQL_TRACE
...@@ -180,8 +180,8 @@ backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx ) ...@@ -180,8 +180,8 @@ backsql_BindRowAsStrings_x( SQLHSTMT sth, BACKSQL_ROW_NTS *row, void *ctx )
goto nomem; goto nomem;
} }
row->value_len = (SQLINTEGER *)ber_memcalloc_x( row->ncols, row->value_len = (SQLLEN *)ber_memcalloc_x( row->ncols,
sizeof( SQLINTEGER ), ctx ); sizeof( SQLLEN ), ctx );
if ( row->value_len == NULL ) { if ( row->value_len == NULL ) {
goto nomem; goto nomem;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment