git-interface: Do not use UNIX_TIMESTAMP

Avoid using UNIX_TIMESTAMP which is not part of the SQL standard.
Retrieve the current UNIX time in Python and substitute it into the SQL
queries instead.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2016-08-05 11:36:19 +02:00
parent 27631f1157
commit f2a6bd207d
2 changed files with 7 additions and 4 deletions

View file

@ -4,6 +4,7 @@ import os
import re
import shlex
import sys
import time
import config
import db
@ -58,10 +59,10 @@ def create_pkgbase(pkgbase, user):
if userid == 0:
die('{:s}: unknown user: {:s}'.format(action, user))
now = int(time.time())
cur = conn.execute("INSERT INTO PackageBases (Name, SubmittedTS, " +
"ModifiedTS, SubmitterUID, MaintainerUID) VALUES " +
"(?, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), ?, ?)",
[pkgbase, userid, userid])
"(?, ?, ?, ?, ?)", [pkgbase, now, now, userid, userid])
pkgbase_id = cur.lastrowid
cur = conn.execute("INSERT INTO PackageNotifications " +