-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix GH-8267: MySQLi uses unsupported format specifier on Windows
Instead of using the unsupported `%I64u` and `%I64d` format specifiers on Windows, we use the portable `PRIu64` and `PRId64` specifiers. The `L64()` macro and the `my_longlong` typedef should be adapted as well, as the `i64` literal suffix is still supported by MSVC, but using `LL` or `ll` is recommended[1], and the standard `int64_t` is available there anyway. This is not urgent, though. [1] <https://docs.microsoft.com/en-us/cpp/cpp/numeric-boolean-and-pointer-literals-cpp?view=msvc-170#integer-literals> Closes GH-8268.
- Loading branch information
Showing
3 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--TEST-- | ||
Bug GH-8267 (MySQLi uses unsupported format specifier on Windows) | ||
--SKIPIF-- | ||
<?php | ||
require_once("skipif.inc"); | ||
require_once("skipifconnectfailure.inc"); | ||
?> | ||
--FILE-- | ||
<?php | ||
require_once("connect.inc"); | ||
|
||
$mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); | ||
$mysqli->query("DROP TABLE IF EXISTS foo"); | ||
$mysqli->query("CREATE TABLE foo (id BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (id))"); | ||
$mysqli->query("INSERT INTO foo VALUES (9223372036854775807)"); | ||
var_dump($mysqli->insert_id); | ||
$mysqli->query("INSERT INTO foo VALUES (0)"); | ||
var_dump($mysqli->insert_id); | ||
?> | ||
--EXPECT-- | ||
string(19) "9223372036854775807" | ||
string(19) "9223372036854775808" |