Skip to content

Commit 6a1847e

Browse files
committed
Address some review comments
1 parent b0cae30 commit 6a1847e

File tree

5 files changed

+79
-253
lines changed

5 files changed

+79
-253
lines changed

ext/mysqli/tests/bind_fetch/datetime_types.phpt

Lines changed: 31 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,70 +11,44 @@ mysqli_check_skip_test();
1111
<?php
1212
require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
1313

14-
$link = default_mysqli_connect();
14+
$link = default_mysqli_connect();
1515

16-
// To get consistent result without depending on the DB version/setup
17-
mysqli_query($link, "SET sql_mode=''");
16+
// To get consistent result without depending on the DB version/setup
17+
mysqli_query($link, "SET sql_mode=''");
1818

19-
try {
20-
mysqli_query(
21-
$link,
22-
"CREATE TABLE test_bind_result_datetime(
23-
c1 date,
24-
c2 time,
25-
c3 timestamp(14),
26-
c4 year,
27-
c5 datetime,
28-
c6 timestamp(4),
29-
c7 timestamp(6)
30-
) ENGINE=" . get_default_db_engine()
31-
);
32-
} catch (\mysqli_sql_exception) {
33-
/* 14 Too big precision for timestamp */
34-
/*
35-
Seems that not all MySQL 6.0 installations use defaults that ignore the display widths.
36-
From the manual:
37-
From MySQL 4.1.0 on, TIMESTAMP display format differs from that of earlier MySQL releases:
38-
[...]
39-
Display widths (used as described in the preceding section) are no longer supported.
40-
In other words, for declarations such as TIMESTAMP(2), TIMESTAMP(4), and so on,
41-
the display width is ignored.
42-
[...]
43-
*/
44-
mysqli_query(
45-
$link,
46-
"CREATE TABLE test_bind_result_datetime(
47-
c1 date,
48-
c2 time,
49-
c3 timestamp,
50-
c4 year,
51-
c5 datetime,
52-
c6 timestamp(4),
53-
c7 timestamp(6)
54-
) ENGINE=" . get_default_db_engine()
55-
);
56-
}
19+
mysqli_query(
20+
$link,
21+
"CREATE TABLE test_bind_result_datetime(
22+
c1 date,
23+
c2 time,
24+
c3 timestamp,
25+
c4 year,
26+
c5 datetime,
27+
c6 timestamp(4),
28+
c7 timestamp(6)
29+
) ENGINE=" . get_default_db_engine()
30+
);
5731

58-
mysqli_query($link, "INSERT INTO test_bind_result_datetime VALUES(
59-
'2002-01-02',
60-
'12:49:00',
61-
'2002-01-02 17:46:59',
62-
2010,
63-
'2010-07-10',
64-
'2020','1999-12-29')");
32+
mysqli_query($link, "INSERT INTO test_bind_result_datetime VALUES(
33+
'2002-01-02',
34+
'12:49:00',
35+
'2002-01-02 17:46:59',
36+
2010,
37+
'2010-07-10',
38+
'2020','1999-12-29')");
6539

66-
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result_datetime");
67-
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
68-
mysqli_stmt_execute($stmt);
69-
mysqli_stmt_fetch($stmt);
40+
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM test_bind_result_datetime");
41+
mysqli_stmt_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
42+
mysqli_stmt_execute($stmt);
43+
mysqli_stmt_fetch($stmt);
7044

71-
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
45+
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
7246

73-
var_dump($test);
47+
var_dump($test);
7448

75-
mysqli_stmt_close($stmt);
76-
mysqli_close($link);
77-
print "done!";
49+
mysqli_stmt_close($stmt);
50+
mysqli_close($link);
51+
print "done!";
7852
?>
7953
--CLEAN--
8054
<?php

ext/mysqli/tests/bind_fetch/varied_data_types2.phpt

Lines changed: 0 additions & 69 deletions
This file was deleted.

ext/mysqli/tests/bind_fetch/varied_data_types3.phpt

Lines changed: 0 additions & 69 deletions
This file was deleted.

ext/mysqli/tests/bind_insert/datetime_types.phpt

Lines changed: 36 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,69 +11,54 @@ mysqli_check_skip_test();
1111
<?php
1212
require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
1313

14-
$link = default_mysqli_connect();
14+
$link = default_mysqli_connect();
1515

16-
// To get consistent result without depending on the DB version/setup
17-
mysqli_query($link, "SET sql_mode=''");
16+
// To get consistent result without depending on the DB version/setup
17+
mysqli_query($link, "SET sql_mode=''");
1818

