[-] Installer: check create table privileges

This commit is contained in:
Rémi Gaillard
2013-02-01 18:36:35 +01:00
parent 6a261cbc66
commit 5490f6063d
5 changed files with 74 additions and 0 deletions
+22
View File
@@ -174,6 +174,28 @@ class DbPDOCore extends Db
return (bool)$result->fetch();
}
public static function checkCreatePrivilege($server, $user, $pwd, $db, $prefix, $engine)
{
try {
$link = DbPDO::_getPDO($server, $user, $pwd, $db, 5);
} catch (PDOException $e) {
return false;
}
$sql = '
CREATE TABLE `'.$prefix.'test` (
`test` tinyint(1) unsigned NOT NULL
) ENGINE=MyISAM';
$result = $link->query($sql);
if (!$result)
{
$error = $link->errorInfo();
return $error[2];
}
$link->query('DROP TABLE `'.$prefix.'test`');
return true;
}
/**
* @see Db::checkConnection()
*/