Patch dblib_stmt.diff for PDO related Bug #54167
Patch version 2011-03-05 07:17 UTC
Return to Bug #54167 |
Download this patch
Patch Revisions:
Developer: mjh@hodginsmedia.com
Index: ext/pdo_dblib/dblib_stmt.c
===================================================================
--- ext/pdo_dblib/dblib_stmt.c (revision 308934)
+++ ext/pdo_dblib/dblib_stmt.c (working copy)
@@ -174,6 +174,23 @@
val->len = spprintf(&val->data, 0, "%.4f", money_value);
}
break;
+#ifdef SQLUNIQUE
+ case SQLUNIQUE: {
+#else
+ case 36: { /* FreeTDB hack, also used by ext/mssql */
+#endif
+ val->len = 36+1;
+ val->data = emalloc(val->len + 1);
+
+ /* uniqueidentifier is a 16-byte binary number, convert to 32 char hex string */
+#ifdef SQLUNIQUE
+ val->len = dbconvert(NULL, SQLUNIQUE, dbdata(H->link, i+1), dbdatlen(H->link, i+1), SQLCHAR, val->data, val->len);
+#else
+ val->len = dbconvert(NULL, 36, dbdata(H->link, i+1), dbdatlen(H->link, i+1), SQLCHAR, val->data, val->len);
+#endif
+ php_strtoupper(val->data, val->len);
+ break;
+ }
default:
if (dbwillconvert(S->cols[i].coltype, SQLCHAR)) {
val->len = 32 + (2 * dbdatlen(H->link, i+1));
|