Mantis - Quercus
Viewing Issue Advanced Details
2541 minor always 03-20-08 08:41 05-29-08 17:21
ferg  
ferg  
normal  
closed 3.1.5  
fixed  
none    
none 3.2.0  
0002541: mysql fetch_field with DESCRIBE
(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++;
        }
    
    }


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