1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #2788 from aquach/devel

Escape MySQL db names.
This commit is contained in:
Michael DeHaan 2013-04-26 12:35:39 -07:00
commit 47d3f238c0

View file

@ -104,7 +104,7 @@ def db_exists(cursor, db):
return bool(res)
def db_delete(cursor, db):
query = "DROP DATABASE %s" % db
query = "DROP DATABASE `%s`" % db
cursor.execute(query)
return True
@ -125,7 +125,7 @@ def db_create(cursor, db, encoding, collation):
encoding = " CHARACTER SET %s" % encoding
if collation:
collation = " COLLATE %s" % collation
query = "CREATE DATABASE %s%s%s" % (db, encoding, collation)
query = "CREATE DATABASE `%s`%s%s" % (db, encoding, collation)
res = cursor.execute(query)
return True