src/Charcoal/Source/DatabaseSource.php
public function tableExists()
    {
        $dbh    = $this->db();
        $table  = $this->table();
        $driver = $dbh->getAttribute(PDO::ATTR_DRIVER_NAME);
        if ($driver === self::SQLITE_DRIVER_NAME) {
            $query = sprintf('SELECT name FROM sqlite_master WHERE type = "table" AND name = "%s";', $table);
        } else {
            $query = sprintf('SHOW TABLES LIKE "%s"', $table);
        }

        $this->logger->debug($query);
        $sth    = $dbh->query($query);
        $exists = $sth->fetchColumn(0);

        return !!$exists;
    }
public function tableExists()
    {
        $dbh    = $this->db();
        $table  = $this->table();
        $driver = $dbh->getAttribute(PDO::ATTR_DRIVER_NAME);
        if ($driver === self::SQLITE_DRIVER_NAME) {
            $query = sprintf('SELECT name FROM sqlite_master WHERE type = "table" AND name = "%s";', $table);
        } else {
            $query = sprintf('SHOW TABLES LIKE "%s"', $table);
        }

        $this->logger->debug($query);
        $sth    = $dbh->query($query);
        $exists = $sth->fetchColumn(0);

        return !!$exists;
    }
public function tableExists ( ) { $ dbh = $ this -> db ( ) ; $ table = $ this -> table ( ) ; $ driver = $ dbh -> getAttribute ( PDO :: ATTR_DRIVER_NAME ) ; if ( $ driver === self :: SQLITE_DRIVER_NAME ) { $ query = sprintf ( 'SELECT name FROM sqlite_master WHERE type = "table" AND name = "%s";' , $ table ) ; } else { $ query = sprintf ( 'SHOW TABLES LIKE "%s"' , $ table ) ; } $ this -> logger -> debug ( $ query ) ; $ sth = $ dbh -> query ( $ query ) ; $ exists = $ sth -> fetchColumn ( 0 ) ; return ! ! $ exists ; }
Determine if the source table exists.

@return boolean TRUE if the table exists, otherwise FALSE.
Determine if the source table exists .