[-] Installer: check create table privileges

This commit is contained in:
Rémi Gaillard committed 2013-02-01 18:36:35 +01:00
1 parent 6a261cbc66
commit 5490f6063d
5 files changed
+74

No files matched your search

+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()
*/