Skip to content

Commit c15f5a2

Browse files
authored
Remove use of SDWORD and SWORD in ODBC extensions (GH-14457)
* Remove usage of SDWORD, replace with SQLINTEGER Some different driver managers disagree if this should be 4 or 8 bytes in size. SQLGetDiagRec expects this to be an SQLINTEGER, so we should just use that explicitly instead of hoping that it's the same size. Fixes GH-14367 * Replace SWORD with SQLSMALLINT While this hasn't caused issues like the SQLINTEGER/SDWORD confusion has, we should use what SQLDescrimeParam calls for, which is SQLSMALLINT.
1 parent 644d362 commit c15f5a2

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

ext/pdo_odbc/odbc_stmt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ enum pdo_odbc_conv_result {
3232
PDO_ODBC_CONV_FAIL
3333
};
3434

35-
static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SWORD sqltype)
35+
static int pdo_odbc_sqltype_is_unicode(pdo_odbc_stmt *S, SQLSMALLINT sqltype)
3636
{
3737
if (!S->assume_utf8) return 0;
3838
switch (sqltype) {
@@ -287,7 +287,7 @@ static int odbc_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data *p
287287
{
288288
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
289289
RETCODE rc;
290-
SWORD sqltype = 0, ctype = 0, scale = 0, nullable = 0;
290+
SQLSMALLINT sqltype = 0, ctype = 0, scale = 0, nullable = 0;
291291
SQLULEN precision = 0;
292292
pdo_odbc_param *P;
293293
zval *parameter;
@@ -563,7 +563,7 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno)
563563
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
564564
struct pdo_column_data *col = &stmt->columns[colno];
565565
RETCODE rc;
566-
SWORD colnamelen;
566+
SQLSMALLINT colnamelen;
567567
SQLULEN colsize;
568568
SQLLEN displaysize = 0;
569569

ext/pdo_odbc/php_pdo_odbc_int.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
typedef struct {
117117
char last_state[6];
118118
char last_err_msg[SQL_MAX_MESSAGE_LENGTH];
119-
SDWORD last_error;
119+
SQLINTEGER last_error;
120120
const char *file, *what;
121121
int line;
122122
} pdo_odbc_errinfo;
@@ -133,7 +133,7 @@ typedef struct {
133133
char *data;
134134
zend_ulong datalen;
135135
SQLLEN fetched_len;
136-
SWORD coltype;
136+
SQLSMALLINT coltype;
137137
char colname[128];
138138
unsigned is_long;
139139
unsigned is_unicode:1;

0 commit comments

Comments
 (0)