-
Notifications
You must be signed in to change notification settings - Fork 1
/
Select.php
50 lines (44 loc) · 1.18 KB
/
Select.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Pinq\Demo\Sql\Compilation;
use Pinq\Demo\Sql\Compilation\Compiled\Select as CompiledSelect;
use Pinq\Demo\Sql\Providers\TableSourceInfo;
use Pinq\Expressions as O;
use Pinq\Providers\DSL\Compilation\IRequestCompilation;
use Pinq\Providers\DSL\Compilation\Parameters\ParameterCollection;
use Pinq\Queries\Requests\Values;
/**
* @author Elliot Levin <elliotlevin@hotmail.com>
*/
class Select extends Query implements IRequestCompilation
{
public $retrievalMode = Values::AS_ARRAY;
public function __construct(
\PDO $connection,
TableSourceInfo $table,
ParameterCollection $parameters
) {
parent::__construct(
$connection,
$table,
$parameters
);
}
/**
* @return void
*/
public function wrapSelectAsDerivedTable()
{
$this->sql = "SELECT * FROM ({$this->sql}) AS {$this->tableName}";
}
/**
* @return CompiledSelect
*/
public function asCompiled()
{
return new CompiledSelect(
$this->sql,
$this->parameters->buildRegistry(),
$this->retrievalMode
);
}
}