MysqlndUhPreparedStatement::execute
Mysqlnd_uh Funções
MysqlndUhPreparedStatement
PHP Manual

# MysqlndUhPreparedStatement::prepare

(PECL mysqlnd-uh >= 1.0.0-alpha)

MysqlndUhPreparedStatement::prepare — Prepare an SQL statement for execution

### Descrição

public bool MysqlndUhPreparedStatement::prepare ( mysqlnd_prepared_statement `$statement` , string `$query` )

Prepare an SQL statement for execution.

### Parâmetros

`statement`

  Mysqlnd prepared statement handle. Do not modify! Resource of type Mysqlnd Prepared Statement (internal only - you must not modify it!).

`query`

  The query to be prepared.

### Valor Retornado

Returns `TRUE` on success. Otherwise, returns `FALSE`

### Exemplos

Exemplo #1 MysqlndUhPreparedStatement::prepare() example

`<?php
class stmt_proxy extends MysqlndUhPreparedStatement {
public function prepare($res, $query) {
printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
$query = "SELECT 'No more you-know-what-I-mean for lunch, please' AS _msg FROM DUAL";
$ret = parent::prepare($res, $query);
printf("%s returns %s\n", __METHOD__, var_export($ret, true));
var_dump($ret);
return $ret;
}
}
mysqlnd_uh_set_statement_proxy(new stmt_proxy());
$mysqli = new mysqli("localhost", "root", "", "test");
$stmt = $mysqli->prepare("SELECT 'Labskaus' AS _msg FROM DUAL");
$stmt->execute();
$msg = NULL;
$stmt->bind_result($msg);
$stmt->fetch();
var_dump($msg);
?>`

O exemplo acima irá imprimir:

    stmt_proxy::prepare(array (
      0 => NULL,
      1 => 'SELECT \'Labskaus\' AS _msg FROM DUAL',
    ))
    stmt_proxy::prepare returns true
    bool(true)
    string(46) "No more you-know-what-I-mean for lunch, please"

### Veja Também

- mysqlnd_uh_set_statement_proxy() - Installs a proxy for mysqlnd statements
- mysqli_stmt_prepare() - Prepara uma declaração SQL para execução
- mysqli_prepare() - Prepare an SQL statement for execution

MysqlndUhPreparedStatement::execute
Mysqlnd_uh Funções
MysqlndUhPreparedStatement
PHP Manual