php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch dblib_stmt_column_name_computed for PDO DBlib Bug #69757

Patch version 2015-06-25 23:00 UTC

Return to Bug #69757 | Download this patch
Patch Revisions:

Developer: miracle@rpz.name

--- orig/ext/pdo_dblib/dblib_stmt.c        2015-05-14 02:13:33.000000000 +0300
+++ fixes/ext/pdo_dblib/dblib_stmt.c       2015-06-26 01:45:16.392471563 +0300
@@ -204,7 +204,15 @@
 
        struct pdo_column_data *col = &stmt->columns[colno];
 
-       col->name = (char*)dbcolname(H->link, colno+1);
+        char *fname = (char*)dbcolname(H->link, colno+1);
+        char computed_buf[16];
+        if (*fname) {
+            col->name = estrdup(fname);
+        } else {
+            snprintf(computed_buf,16,"computed%d", colno);
+            col->name = estrdup(computed_buf);
+        }
+        
        col->maxlen = dbcollen(H->link, colno+1);
        col->namelen = strlen(col->name);
        col->param_type = PDO_PARAM_STR;
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Jul 28 07:01:23 2021 UTC