xref: /PHP-7.0/ext/mysqli/tests/059.phpt (revision 389965f1)
1--TEST--
2sqlmode + bind
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10	require_once("connect.inc");
11
12	/*** test mysqli_connect 127.0.0.1 ***/
13	$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
14
15	mysqli_select_db($link, $db);
16
17	mysqli_query($link, "SET SQL_MODE='PIPES_AS_CONCAT'");
18
19	mysqli_query($link,"DROP TABLE IF EXISTS mbind");
20	mysqli_query($link,"CREATE TABLE mbind (b varchar(25))");
21
22	$stmt = mysqli_prepare($link, "INSERT INTO mbind VALUES (?||?)");
23
24	mysqli_stmt_bind_param($stmt, "ss", $a, $b);
25
26	$a = "foo";
27	$b = "bar";
28
29	mysqli_stmt_execute($stmt);
30
31	mysqli_stmt_close($stmt);
32
33	$stmt = mysqli_prepare($link, "SELECT * FROM mbind");
34	mysqli_stmt_execute($stmt);
35
36	mysqli_stmt_bind_result($stmt, $e);
37	mysqli_stmt_fetch($stmt);
38
39	var_dump($e);
40
41	mysqli_close($link);
42	print "done!";
43?>
44--CLEAN--
45<?php
46require_once("connect.inc");
47if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
48   printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
49
50if (!mysqli_query($link, "DROP TABLE IF EXISTS mbind"))
51	printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
52
53mysqli_close($link);
54?>
55--EXPECTF--
56%unicode|string%(6) "foobar"
57done!