« TableSelect::__construct
TableSelect::groupBy »

TableSelect::execute

(No version information available, might only be in Git)

TableSelect::execute — select ステートメントを実行する

説明

public function mysql_xdevapi\TableSelect::execute(): mysql_xdevapi\RowResult

execute() メソッドとチェインすることで、select ステートメントを実行します。

パラメータ

この関数にはパラメータはありません。

戻り値

RowResult オブジェクトを返します。

例

例1 mysql_xdevapi\TableSelect::execute() の例

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

$schema = $session->getSchema("addressbook");
$table  = $schema->getTable("names");

$result = $table->select('name','age')
  ->where('name like :name and age > :age')
  ->bind(['name' => 'John', 'age' => 42])
  ->orderBy('age desc')
  ->execute();

$row = $result->fetchAll();
?>

上の例の出力は、 たとえば以下のようになります。

Array
(
    [0] => Array
        (
            [name] => John
            [age] => 42
        )
)
関連キーワード:
TableSelect   execute   mysql   xdevapi   ステートメント   RowResult   session   schema   table   John   construct   groupBy   information   available   チェイン   getSession   mysqlx   user   password   localhost   getSchema   addressbook   getTable   names   like
関連する関数・ページ:
mysql-xdevapi-tableselect.construct   mysql-xdevapi-tableselect.where   mysql-xdevapi-tableselect.bind   mysql-xdevapi-tableselect.having   mysql-xdevapi-tableselect.limit   mysql-xdevapi-tableselect.groupby