Use enqueue() + executeBatch() to send multiple statements in one roundtrip.
<?php
use Foolz\SphinxQL\SphinxQL;
$batch = (new SphinxQL($conn))
->select()
->from('rt')
->where('gid', 9003)
->enqueue()
->select()
->from('rt')
->where('gid', 201)
->executeBatch();
$sets = $batch->getStored();
// $sets[0] => first SELECT rows
// $sets[1] => second SELECT rows<?php
use Foolz\SphinxQL\Helper;
use Foolz\SphinxQL\SphinxQL;
$result = (new SphinxQL($conn))
->select()
->from('rt')
->where('gid', 9003)
->enqueue()
->select()
->from('rt')
->where('gid', 201)
->enqueue((new Helper($conn))->showMeta())
->executeBatch()
->getStored();
// Tests assert:
// $result[0][0]['id'] == '10'
// $result[1][0]['id'] == '11'
// $result[2][0]['Value'] == '1'enqueue()with no argument returns a newSphinxQLlinked to the current query.enqueue($next)links the current query to the providedSphinxQLinstance.getQueue()returns ordered queued query objects.
If no query was queued, executeBatch() throws SphinxQLException.
MultiResultSetInterface supports getNext() for sequential processing.
$multi = $query->executeBatch();
while ($set = $multi->getNext()) {
$rows = $set->getStored();
// process each result set
}