Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002080 [Quercus] minor always 10-17-07 18:12 10-18-07 09:50
Reporter koreth View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.1.4 Product Version 3.1.3
  Product Build
Summary 0002080: mysql_fetch_assoc() doesn't obey column aliases
Description $res = mysql_query($conn, "SELECT foo AS bar FROM xyzzy");
$row = mysql_fetch_assoc($res);

In vanilla PHP, $row['bar'] will contain the value. In Quercus, $row['foo'] contains the value.
Steps To Reproduce
Additional Information Patch:

--- a/modules/quercus/src/com/caucho/quercus/lib/db/JdbcResultResource.java
+++ b/modules/quercus/src/com/caucho/quercus/lib/db/JdbcResultResource.java
@@ -159,8 +159,12 @@ public class JdbcResultResource {
         if ((type & FETCH_ASSOC) != 0) {
           _columnNames = new Value[count];
 
- for (int i = 0; i < count; i++)
- _columnNames[i] = env.createString(_metaData.getColumnName(i + 1));
+ for (int i = 0; i < count; i++) {
+ String name = _metaData.getColumnLabel(i + 1);
+ if (name == null)
+ name = _metaData.getColumnName(i + 1);
+ _columnNames[i] = env.createString(name);
+ }
         }
 
         for (int i = 0; i < count; i++) {
Attached Files

- Relationships

- Notes
(0002362)
ferg
10-18-07 09:50

php/141j
 

- Issue History
Date Modified Username Field Change
10-17-07 18:12 koreth New Issue
10-18-07 09:50 ferg Note Added: 0002362
10-18-07 09:50 ferg Assigned To  => ferg
10-18-07 09:50 ferg Status new => closed
10-18-07 09:50 ferg Resolution open => fixed
10-18-07 09:50 ferg Fixed in Version  => 3.1.4


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker