note 93009 added to mysqli.get-warnings
| From: | marcus at synchromedia dot co dot uk | Date: | Wed, 19 Aug 2009 14:13:58 +0000 |
| Subject: | note 93009 added to mysqli.get-warnings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159634@lists.php.net to get a copy of this message | ||
I'm not sure how useful this function is as implemented. Take this example:
CREATE TABLE
blah (
x varchar(100) NOT NULL,
y varchar(100) NOT NULL,
z varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO blah SET z = '1';
Query OK, 1 row affected, 2 warnings (0.00 sec)
mysql> show warnings;
+---------+------+----------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------+
| Warning | 1364 | Field 'x' doesn't have a default value |
| Warning | 1364 | Field 'y' doesn't have a default value |
+---------+------+----------------------------------------+
Doing the same from PHP using mysqli_get_warnings(), you get this instead:
object(mysqli_warning)#4 (3) {
["message"]=>
string(38) "Field 'x' doesn't have a default value"
["sqlstate"]=>
string(5) "HY000"
["errno"]=>
int(1364)
}
i.e. it only returns the first warning. I suspect it should return an array of these objects rather
than just one. At least you know what the return value looks like now, since the docs don't
say!
----
Server IP: 62.2.182.223
Probable Submitter: 195.43.57.48
----
Manual Page -- http://www.php.net/manual/en/mysqli.get-warnings.php
Edit -- https://master.php.net/note/edit/93009
Del: integrated -- https://master.php.net/note/delete/93009/integrated
Del: useless -- https://master.php.net/note/delete/93009/useless
Del: bad code -- https://master.php.net/note/delete/93009/bad+code
Del: spam -- https://master.php.net/note/delete/93009/spam
Del: non-english -- https://master.php.net/note/delete/93009/non-english
Del: in docs -- https://master.php.net/note/delete/93009/in+docs
Del: other reasons-- https://master.php.net/note/delete/93009
Reject -- https://master.php.net/note/reject/93009
Search -- https://master.php.net/manage/user-notes.php