Appends DROP TABLE statement

@param string $table Table name
@param boolean $ifExists Whether to generate IF EXIST condition as well
@return \Krystal\Db\Sql\Db
517851
public function dropTable($table, $ifExists = true)
    {
        $this->queryBuilder->dropTable($table, $ifExists);
        return $this;
    }
577706
final public function dropIfExists($table)
    {
        $table = $this->getTablePrefixed($table);

        $sql = sprintf('DROP TABLE IF EXISTS `%s`;', $table);

        return $this->executeSqlQuery($sql);
    }
373274
public function into($table = null): Insert
    {
        $this->into = [];
        if (!\is_string($table) && !\is_array($table)) {
            throw new InvalidArgumentException('$table has to be an array or a string');
        }
        $this->into = $this->namesClass->parse($table, true);

        return $this;
    }
1168562
public static function drop($confirm = null)
    {
        //
        if ($confirm !== 'confirm') {
            return;
        }

        // prepare sql query
        $table = static::getTable();

        //
        $sql = "DROP TABLE IF EXISTS `{$table}`";

        // execute query
        static::getDatabase()->execute($sql);

        //
        static::delClassAttribute('ApplyTableExecuted');
    }
1278055
public function initDbTable($table = null) {
		if (empty($table)) {
			return false;
		}

		$initModel = ClassRegistry::init(Inflector::classify($table), true);
		if ($initModel === false) {
			return false;
		}

		if (!method_exists($initModel, 'initDbTable')) {
			return false;
		}

		$ds = $initModel->getDataSource();
		if (!$ds->truncate($initModel)) {
			return false;
		}

		return $initModel->initDbTable();
	}
568597
protected function createTableIfNeeded()
    {
        if ($this->tableExists) {
            return false;
        }

        if ($this->tableExist($this->tableName)) {
            $this->tableExists = true;
            return false;
        }

        $this->createTable();

        $this->tableExists = true;
        return true;
    }
364798
public function rowsFrom(string $table, string ...$tables)
    {
        array_unshift($tables, $table);

        foreach ($tables as $table) {
            $this->rowsFrom[] = $this->dialect()->quoteName($table);
        }

        return $this;
    }
444045
public function hasTable($table)
    {
        $sql = $this->grammar->compileTableExists();

        $table = $this->connection->getTablePrefix().$table;

        return count($this->connection->select($sql, array($table))) > 0;
    }
750616
public function restoreTable($table, $restoreColumns = false)
    {
        $dumpChecksum = $this->getDumpChecksum();
        $checksum = $this->getTableChecksum($table);
        if ($checksum[$table] === $dumpChecksum[$table]) {
            return;
        }

        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        if ($database->getOne("SHOW TABLES LIKE '$table'")) {
            $database->execute("DROP TABLE `$table`");
        }

        $databaseHandler = $this->getDatabaseHandler();
        $directory = $this->getDumpDirectory();
        $databaseHandler->import($directory . '/' . $table . '.sql');
    }
2075
public function tableExists( $table )
    {
        $query = "SELECT COUNT(*) AS count FROM information_schema.tables
                  WHERE table_schema = ? AND table_name = ?";

        $params = [ $this->name, $table ];

        $statement = $this->database->prepare( $query );
        $statement->execute( $params );

        $results = $statement->fetchAll();

        return ( 0 < ( int ) $results[ 0 ][ 'count' ] );
    }
730331
private function createTable(Table &$table) {
        $annotations = $this->getClassSettings();
        $create = false;
        foreach ($annotations as $columnName => $descArray) {
            $create = true;
            $dbColumnName = Util::camelTo_($columnName);

            if (isset($descArray['attrs']['primary']) && $descArray['attrs']['primary']) {
                $table->setPrimaryKey($dbColumnName);
            }

            if (isset($descArray['attrs']['reference'])) { // Reference not ReferenceMany
                $onDelete = (isset($descArray['attrs']['reference']['onDelete'])) ?
                        $descArray['attrs']['reference']['onDelete'] : 'RESTRICT';
                $onUpdate = (isset($descArray['attrs']['reference']['onUpdate'])) ?
                        $descArray['attrs']['reference']['onUpdate'] : 'RESTRICT';
                $table->addReference($dbColumnName, $descArray['attrs']['reference']['table'], $descArray['attrs']['reference']['column'], $onDelete, $onUpdate);

                $refTable = new Table($descArray['attrs']['reference']['table'], $table->getConnection());
                $refColumns = $refTable->getColumns();
                if (!empty($refColumns[$descArray['attrs']['reference']['column']]['charset'])) {
                    $descArray['attrs']['charset'] = $refColumns[$descArray['attrs']['reference']['column']]['charset'];
                    $descArray['attrs']['collation'] = $refColumns[$descArray['attrs']['reference']['column']]['collation'];
                }

                unset($descArray['attrs']['reference']['table']);
                unset($descArray['attrs']['reference']['column']);
                unset($descArray['attrs']['reference']['model']);

                if (isset($descArray['attrs']['reference']['onUpdate']))
                    unset($descArray['attrs']['reference']['onUpdate']);
                if (isset($descArray['attrs']['reference']['onDelete']))
                    unset($descArray['attrs']['reference']['onDelete']);

                if (!empty($descArray['attrs']['reference'])) {
                    $descArray['attrs'] = array_merge($descArray['attrs'], $descArray['attrs']['reference']);
                    unset($descArray['attrs']['reference']);
                }
            }

            $table->addColumn($dbColumnName, $this->parseAttributes($columnName, $descArray));
            $this->checkIndexes($dbColumnName, $descArray, $table);
        }

        return ($create) ? $table->getConnection()->createTable($table, false) : false;
    }
981967
public function delete($table, $options = array())
    {
        $query_string = 'DELETE FROM `' . $this->pref . $table . '`' . $this->opt($options);

        try {
            $stmt = $this->doQuery($query_string);
            return $stmt->rowCount();
        } catch (\Exception $e) {
            print_r($e->getMessage());
            return false;
        }
    }
1308655
public function tableExists($table)
	{
		$query = 'SHOW TABLES LIKE ' . str_replace('#__', $this->tablePrefix, $this->quote($table, false));
		$this->setQuery($query)->execute();

		return ($this->getAffectedRows() > 0) ? true : false;
	}
714526
protected function CreateDelete(Table $table, Condition $condition = null, OrderList $orderList = null, $offset = 0, $count = 0)
    {
        return new Delete($this->connection, $table, $condition, $orderList, $offset, $count);
    }
56312
protected function _addTable(Table $table)
    {
        $namespaceName = $table->getNamespaceName();
        $tableName     = $table->getFullQualifiedName($this->getName());

        if (isset($this->_tables[$tableName])) {
            throw SchemaException::tableAlreadyExists($tableName);
        }

        if ($namespaceName !== null
            && ! $table->isInDefaultNamespace($this->getName())
            && ! $this->hasNamespace($namespaceName)) {
            $this->createNamespace($namespaceName);
        }

        $this->_tables[$tableName] = $table;
        $table->setSchemaConfig($this->_schemaConfig);
    }
1055140
private function dropTable($table)
    {
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        $database->execute("DROP TABLE `$table`");
    }
1081744
public static function doesTableExist($table) {
		try {
			fw\Database::prepare("SELECT 1 FROM {$table}")->fetchOne();
			return true;
		} catch (\PDOException $ex) {
			return false;
		}
	}