MYSQL_TEST_SKIP_CONNECT_FAILURE which controls how connection problems
are handled: failure (MYSQL_TEST_SKIP_CONNECT_FAILURE = false, default)
or skip (MYSQL_TEST_SKIP_CONNECT_FAILURE = true)
Also, some minor tweaking of connection parameters in the tests.
MYSQL_TEST_SKIP_CONNECT_FAILURE = false
Every test that needs a working MySQL connection now includes
skipifconnectfailure.inc. If MYSQL_TEST_SKIP_CONNECT_FAILURE evaluates
to true skipifconnectfailure.inc tries to establish a database
connection. If no connection can be opened, the test will be skipped.
In case of MYSQL_TEST_SKIP_CONNECT_FAILURE = false (default) an no
connection, a test who cannot establish a connection will fail.
So, if you have a buggy configuration or a server that is sometimes
not available, you can now decide if you want the tests to ignore this
and skip the test or to fail (MYSQL_TEST_CONNECT_FAILURE = false, default).
Other, minor tweaks:
042.phpt - whitespace
067.phpt - parse error in SKIPIF section fixed
[14:35] <_jani_> nixnutz_: why don't you just commit everything in one go..?
[14:35] <_jani_> this "spamming" is getting quite boring..
[14:36] <Pierre> 20â¬/commit :)
objects. Technically it might be possible to tweak ext/mysqli and make
the objects cloneable - tough, we haven't checked in depth.
So, if one is interested, raise a discussion.
a result set in one array. This is handy if want to fetch all results and
pass the data directly to a template engine, for example. In this case
you save a loop.
1) Currently:
$all_rows = array();
while ($row = mysqli_fetch_assoc($res))
$all_rows[] = $row;
2) With mysqli_fetch_all:
$all_rows = mysqli_fetch_all($res, MYSQL_ASSOC)
Note: if you need the loop for processing each row, try variant 1) for
performance reasons.
from the "same" result handle and checking with each other if the fetched
rows are the same or not. Inspired by a bug report. There seem to be really
people doing this...
verbose explanation of changes:
- take connection parameter from connect.inc
- use proper UEXPECTF
- have 'print "done!"' or similar at the end to detect crashes
- whitespace changes where needed
- take care of portability: PHP 5 vs. PHP 5, MySQL 4.1 - 6.0
- understand return value checking as sometime that makes you type
more when you write but makes you happy when you debug
Next 10 in row to be tweaked:
- take connection parameter from connect.inc
- use proper UEXPECTF
- have 'print "done!"' or similar at the end to detect crashes
- whitespace changes where needed
- take care of portability: PHP 5 vs. PHP 5, MySQL 4.1 - 6.0
- understand return value checking as sometime that makes you type
more when you write but makes you happy when you debug
- take connection parameter from connect.inc
- use proper UEXPECTF
- have 'print "done!"' or similar at the end to detect crashes
- whitespace changes where needed
- take care of portability: PHP 5 vs. PHP 5, MySQL 4.1 - 6.0
- understand return value checking as sometime that makes you type
more when you write but makes you happy when you debug
- take connection parameter from connect.inc
- use proper UEXPECTF
- have 'print "done!"' or similar at the end to detect crashes
- whitespace changes where needed
- take care of portability: PHP 5 vs. PHP 5, MySQL 4.1 - 6.0
1) Try to have portable SQL, don't create your own schema unless the test
wants to test exactly this
2) Don't rely on default SQL sort orders
3) Use proper UEXPECTF. There have been a lot of tiny unicode issues when
ext/mysqli has returned a binary string in unicode mode although a
unicode string could be expected and vice versa
describe them only once in with a bit of detail.
1) Correct Whitespace (space vs. tab) if need be
2) Recall: you get the connection parameter from connect.inc, no DB name, no
port no other connection parameter in any of the tests!
3) At the end of each test you find a "print 'done!'" or similar. This is
most helpful to detect crashing/segfaulting tests with all run-tests.php
versions.
connect is no reason to skip the test. Also, no test should have hard-wired
connection parameter in it. Connection parameters come from connect.inc
(see environment variables in connect.inc).
SVN repro into HEAD. Again, it might happen that I crash the set of tests
and don't mention one or the other change while merging. Blame me...
1) Note the new environment variables to control the test run
2) Variables $IS_MYSQLND and $MYSQLND_VERSION are for writing portable tests
3) sys_get_temp_dir function is for PHP5/PHP6 portability