19-
try {
20-
mysqli_query(
21-
$link,
22-
"CREATE TABLE insert_bind_datetime(
23-
c1 date,
24-
c2 time,
25-
c3 timestamp(14),
26-
c4 year,
27-
c5 datetime,
28-
c6 timestamp(4),
29-
c7 timestamp(6)
30-
)"
31-
);
32-
} catch (\mysqli_sql_exception) {
33-
/* 14 Too big precision for timestamp */
34-
mysqli_query(
35-
$link,
36-
"CREATE TABLE insert_bind_datetime(
37-
c1 date,
38-
c2 time,
39-
c3 timestamp,
40-
c4 year,
41-
c5 datetime,
42-
c6 timestamp,
43-
c7 timestamp
44-
)"
45-
);
46-
}
19+
/* 14 Too big precision for timestamp */
20+
mysqli_query(
21+
$link,
22+
"CREATE TABLE insert_bind_datetime(
23+
c1 date,
24+
c2 time,
25+
c3 timestamp,
26+
c4 year,
27+
c5 datetime,
28+
c6 timestamp,
29+
c7 timestamp
30+
)"
31+
);
4732

48-
$stmt = mysqli_prepare($link, "INSERT INTO insert_bind_datetime VALUES (?,?,?,?,?,?,?)");
49-
mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
33+
$stmt = mysqli_prepare($link, "INSERT INTO insert_bind_datetime VALUES (?,?,?,?,?,?,?)");
34+
mysqli_stmt_bind_param($stmt, "sssssss", $d1, $d2, $d3, $d4, $d5, $d6, $d7);
5035

51-
$d1 = "2002-01-02";
52-
$d2 = "12:49:00";
53-
$d3 = "2002-01-02 17:46:59";
54-
$d4 = "2010";
55-
$d5 = "2010-07-10";
56-
$d6 = "2020";
57-
$d7 = "1999-12-29";
36+
$d1 = "2002-01-02";
37+
$d2 = "12:49:00";
38+
$d3 = "2002-01-02 17:46:59";
39+
$d4 = "2010";
40+
$d5 = "2010-07-10";
41+
$d6 = "2020";
42+
$d7 = "1999-12-29";
5843

59-
mysqli_stmt_execute($stmt);
60-
mysqli_stmt_close($stmt);
44+
mysqli_stmt_execute($stmt);
45+
mysqli_stmt_close($stmt);
6146

62-
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM insert_bind_datetime");
47+
$stmt = mysqli_prepare($link, "SELECT c1, c2, c3, c4, c5, c6, c7 FROM insert_bind_datetime");
6348

64-
mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
49+
mysqli_stmt_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
6550

66-
mysqli_stmt_execute($stmt);
67-
mysqli_stmt_fetch($stmt);
51+
mysqli_stmt_execute($stmt);
52+
mysqli_stmt_fetch($stmt);
6853

69-
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
54+
$test = array($c1,$c2,$c3,$c4,$c5,$c6,$c7);
7055

71-
var_dump($test);
56+
var_dump($test);
7257

73-
mysqli_stmt_close($stmt);
74-
mysqli_close($link);
58+
mysqli_stmt_close($stmt);
59+
mysqli_close($link);
7560

76-
print "done!";
61+
print "done!";
7762
?>
7863
--CLEAN--
7964
<?php

ext/mysqli/tests/bind_insert/integer_types.phpt

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,18 @@ require_once dirname(__DIR__) . "/test_setup/test_helpers.inc";
1616
// To get consistent result without depending on the DB version/setup
1717
mysqli_query($link, "SET sql_mode=''");
1818

19-
mysqli_query($link,"CREATE TABLE insert_bind_integers(c1 int unsigned,
20-
c2 int unsigned,
21-
c3 int,
22-
c4 int,
23-
c5 int,
24-
c6 int unsigned,
25-
c7 int)");
19+
mysqli_query(
20+
$link,
21+
"CREATE TABLE insert_bind_integers(
22+
c1 int unsigned,
23+
c2 int unsigned,
24+
c3 int,
25+
c4 int,
26+
c5 int,
27+
c6 int unsigned,
28+
c7 int
29+
)"
30+
);
2631

2732
$stmt = mysqli_prepare($link, "INSERT INTO insert_bind_integers VALUES (?,?,?,?,?,?,?)");
2833
mysqli_stmt_bind_param($stmt, "iiiiiii", $c1,$c2,$c3,$c4,$c5,$c6,$c7);

0 commit comments

Comments
 (0)