Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
11 / 11
CRAP
100.00% covered (success)
100.00%
25 / 25
PDO
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
11 / 11
11
100.00% covered (success)
100.00%
25 / 25
 buildConnection
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 buildParserInstance
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
7 / 7
 buildConditions
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 adapter
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 buildParser
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 fragmentParser
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 operatorParser
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 conditionsParser
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 queryBuilder
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
3 / 3
 buildQuery
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 result
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
namespace PHPixie\Database\Driver;
class PDO extends \PHPixie\Database\Type\SQL\Driver
{
    public function buildConnection($connectionName, $config)
    {
        return new \PHPixie\Database\Driver\PDO\Connection($this, $connectionName, $config);
    }
    public function buildParserInstance($connectionName)
    {
        $connection     = $this->database->get($connectionName);
        $adapterName    = $connection->adapterName();
        $config         = $connection->config();
        $fragmentParser = $this->fragmentParser($adapterName);
        $operatorParser = $this->operatorParser($adapterName, $fragmentParser);
        $conditionsParser = $this->conditionsParser($adapterName, $operatorParser);
        return $this->buildParser($adapterName, $config, $fragmentParser, $conditionsParser);
    }
    public function buildConditions()
    {
        return new \PHPixie\Database\Driver\PDO\Conditions();
    }
    
    public function adapter($name, $config, $connection)
    {
        $class = '\PHPixie\Database\Driver\PDO\Adapter\\'.ucfirst($name);
        return new $class($config, $connection);
    }
    public function buildParser($adapterName, $config, $fragmentParser, $conditionsParser)
    {
        $class = '\PHPixie\Database\Driver\PDO\Adapter\\'.ucfirst($adapterName).'\Parser';
        return new $class($this->database, $this, $config, $fragmentParser, $conditionsParser);
    }
    public function fragmentParser($adapterName)
    {
        $class = '\PHPixie\Database\Driver\PDO\Adapter\\'.ucfirst($adapterName).'\Parser\Fragment';
        return new $class;
    }
    public function operatorParser($adapterName, $fragmentParser)
    {
        $class = '\PHPixie\Database\Driver\PDO\Adapter\\'.ucfirst($adapterName).'\Parser\Operator';
        return new $class($this->database, $fragmentParser);
    }
    public function conditionsParser($adapterName, $operatorParser)
    {
        $class = '\PHPixie\Database\Driver\PDO\Adapter\\'.ucfirst($adapterName).'\Parser\Conditions';
        return new $class($this->database, $operatorParser);
    }
    public function queryBuilder()
    {
        $conditions = $this->conditions();
        $values = $this->database->values();
        return new \PHPixie\Database\Driver\PDO\Query\Builder($conditions, $values);
    }
    public function buildQuery($type, $connection, $parser, $builder)
    {
        $class = '\PHPixie\Database\Driver\PDO\Query\Type\\'.ucfirst($type);
        return new $class($connection, $parser, $builder);
    }
    public function result($statement)
    {
        return new \PHPixie\Database\Driver\PDO\Result($statement);
    }
}