fix broken MySQL quoting
This commit is contained in:
parent
4ed81c29e6
commit
2a638481d1
1 changed files with 6 additions and 9 deletions
|
@ -105,14 +105,12 @@ def create_mysql_database(dbname, username):
|
||||||
curs = conn.cursor()
|
curs = conn.cursor()
|
||||||
curs.execute(
|
curs.execute(
|
||||||
"""
|
"""
|
||||||
CREATE DATABASE %(dbname)s CHARACTER SET utf8 COLLATE utf8_german_ci
|
CREATE DATABASE `%(dbname)s` CHARACTER SET utf8 COLLATE utf8_german_ci
|
||||||
""",
|
""" % {'dbname': dbname})
|
||||||
{'dbname': dbname})
|
|
||||||
curs.execute(
|
curs.execute(
|
||||||
"""
|
"""
|
||||||
GRANT ALL PRIVILEGES ON %(dbname)s.* TO %(username)s@'%%'
|
GRANT ALL PRIVILEGES ON `%(dbname)s`.* TO %%(username)s@'%%%%'
|
||||||
""",
|
""" % {'dbname': dbname}, {'username': username})
|
||||||
{'dbname': dbname, 'username': username})
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return dbname
|
return dbname
|
||||||
|
|
||||||
|
@ -133,8 +131,7 @@ def delete_mysql_database(dbname, username):
|
||||||
curs = conn.cursor()
|
curs = conn.cursor()
|
||||||
curs.execute(
|
curs.execute(
|
||||||
"""
|
"""
|
||||||
REVOKE ALL PRIVILEGES ON %(dbname)s.* FROM %(username)s@'%%'
|
REVOKE ALL PRIVILEGES ON `%(dbname)s`.* FROM %%(username)s@'%%%%'
|
||||||
""",
|
""" % {'dbname': dbname}, {'username': username})
|
||||||
{'dbname': dbname, 'username': username})
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue