©
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
(No version information available, might only be in Git)
TokyoTyrantQuery::metaSearch — Retrieve records with multiple queries
$queries
, int $type
)Executes multiple queries on a database and returns matching records. The current object is always the left most object in the search.
queries
Array of TokyoTyrantQuery objects
type
One of the TokyoTyrant::RDBMS_*
constants
Returns the matching rows and throws TokyoTyrantException on error
Example #1 TokyoTyrantQuery::metaSearch() example
<?php
$tt = new TokyoTyrantTable ( "localhost" , 1979 );
$tt -> put ( 'cherry' , array( 'color' => 'red' ));
$tt -> put ( 'strawberry' , array( 'color' => 'red' ));
$tt -> put ( 'apple' , array( 'color' => 'green' ));
$tt -> put ( 'lemon' , array( 'color' => 'yellow' ));
$query = $tt -> getQuery ();
$query -> addCond ( 'color' , TokyoTyrant :: RDBQC_STREQ , 'red' )-> setOrder ( 'color' , TokyoTyrant :: RDBQO_STRASC );
$query1 = $tt -> getQuery ();
$query1 -> addCond ( 'color' , TokyoTyrant :: RDBQC_STREQ , 'yellow' );
var_dump ( $query -> metaSearch (array( $query1 ), TokyoTyrant :: RDBMS_UNION ));
?>
以上例程会输出:
array(3) { ["cherry"]=> array(1) { ["color"]=> string(3) "red" } ["strawberry"]=> array(1) { ["color"]=> string(3) "red" } ["lemon"]=> array(1) { ["color"]=> string(6) "yellow" } }