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.execute(
|
||||
"""
|
||||
CREATE DATABASE %(dbname)s CHARACTER SET utf8 COLLATE utf8_german_ci
|
||||
""",
|
||||
{'dbname': dbname})
|
||||
CREATE DATABASE `%(dbname)s` CHARACTER SET utf8 COLLATE utf8_german_ci
|
||||
""" % {'dbname': dbname})
|
||||
curs.execute(
|
||||
"""
|
||||
GRANT ALL PRIVILEGES ON %(dbname)s.* TO %(username)s@'%%'
|
||||
""",
|
||||
{'dbname': dbname, 'username': username})
|
||||
GRANT ALL PRIVILEGES ON `%(dbname)s`.* TO %%(username)s@'%%%%'
|
||||
""" % {'dbname': dbname}, {'username': username})
|
||||
conn.commit()
|
||||
return dbname
|
||||
|
||||
|
@ -133,8 +131,7 @@ def delete_mysql_database(dbname, username):
|
|||
curs = conn.cursor()
|
||||
curs.execute(
|
||||
"""
|
||||
REVOKE ALL PRIVILEGES ON %(dbname)s.* FROM %(username)s@'%%'
|
||||
""",
|
||||
{'dbname': dbname, 'username': username})
|
||||
REVOKE ALL PRIVILEGES ON `%(dbname)s`.* FROM %%(username)s@'%%%%'
|
||||
""" % {'dbname': dbname}, {'username': username})
|
||||
conn.commit()
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue