xref: /php-src/ext/mysqli/tests/063.phpt (revision a21edc52)
1--TEST--
2resultset constructor
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    require_once 'connect.inc';
12
13    $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
14
15    $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL");
16    $stmt->execute();
17    $stmt->bind_result($foo);
18    $stmt->fetch();
19    $stmt->close();
20    var_dump($foo);
21
22    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
23    try {
24        // an exception should be thrown from prepare (i.e. constructor) not from execute
25        $stmt = new mysqli_stmt($mysql, "SELECT invalid FROM DUAL");
26    } catch(mysqli_sql_exception $e) {
27        echo $e->getMessage()."\n";
28    }
29
30    $mysql->close();
31?>
32--EXPECT--
33string(3) "foo"
34Unknown column 'invalid' in 'field list'
35