Skip to content

Commit 98ef460

Browse files
committed
Fixes bug80783 but not bug80783a by using type override
1 parent f2bc71c commit 98ef460

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ext/pdo_odbc/odbc_stmt.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ static int odbc_stmt_describe(pdo_stmt_t *stmt, int colno)
633633
S->cols[colno].is_long = 0;
634634

635635
rc = SQLBindCol(S->stmt, colno+1,
636-
(php_odbc_sqltype_is_binary(S->cols[colno].coltype) || S->cols[colno].is_unicode) ? SQL_C_BINARY : SQL_C_CHAR,
636+
S->cols[colno].is_unicode ? SQL_C_BINARY : SQL_C_CHAR,
637637
S->cols[colno].data,
638638
S->cols[colno].datalen+1, &S->cols[colno].fetched_len);
639639

@@ -671,7 +671,10 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pdo
671671
pdo_odbc_stmt *S = (pdo_odbc_stmt*)stmt->driver_data;
672672
pdo_odbc_column *C = &S->cols[colno];
673673

674-
SQLSMALLINT c_type = (php_odbc_sqltype_is_binary(C->coltype) || C->is_unicode) ? SQL_C_BINARY : SQL_C_CHAR;
674+
SQLSMALLINT c_type = C->is_unicode ? SQL_C_BINARY : SQL_C_CHAR;
675+
if (type && (*type == PDO_PARAM_BINARY || *type == PDO_PARAM_LOB)) {
676+
c_type = SQL_C_BINARY;
677+
}
675678
/* if it is a column containing "long" data, perform late binding now */
676679
if (C->is_long) {
677680
SQLLEN orig_fetched_len = SQL_NULL_DATA;

ext/pdo_odbc/tests/bug80783.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $stmt->bindColumn(1, $data, PDO::PARAM_LOB);
2121
$stmt->execute();
2222
$stmt->fetch(PDO::FETCH_BOUND);
2323

24-
var_dump($data === bin2hex($string));
24+
var_dump($data === $string);
2525
?>
2626
--CLEAN--
2727
<?php

0 commit comments

Comments
 (0)