php8.5
Home/ Manual/ mysql_xdevapi / session/ Session::sql

Session::sql

PHP function Edit on GitHub ✎

Create SQL query

Description

mysql_xdevapi\Session::sql(string $query): mysql_xdevapi\SqlStatement

Create a native SQL statement. Placeholders are supported using the native "?" syntax. Use the execute method to execute the SQL statement.

Parameters

query

SQL statement to execute.

Return Values

An SqlStatement object.

Examples

mysql_xdevapi\Session::sql() example

php
<?php
$session = mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$session->sql("CREATE DATABASE addressbook")->execute();
?>

Source: reference/mysql_xdevapi/mysql_xdevapi/session/sql.xml · from the official PHP manual (php/doc-en)