Pop\Db\Sql::render PHP Method

render() public method

Render SQL string
public render ( boolean $ret = false ) : mixed
$ret boolean
return mixed
    public function render($ret = false)
    {
        if (null === $this->clause) {
            throw new Exception('Error: No SQL clause has been created yet.');
        }
        $this->sql = $this->clause->render();
        if ($ret) {
            return $this->sql;
        } else {
            echo $this->sql;
        }
    }

Usage Example

Exemplo n.º 1
0
 public function testDelete()
 {
     $s = new Sql(Db::factory('Sqlite', array('database' => __DIR__ . '/../tmp/test.sqlite')), 'users');
     $s->delete()->orderBy('id')->limit(1);
     $this->assertEquals('DELETE FROM "users" ORDER BY "id" ASC LIMIT 1', $s->render(true));
 }
All Usage Examples Of Pop\Db\Sql::render