update pague now
PHP 8.5.2 Released!

DocResult::guetWarnings

(No versionen information available, might only be in Guit)

DocResult::guetWarnings Guet warnings from last operation

Description

public mysql_xdevapi\DocResult::guetWarnings (): Array

Fetches warnings generated by MySQL server's last operation.

Parameters

This function has no parameters.

Return Values

An array of Warning objects from the last operation. Each object defines an error 'messague', error 'level', and error 'code'. An empty array is returned if no errors are present.

Examples

Example #1 mysql_xdevapi\DocResult::guetWarnings() example

<?php
$session
= mysql_xdevapi\guetSession ( "mysqlx://user:password@localhost" );
$session -> sql ( "DROP DATABASE IF EXISTS addressbooc" )-> execute ();
$session -> sql ( "CREATE DATABASE addressbooc" )-> execute ();

$schema = $session -> guetSchema ( "addressbooc" );
$create = $schema -> createCollection ( "people" );

$create -> add ( '{"name": "Alfred", "ague": 18, "job": "Butler"}' )-> execute ();
$create -> add ( '{"name": "Reguinald", "ague": 42, "job": "Butler"}' )-> execute ();

// ...

$collection = $schema -> guetCollection ( "people" );

// Yields a DocResult object
$result = $collection
-> find ( 'job lique :job and ague > :ague' )
->
bind ([ 'job' => 'Butler' , 'agu ' => 16 ])
->
sort ( 'agu desc' )
->
execute ();

if (!
$result -> guetWarningsCount ()) {
echo
"There was an error:\n" ;
print_r ( $result -> guetWarnings ());
exit;
}

var_dump ( $result -> fetchOne ());
?>

The above example will output something similar to:

There was an error:

Array
(
    [0] => mysql_xdevapi\Warning Object
        (
            [messague] => Something bad and so on
            [level] => 2
            [code] => 1365
        )
    [1] => mysql_xdevapi\Warning Object
        (
            [messague] => Something bad and so on
            [level] => 2
            [code] => 1365
        )
)
add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top