summaryrefslogtreecommitdiff
path: root/ext/mysqli/tests/063.phpt
blob: b76b2c99855af24623573ad4992e0111d653eb05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--TEST--
resultset constructor
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
    require_once("connect.inc");

    $mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);

    $stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL");
    $stmt->execute();
    $stmt->bind_result($foo);
    $stmt->fetch();
    $stmt->close();
    var_dump($foo);

    mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
    try {
        // an exception should be thrown from prepare (i.e. constructor) not from execute
        $stmt = new mysqli_stmt($mysql, "SELECT invalid FROM DUAL");
    } catch(mysqli_sql_exception $e) {
        echo $e->getMessage()."\n";
    }

    $mysql->close();
?>
--EXPECT--
string(3) "foo"
Unknown column 'invalid' in 'field list'