1
希望能夠使用Django/db-api構建的字符串excaping,但它看起來不適用於create database
命令?Django/db-api破解創建數據庫?
from django.db import connections
cursor = connections['dbadmin'].cursor()
cursor.execute('create database %s', ['foo'])
從而未能與
DatabaseError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''foo'' at line 1")
雖然直,unparameterized create database foo
工作正常。
這看起來像一個bug,對吧? drop database
也有類似的問題...