printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (false !== ($tmp = mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
+ if (false !== ($tmp = @mysqli_change_user($link, $user . '_unknown_really', $passwd . 'non_empty', $db)))
printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
- if (false !== ($tmp = mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
- printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+ printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+ $host, $user, $db, $port, $socket);
- if (false !== ($tmp = mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd . '_unknown_really', $db)))
printf("[009] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+ // Reconnect because after 3 failed change_user attempts, the server blocks you off.
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
- printf("[010] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
- printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
++ printf("[009a] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
- if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
- printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
- $tmp = mysqli_fetch_assoc($res);
- mysqli_free_result($res);
- if (NULL !== $tmp['test_var'])
- printf("[019] Test variable is still set!\n");
+ if (!mysqli_query($link, 'SET @mysqli_change_user_test_var=1'))
+ printf("[010] Failed to set test variable: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+ if (!$res = mysqli_query($link, 'SELECT @mysqli_change_user_test_var AS test_var'))
+ printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+ if (1 != $tmp['test_var'])
+ printf("[012] Cannot set test variable\n");
+
+ if (true !== ($tmp = mysqli_change_user($link, $user, $passwd, $db)))
+ printf("[013] Expecting true, got %s/%s\n", gettype($tmp), $tmp);
+
+ if (!$res = mysqli_query($link, 'SELECT database() AS dbname, user() AS user'))
+ printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+ $tmp = mysqli_fetch_assoc($res);
+ mysqli_free_result($res);
+
+ if (substr($tmp['user'], 0, strlen($user)) !== $user)
+ printf("[015] Expecting user %s, got user() %s\n", $user, $tmp['user']);
+ if ($tmp['dbname'] != $db)
+ printf("[016] Expecting database %s, got database() %s\n", $db, $tmp['dbname']);
+
+ if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db . '_unknown_really')))
+ printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
mysqli_close($link);
if test "$PHP_MYSQLND" != "no" || test "$PHP_MYSQLND_ENABLED" = "yes" || test "$PHP_MYSQLI" != "no"; then
PHP_ADD_BUILD_DIR([ext/mysqlnd], 1)
-
- dnl This creates a file so it has to be after above macros
- PHP_CHECK_TYPES([int8 uint8 int16 uint16 int32 uint32 uchar ulong int8_t uint8_t int16_t uint16_t int32_t uint32_t int64_t uint64_t], [
- ext/mysqlnd/php_mysqlnd_config.h
- ],[
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
- ])
fi
+
+ dnl
+ dnl Check if the compiler supports Decimal32/64/128 types from the IEEE-754 2008 version
+ dnl References: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1657.pdf
+ dnl http://speleotrove.com/decimal/
+ dnl
+ AC_CACHE_CHECK([whether whether compiler supports Decimal32/64/128 types], ac_cv_decimal_fp_supported,[
+ AC_TRY_RUN( [
+ #include <stdio.h>
+
+ int main(int argc, char **argv) {
+ typedef float dec32 __attribute__((mode(SD)));
+ dec32 k = 99.49f;
+ double d2 = (double)k;
+ return 0;
+ }
+ ],[
+ ac_cv_decimal_fp_supported=yes
+ ],[
+ ac_cv_decimal_fp_supported=no
+ ],[
+ ac_cv_decimal_fp_supported=no
+ ])])
+ if test "$ac_cv_decimal_fp_supported" = "yes"; then
+ AC_DEFINE(HAVE_DECIMAL_FP_SUPPORT, 1, [Define if the compiler supports Decimal32/64/128 types.])
+ fi