Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002541 [Quercus] minor always 03-20-08 08:41 05-29-08 17:21
Reporter ferg View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 3.1.5
Summary 0002541: mysql fetch_field with DESCRIBE
Description (rep by jarmstrong)


I found the issue finally the metadata is not being returned for DESCRIBE
queries. So the part I haven't determined yet. Is metadata handled or
ignored for differnt SQL Statement types in Quercus? The ORM mapping within
CakePHP relies heavily on the metadata being returned from describe
statements.


** After some weird testing I just found the problem with the metadata not
being returned.
1) *Works* 'SELECT * FROM users'
2) *Fails* 'DESCRIBE users'

PHP Code.


    function resultSet(&$results) {
        $this->results =& $results;
        $this->map = array();
        
        
        $num_fields = mysqli_num_fields($results);
            
        $index = 0;
        $j = 0;
        while ($j < $num_fields) {
            $column = mysqli_fetch_field_direct($results, $j);
            
            if (!empty($column->table)) {
                $this->map[$index++] = array($column->table, $column->name);
            } else {
                $this->map[$index++] = array(0, $column->name);
            }
            $j++;
        }
    
    }

Additional Information
Attached Files

- Relationships

- Notes
(0002877)
ferg
03-24-08 08:40

I found the problem, but I am not sure what the best solution for this would
be. The issue is that huge IF statement at the beginning of
Mysqli::fetchFieldDirect() is getting back a null value for the table name
with a "DESCRIBE users" statement, but standard SQL statements work fine.

Output from tests: (0000001 metadat.toString(), 0000002 my log.log entries showing
empty table name and valid field name)
--------------------------------------------------------
[23:06:53.921] {http--8080-0}
com.mysql.jdbc.Field@94aa42[catalog=,tableName=C
OLUMNS,originalTableName=,columnName=Extra,originalColumnName=EXTRA,mysqlType=25
3(FIELD_TYPE_VAR_STRING),flags=, charsetIndex=33, charsetName=UTF-8]
[23:06:53.921] {http--8080-0} getFieldTable::EMPTY TABLE::
[23:06:53.921] {http--8080-0} getFieldTable::EMPTY TABLE:-1:
[23:06:53.921] {http--8080-0} fetchFieldDirect()::long_if::
[23:06:53.921] {http--8080-0} fetchFieldDirect()::long_if::EXTRA
 
(0002929)
mo
03-28-08 15:33

php/144e.qa
 
(0003009)
nam
04-24-08 16:14

Does not affect:
MySQL JDBC 3.1

Affects:
MySQL JDBC 5.x

Issue:
MySQL JDBC 5.x changed what was returned from a DESCRIBE statement.

Workaround:
use 3.1 until we figure out what to do with 5.x drivers (special case?)
 
(0003014)
omnijared
04-25-08 06:11

I tried this with MySql JDBC 3.1.14, and resin head from 04/22/08 and I still see the same error. If Quercus is getting the DESCRIBE values returned from JDBC 3.1.x correctly it is not returning it to fetchFieldDirect properly.
 
(0003118)
ferg
05-29-08 17:21

php/1f56
 

- Issue History
Date Modified Username Field Change
03-20-08 08:41 ferg New Issue
03-20-08 14:27 omnijared Issue Monitored: omnijared
03-24-08 08:40 ferg Note Added: 0002877
03-28-08 15:33 mo Note Added: 0002929
04-24-08 16:14 nam Note Added: 0003009
04-25-08 06:11 omnijared Note Added: 0003014
05-29-08 17:21 ferg Note Added: 0003118
05-29-08 17:21 ferg Assigned To  => ferg
05-29-08 17:21 ferg Status new => closed
05-29-08 17:21 ferg Resolution open => fixed
05-29-08 17:21 ferg Fixed in Version  => 3.2.0


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