mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
git-interface: Do not use rowcount
Avoid using Cursor.rowcount to obtain the number of rows returned by a SELECT statement as this is not guaranteed to be supported by every database engine. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
ecbf32f0cc
commit
27631f1157
2 changed files with 11 additions and 7 deletions
|
@ -40,10 +40,11 @@ cur = conn.execute("SELECT Users.Username, Users.AccountTypeID FROM Users " +
|
|||
"WHERE SSHPubKeys.PubKey = ? AND Users.Suspended = 0",
|
||||
(keytype + " " + keytext,))
|
||||
|
||||
if cur.rowcount != 1:
|
||||
row = cur.fetchone()
|
||||
if not row or cur.fetchone():
|
||||
exit(1)
|
||||
|
||||
user, account_type = cur.fetchone()
|
||||
user, account_type = row
|
||||
if not re.match(username_regex, user):
|
||||
exit(1)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue