1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-10-24 12:26:05 +02:00

Make use of database name, schema or other qualifier in all statements

This commit is contained in:
Marco
2018-08-28 23:44:50 +02:00
parent f70923679f
commit 382832457d
3 changed files with 36 additions and 36 deletions

View File

@@ -144,7 +144,7 @@ abstract class UserManager {
if ($username !== null) {
// count the number of users who do already have that specified username
$occurrencesOfUsername = $this->db->selectValue(
'SELECT COUNT(*) FROM ' . $this->dbTablePrefix . 'users WHERE username = ?',
'SELECT COUNT(*) FROM ' . $this->makeTableName('users') . ' WHERE username = ?',
[ $username ]
);
@@ -161,7 +161,7 @@ abstract class UserManager {
try {
$this->db->insert(
$this->dbTablePrefix . 'users',
$this->makeTableNameComponents('users'),
[
'email' => $email,
'password' => $password,
@@ -201,7 +201,7 @@ abstract class UserManager {
try {
$affected = $this->db->update(
$this->dbTablePrefix . 'users',
$this->makeTableNameComponents('users'),
[ 'password' => $newPassword ],
[ 'id' => $userId ]
);
@@ -262,7 +262,7 @@ abstract class UserManager {
$projection = \implode(', ', $requestedColumns);
$users = $this->db->select(
'SELECT ' . $projection . ' FROM ' . $this->dbTablePrefix . 'users WHERE username = ? LIMIT 2 OFFSET 0',
'SELECT ' . $projection . ' FROM ' . $this->makeTableName('users') . ' WHERE username = ? LIMIT 2 OFFSET 0',
[ $username ]
);
}
@@ -349,7 +349,7 @@ abstract class UserManager {
try {
$this->db->insert(
$this->dbTablePrefix . 'users_confirmations',
$this->makeTableNameComponents('users_confirmations'),
[
'user_id' => (int) $userId,
'email' => $email,
@@ -389,7 +389,7 @@ abstract class UserManager {
try {
$this->db->delete(
$this->dbTablePrefix . 'users_remembered',
$this->makeTableNameComponents('users_remembered'),
$whereMappings
);
}
@@ -407,7 +407,7 @@ abstract class UserManager {
protected function forceLogoutForUserById($userId) {
$this->deleteRememberDirectiveForUserById($userId);
$this->db->exec(
'UPDATE ' . $this->dbTablePrefix . 'users SET force_logout = force_logout + 1 WHERE id = ?',
'UPDATE ' . $this->makeTableName('users') . ' SET force_logout = force_logout + 1 WHERE id = ?',
[ $userId ]
);
}