Rechercher une fonction PHP

SQLite3Stmt::getSQL

(PHP 7 >= 7.4.0)

SQLite3Stmt::getSQLGet the SQL of the statement

Description

public SQLite3Stmt::getSQL ([ bool $expanded = FALSE ] ) : string

Retrieves the SQL of the prepared statement. If expanded is FALSE, the unmodified SQL is retrieved. If expanded is TRUE, all query parameters are replaced with their bound values, or with an SQL NULL, if not already bound.

PHP: SQLite3Stmt::getSQL - Manual Home of Manuel PHP  Contents Haut

Parameters

expanded

Whether to retrieve the expanded SQL. Passing TRUE is only supported as of libsqlite 3.14.

PHP: SQLite3Stmt::getSQL - Manual Home of Manuel PHP  Contents Haut

Return Values

Returns the SQL of the prepared statement, or FALSE on failure.

PHP: SQLite3Stmt::getSQL - Manual Home of Manuel PHP  Contents Haut

Errors/Exceptions

If expanded is TRUE, but the libsqlite version is less than 3.14, an error of level E_WARNING or an Exception is issued, according to SQLite3::enableExceptions().

PHP: SQLite3Stmt::getSQL - Manual Home of Manuel PHP  Contents Haut

Examples

Example #1 Inspecting the expanded SQL

<?php
$db 
= new SQLite3(':memory:');
$stmt $db->prepare("SELECT :a, ?, :c");
$stmt->bindValue(':a''foo');
$answer 42;
$stmt->bindParam(2$answer);
var_dump($stmt->getSQL(true));
?>

The above example will output something similar to:

string(24) "SELECT 'foo', '42', NULL"
Find a PHP function

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-sqlite3stmt.getsql.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:fr Manuel PHP : http://php.net

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut