|
Mantis - Quercus
|
|||||
| Viewing Issue Advanced Details | |||||
|
|
|||||
| ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
| 2080 | minor | always | 10-17-07 18:12 | 10-18-07 09:50 | |
|
|
|||||
| Reporter: | koreth | Platform: | |||
| Assigned To: | ferg | OS: | |||
| Priority: | normal | OS Version: | |||
| Status: | closed | Product Version: | 3.1.3 | ||
| Product Build: | Resolution: | fixed | |||
| Projection: | none | ||||
| ETA: | none | Fixed in Version: | 3.1.4 | ||
|
|
|||||
| 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++) { |
||||
| Relationships | |||||
| Attached Files: | |||||
| Notes | |||||
|
|
|||||
|
|
||||