summaryrefslogtreecommitdiff
path: root/ext/pdo_dblib/dblib_stmt.c
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2011-03-05 23:07:45 (GMT)
committerFelipe Pena <felipe@php.net>2011-03-05 23:07:45 (GMT)
commit6ba343aeff1af7fac3603f56c9d9b25320cb88b1 (patch)
tree9c8926194ec0ae782c76f08631a274825be87e2f /ext/pdo_dblib/dblib_stmt.c
parent8e600b817e9252995bb3da6a13dbe39dc80b3c58 (diff)
downloadphp-6ba343aeff1af7fac3603f56c9d9b25320cb88b1.tar.gz
- Fixed bug #54167 (PDO_DBLIB returns null on SQLUNIQUE field)
# initial patch by: mjh at hodginsmedia dot com (5.3) # trunk version by me
Diffstat (limited to 'ext/pdo_dblib/dblib_stmt.c')
-rw-r--r--ext/pdo_dblib/dblib_stmt.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index 0df0a1d..c7c48f5 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -25,6 +25,7 @@
#include "php.h"
#include "php_ini.h"
+#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
#include "pdo/php_pdo.h"
#include "pdo/php_pdo_driver.h"
@@ -224,6 +225,24 @@ static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
*ptr = tmp_ptr;
break;
}
+#ifdef SQLUNIQUE
+ case SQLUNIQUE: {
+#else
+ case 36: { /* FreeTDS hack, also used by ext/mssql */
+#endif
+ *len = 36+1;
+ tmp_ptr = emalloc(*len + 1);
+
+ /* uniqueidentifier is a 16-byte binary number, convert to 32 char hex string */
+#ifdef SQLUNIQUE
+ *len = dbconvert(NULL, SQLUNIQUE, ptr, *len, SQLCHAR, tmp_ptr, *len);
+#else
+ *len = dbconvert(NULL, 36, ptr, *len, SQLCHAR, tmp_ptr, *len);
+#endif
+ php_strtoupper(tmp_ptr, *len);
+ *ptr = tmp_ptr;
+ break;
+ }
default:
if (dbwillconvert(coltype, SQLCHAR)) {
tmp_len = 32 + (2 * (*len));