1. Lars Yencken
  2. django-hierarchy
Issue #3 resolved

Error using table name as parameter in query

Lars Yencken
repo owner created an issue

An error raised by {{{add_child()}}} seems to occur because the table name is used as a parameter in the MySQLdb query.

{{{ Traceback (most recent call last): File "./kanjiexpEvaluation.py", line 228, in <module> o = KanjiexpEvaluation() File "./kanjiexpEvaluation.py", line 43, in init self.dataSet = self._getBaseDataSet() File "./kanjiexpEvaluation.py", line 58, in _getBaseDataSet dataSet = root.add_child(name='kanjiexp') File "/usr/local/lib/python2.6/dist-packages/django_hierarchy-0.2.1-py2.6.egg/hierarchy/models.py", line 52, in add_child """, (cls._meta.db_table, parent_right_visit)) File "/usr/local/lib/python2.6/dist-packages/Django-1.1-py2.6.egg/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.6/dist-packages/Django-1.1-py2.6.egg/django/db/backends/mysql/base.py", line 84, in execute return self.cursor.execute(query, args) File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg/MySQLdb/cursors.py", line 173, in execute self.errorhandler(self, exc, value) File "/usr/local/lib/python2.6/dist-packages/MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg/MySQLdb/connections.py", line 36, in defaulterrorhandler raise errorclass, errorvalue _mysql_exceptions.ProgrammingError: (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 ''metrics_dataset' SET right_visit = right_visit + 2\n WHERE right' at line 1") }}}

Comments (7)

  1. Log in to comment