$connect_errno
$connect_errno : string
Class Mysql
connect(array $config, callable $callback)
$config = array( 'host' => '192.168.56.102', // the host for mysql server ,support ipv4,ipv6 or unix sock.
'user' => 'test', // mysql user name 'password' => 'test', // password for mysql 'database' => 'test', // the database 'charset' => 'utf8', // choice, if not given, the server charset used ); function callback(\Swoole\Mysql $db, bool $result) { }
array | $config | |
callable | $callback |
$e
query(string $sql, callable $callback)
function callback(\Swoole\Mysql $link, mixed $result) {} when execute fail, the result return false, you can use $link->error and $link->errno to get the error information.
success: if query result sql, the result is the query result otherwise the result is true, you can use $link->insert_id, $link->affected_rows
string | $sql | |
callable | $callback |