/**
     * Method to test showDbTables().
     *
     * @return void
     *
     * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::showDbTables
     */
    public function testShowDbTables()
    {
        $expected = <<<SQL
SELECT table_name AS "Name"
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
  AND table_schema NOT IN ('pg_catalog', 'information_schema')
ORDER BY
  table_name ASC
SQL;
        $actual = PostgresqlQueryBuilder::showDbTables('foo');
        $this->assertEquals($this->format($expected), $this->format($actual));
    }
 /**
  * Method to test showDbTables().
  *
  * @return void
  *
  * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::showDbTables
  */
 public function testShowDbTables()
 {
     $expected = "SHOW TABLE STATUS FROM {$this->qn}foo{$this->qn}";
     $actual = PostgresqlQueryBuilder::showDbTables('foo');
     $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual));
     $expected = "SHOW TABLE STATUS FROM {$this->qn}foo{$this->qn} WHERE a = b";
     $actual = PostgresqlQueryBuilder::showDbTables('foo', 'a = b');
     $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual));
 }
Exemplo n.º 3
0
 /**
  * getTableDetail
  *
  * @param bool $table
  *
  * @return  mixed
  */
 public function getTableDetail($table)
 {
     $table = $this->db->replacePrefix($table);
     $query = PostgresqlQueryBuilder::showDbTables($this->database, 'table_name = ' . $this->db->quote($table));
     $table = $this->db->setQuery($query)->loadOne();
     if (!$table) {
         return false;
     }
     return $table;
 }