diff options
author | Florian Pritz <bluewind@xinu.at> | 2019-01-14 20:44:12 +0100 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2019-01-14 20:45:37 +0100 |
commit | 042f3f2622e1adbc7546cfa25a5d138486b99341 (patch) | |
tree | d3f56bc3205725635a5282b362221dd1a78c98ec | |
parent | f1d109e9b6863d924d2cb20f83e41d7091d62e20 (diff) | |
download | aur-042f3f2622e1adbc7546cfa25a5d138486b99341.tar.gz aur-042f3f2622e1adbc7546cfa25a5d138486b99341.tar.xz |
Quote MySql 8.0 reserved keywords
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
-rwxr-xr-x | aurweb/git/update.py | 4 | ||||
-rw-r--r-- | schema/aur-schema.sql | 4 | ||||
-rw-r--r-- | upgrading/3.0.0.txt | 4 | ||||
-rw-r--r-- | upgrading/3.1.0.txt | 2 | ||||
-rw-r--r-- | web/lib/aurjson.class.php | 6 | ||||
-rw-r--r-- | web/lib/pkgfuncs.inc.php | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/aurweb/git/update.py b/aurweb/git/update.py index 0614e9ea..39128f8b 100755 --- a/aurweb/git/update.py +++ b/aurweb/git/update.py @@ -180,13 +180,13 @@ def save_metadata(metadata, conn, user): # Add package groups. if 'groups' in pkginfo: for group in pkginfo['groups']: - cur = conn.execute("SELECT ID FROM Groups WHERE Name = ?", + cur = conn.execute("SELECT ID FROM `Groups` WHERE Name = ?", [group]) row = cur.fetchone() if row: groupid = row[0] else: - cur = conn.execute("INSERT INTO Groups (Name) VALUES (?)", + cur = conn.execute("INSERT INTO `Groups` (Name) VALUES (?)", [group]) conn.commit() groupid = cur.lastrowid diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql index 79de3f27..f05f40a3 100644 --- a/schema/aur-schema.sql +++ b/schema/aur-schema.sql @@ -149,7 +149,7 @@ CREATE TABLE PackageLicenses ( -- Information about groups -- -CREATE TABLE Groups ( +CREATE TABLE `Groups` ( ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Name VARCHAR(255) NOT NULL, PRIMARY KEY (ID), @@ -164,7 +164,7 @@ CREATE TABLE PackageGroups ( GroupID INTEGER UNSIGNED NOT NULL, PRIMARY KEY (PackageID, GroupID), FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE, - FOREIGN KEY (GroupID) REFERENCES Groups(ID) ON DELETE CASCADE + FOREIGN KEY (GroupID) REFERENCES `Groups`(ID) ON DELETE CASCADE ) ENGINE = InnoDB; diff --git a/upgrading/3.0.0.txt b/upgrading/3.0.0.txt index b134b797..4f9c70f6 100644 --- a/upgrading/3.0.0.txt +++ b/upgrading/3.0.0.txt @@ -200,7 +200,7 @@ CREATE TABLE PackageRelations ( 17. Create tables to store package groups: ---- -CREATE TABLE Groups ( +CREATE TABLE `Groups` ( ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, Name VARCHAR(64) NOT NULL, PRIMARY KEY (ID), @@ -211,7 +211,7 @@ CREATE TABLE PackageGroups ( GroupID INTEGER UNSIGNED NOT NULL, PRIMARY KEY (PackageID, GroupID), FOREIGN KEY (PackageID) REFERENCES Packages(ID) ON DELETE CASCADE, - FOREIGN KEY (GroupID) REFERENCES Groups(ID) ON DELETE CASCADE + FOREIGN KEY (GroupID) REFERENCES `Groups`(ID) ON DELETE CASCADE ) ENGINE = InnoDB; ---- diff --git a/upgrading/3.1.0.txt b/upgrading/3.1.0.txt index 2fc16147..e883a6cd 100644 --- a/upgrading/3.1.0.txt +++ b/upgrading/3.1.0.txt @@ -7,7 +7,7 @@ ALTER TABLE Packages MODIFY Name VARCHAR(255) NOT NULL, MODIFY Version VARCHAR(255) NOT NULL DEFAULT ''; ALTER TABLE Licenses MODIFY Name VARCHAR(255) NOT NULL; -ALTER TABLE Groups MODIFY Name VARCHAR(255) NOT NULL; +ALTER TABLE `Groups` MODIFY Name VARCHAR(255) NOT NULL; ALTER TABLE PackageDepends MODIFY DepCondition VARCHAR(255); ALTER TABLE PackageRelations MODIFY RelCondition VARCHAR(255); ---- diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index c51e9c26..c275d214 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -284,10 +284,10 @@ class AurJSON { "LEFT JOIN RelationTypes " . "ON RelationTypes.ID = PackageRelations.RelTypeID " . "WHERE PackageRelations.PackageID = " . $pkgid . " " . - "UNION SELECT 'groups' AS Type, Groups.Name, '' AS Cond " . - "FROM Groups INNER JOIN PackageGroups " . + "UNION SELECT 'groups' AS Type, `Groups`.`Name`, '' AS Cond " . + "FROM `Groups` INNER JOIN PackageGroups " . "ON PackageGroups.PackageID = " . $pkgid . " " . - "AND PackageGroups.GroupID = Groups.ID " . + "AND PackageGroups.GroupID = `Groups`.ID " . "UNION SELECT 'license' AS Type, Licenses.Name, '' AS Cond " . "FROM Licenses INNER JOIN PackageLicenses " . "ON PackageLicenses.PackageID = " . $pkgid . " " . diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php index ced1f8e2..00f0cc45 100644 --- a/web/lib/pkgfuncs.inc.php +++ b/web/lib/pkgfuncs.inc.php @@ -188,7 +188,7 @@ function pkg_groups($pkgid) { $pkgid = intval($pkgid); if ($pkgid > 0) { $dbh = DB::connect(); - $q = "SELECT g.Name FROM Groups g "; + $q = "SELECT g.Name FROM `Groups` g "; $q.= "INNER JOIN PackageGroups pg ON pg.GroupID = g.ID "; $q.= "WHERE pg.PackageID = ". $pkgid; $result = $dbh->query($q); |