Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002520 [Quercus] minor always 03-12-08 21:20 05-01-08 17:42
Reporter omnijared View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version
Summary 0002520: mysql_fetch_field / mysqli_fetch_fields; using DB name instead of Table name
Description It appears from my very basic tracing/handling that the fetch_field capabilities for both mysql/mysqli are using the DB name instead of the appropriate table name for meta data retrieval. I also tried using the other field related functions with the same results.


Initial Query:
SELECT `User`.`id`, `User`.`username`, `User`.`password` FROM `users` AS `User` WHERE 1 = 1 LIMIT 20
----------------------------

Resin: Resin-3.1.s080304 (built Tue, 04 Mar 2008 11:24:00 PST)
PHP Framework: CakePHP
Mysql Connector: mysql-connector-java-5.0.8-bin
Additional Information [200801%D 01:01:48.196] com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'TestCake.COLUMNS' doesn't exist
[200801%D 01:01:48.196] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
[200801%D 01:01:48.196] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
[200801%D 01:01:48.196] at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
[200801%D 01:01:48.196] at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
[200801%D 01:01:48.196] at com.mysql.jdbc.Connection.execSQL(Connection.java:3277)
[200801%D 01:01:48.196] at com.mysql.jdbc.Connection.execSQL(Connection.java:3206)
[200801%D 01:01:48.196] at com.mysql.jdbc.Statement.execute(Statement.java:727)
[200801%D 01:01:48.196] at com.mysql.jdbc.jdbc2.optional.StatementWrapper.execute(StatementWrapper.java:658)
[200801%D 01:01:48.196] at com.caucho.sql.UserStatement.execute(UserStatement.java:266)
[200801%D 01:01:48.196] at com.caucho.quercus.lib.db.Mysqli.metaQuery(Mysqli.java:1066)
[200801%D 01:01:48.196] at com.caucho.quercus.lib.db.MysqliResult.fetchFieldDirect(MysqliResult.java:278)
[200801%D 01:01:48.196] at com.caucho.quercus.lib.db.MysqliResult.getFieldDirectArray(MysqliResult.java:368)
[200801%D 01:01:48.196] at com.caucho.quercus.lib.db.MysqliResult.fetch_fields(MysqliResult.java:183)
[200801%D 01:01:48.196] at com.caucho.quercus.lib.db.MysqliModule.mysqli_fetch_fields(MysqliModule.java:341)
[200801%D 01:01:48.196] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[200801%D 01:01:48.196] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[200801%D 01:01:48.196] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[200801%D 01:01:48.196] at java.lang.reflect.Method.invoke(Method.java:597)
[200801%D 01:01:48.196] at com.caucho.quercus.module.StaticFunction.invoke(StaticFunction.java:129)
[200801%D 01:01:48.196] at com.caucho.quercus.env.JavaInvoker.callMethod(JavaInvoker.java:604)
[200801%D 01:01:48.196] at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:539)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:182)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:126)
[200801%D 01:01:48.196] at com.caucho.quercus.env.JavaInvoker.evalArguments(JavaInvoker.java:415)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:170)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:126)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.Expr.evalCopy(Expr.java:398)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:86)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.Expr.evalBoolean(Expr.java:468)
[200801%D 01:01:48.196] at com.caucho.quercus.program.WhileStatement.execute(WhileStatement.java:59)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ReturnStatement.execute(ReturnStatement.java:68)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.Expr.evalCopy(Expr.java:398)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:86)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.Expr.evalCopy(Expr.java:398)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:86)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.QuercusClass.callNew(QuercusClass.java:656)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.VarNewExpr.eval(VarNewExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.Expr.evalRef(Expr.java:386)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.AssignRefExpr.eval(AssignRefExpr.java:74)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ForeachStatement.execute(ForeachStatement.java:175)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:557)
[200801%D 01:01:48.196] at com.caucho.quercus.env.QuercusClass.callMethod(QuercusClass.java:828)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.StaticMethodExpr.eval(StaticMethodExpr.java:148)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.Expr.evalCopy(Expr.java:398)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.AssignExpr.eval(AssignExpr.java:86)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:78)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:75)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.callImpl(Function.java:354)
[200801%D 01:01:48.196] at com.caucho.quercus.program.Function.call(Function.java:294)
[200801%D 01:01:48.196] at com.caucho.quercus.program.AbstractFunction.callMethod(AbstractFunction.java:309)
[200801%D 01:01:48.196] at com.caucho.quercus.env.ObjectExtValue.callMethod(ObjectExtValue.java:602)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.MethodCallExpr.eval(MethodCallExpr.java:104)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.IfStatement.execute(IfStatement.java:78)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:239)
[200801%D 01:01:48.196] at com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:70)
[200801%D 01:01:48.196] at com.caucho.quercus.env.Env.include(Env.java:3633)
[200801%D 01:01:48.196] at com.caucho.quercus.expr.IncludeExpr.eval(IncludeExpr.java:86)
[200801%D 01:01:48.196] at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
[200801%D 01:01:48.196] at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:107)
[200801%D 01:01:48.196] at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:239)
[200801%D 01:01:48.196] at com.caucho.quercus.page.InterpretedPage.execute(InterpretedPage.java:70)
[200801%D 01:01:48.196] at com.caucho.quercus.page.QuercusPage.executeTop(QuercusPage.java:119)
[200801%D 01:01:48.196] at com.caucho.quercus.servlet.ResinQuercusServlet.service(ResinQuercusServlet.java:146)
[200801%D 01:01:48.196] at com.caucho.quercus.servlet.QuercusServlet.service(QuercusServlet.java:353)
[200801%D 01:01:48.196] at javax.servlet.http.HttpServlet.service(HttpServlet.java:91)
[200801%D 01:01:48.196] at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:103)
[200801%D 01:01:48.196] at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:187)
[200801%D 01:01:48.196] at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
[200801%D 01:01:48.196] at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:269)
[200801%D 01:01:48.196] at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
[200801%D 01:01:48.196] at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
[200801%D 01:01:48.196] at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
[200801%D 01:01:48.196] at java.lang.Thread.run(Thread.java:619)
Attached Files

