Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003133 [Quercus] minor always 12-07-08 00:10 01-04-09 14:42
Reporter koreth View Status public  
Assigned To
Priority urgent Resolution open  
Status new   Product Version 3.2.1
Summary 0003133: mysql_query treats MySQL warnings as failures
Description 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.
Additional Information
Attached Files

- Relationships

- 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)
 

- Issue History
Date Modified Username Field Change
12-07-08 00:10 koreth New Issue
12-14-08 13:23 ferg Note Added: 0003624
12-16-08 10:35 nam Note Added: 0003652
01-04-09 14:42 ferg Priority normal => urgent


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