Mantis - Quercus
Viewing Issue Advanced Details
3133 minor always 12-07-08 00:10 01-04-09 14:42
koreth  
 
urgent  
new 3.2.1  
open  
none    
none  
0003133: mysql_query treats MySQL warnings as failures
If MySQL responds to a query with a warning, the vanilla PHP interpreter will still return results. Quercus seems to not distinguish between warning and error responses from MySQL.

Since this is a DB thing it's kind of hard to paste in a simple test case; my real-world case is an INSERT ... ON DUPLICATE KEY UPDATE on a table where one of the columns is NOT NULL but has no default value. The row in question already exists and has a value in that column (so the update succeeds) but the column isn't listed in the initial part of the INSERT clause (and thus generates MySQL warning 1364, "Field 'X' doesn't have a default value.")

This query, though it's arguably broken, works in vanilla PHP but in Quercus, mysql_queryf() returns false.

Notes
(0003624)
ferg   
12-14-08 13:23   
The pause appears to be a mysql driver issue.
(0003652)
nam   
12-16-08 10:35   
MySQL JDBC driver issue:

<?php

mysql_connect();

mysql_select_db("test");

mysql_query("DROP TABLE test3");
mysql_query("CREATE TABLE test3 (a VARCHAR(30), b VARCHAR(3) NOT NULL)");
var_dump(mysql_query("INSERT INTO test3 (a) VALUES ('foo')"));

var_dump(mysql_error());

?>

java.sql.SQLException: Field 'b' doesn't have a default value
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2536)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
        at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:734)
        at com.caucho.sql.UserStatement.execute(UserStatement.java:266)
        at com.caucho.quercus.lib.db.JdbcConnectionResource.realQuery(JdbcConnec
tionResource.java:629)
        at com.caucho.quercus.lib.db.Mysqli.realQuery(Mysqli.java:847)
        at com.caucho.quercus.lib.db.Mysqli.query(Mysqli.java:767)
        at com.caucho.quercus.lib.db.MysqlModule.mysql_query(MysqlModule.java:59
3)