- Relationships

- Notes
(0002858)
omnijared
03-20-08 05:36

The real issue appears to be that the (*)_fetch_fields and fetch_field_direct are actually working for normal SELECT statements but are not working with resultsets for DESCRIBE statements.

** This was verified with the trunk head revision on 03/20/08
 
(0002986)
ferg
04-16-08 16:00

php/141p for mysql

mysqli (php/1f2u) still does not work (unable to get the underlying table)
 
(0002996)
nam
04-17-08 19:44
edited on: 04-24-08 14:10

Affected:
MySQL Connector/J 5.1

Not Affected:
MySQL Connector/J 3.1

From mysql JDBC 3.1 to 5.0/5.1, the mysql guys changed what ResultSetMetaData
returns for getTableName(). As a result, table name aliasing does
not work for mysql JDBC 5.1.6, but works in 3.1.x. The workaround
is to set "useOldAliasMetadataBehavior=true" in the JDBC url,
but that option itself is broken in 5.1.6!

http://bugs.mysql.com/bug.php?id=35753 [^]
http://bugs.mysql.com/bug.php?id=36327 [^]

 
(0003021)
omnijared
04-01-08 08:31

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
 
(0003119)
ferg
05-01-08 17:42

php/1453

Note, this fix is for the DESCRIBE, not the table alias. The mysql jdbc driver does not support table aliases for fetch in the current driver.
 

- Issue History
Date Modified Username Field Change
03-12-08 21:20 omnijared New Issue
03-13-08 05:27 omnijared Issue Monitored: omnijared
03-20-08 05:36 omnijared Note Added: 0002858
04-10-08 12:06 nam Status new => acknowledged
04-16-08 16:00 ferg Note Added: 0002986
04-17-08 19:44 nam Note Added: 0002996
04-24-08 14:10 nam Note Edited: 0002996
04-01-08 08:31 omnijared Note Added: 0003021
05-01-08 17:42 ferg Note Added: 0003119
05-01-08 17:42 ferg Assigned To  => ferg
05-01-08 17:42 ferg Status acknowledged => closed
05-01-08 17:42 ferg Resolution open => fixed
05-01-08 17:42 ferg Fixed in Version  => 3.2.0


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