/** * @param string $username * @param string $password * @param string $databaseName */ public function createDatabase($username, $password, $databaseName) { //exit(var_dump('GRANT ALL PRIVILEGES ON '.$databaseName.'.* TO "'.$username.'"@"%" IDENTIFIED BY "'.$password.'" WITH GRANT OPTION')); $this->connection->nativeQuery('GRANT ALL PRIVILEGES ON *.* TO "' . $username . '"@"%" IDENTIFIED BY "' . $password . '" WITH GRANT OPTION'); $this->connection->nativeQuery('CREATE DATABASE ' . $databaseName); $this->connection->nativeQuery("GRANT ALL PRIVILEGES ON " . $databaseName . ".* TO '" . $username . "'@'%' IDENTIFIED BY '" . $password . "' WITH GRANT OPTION"); //TODO use $this->connection->driver->escape() }
/** * Returns the number of rows in a given data source. * @return int */ public function getTotalCount() { if ($this->totalCount === NULL) { $this->totalCount = (int) $this->connection->nativeQuery('SELECT COUNT(*) FROM ' . $this->sql)->fetchSingle(); } return $this->totalCount; }