#598: run_sql reports errors wrong
-----------------------+-------------------------------
Reporter: jblayloc | Owner:
Type: defect | Status: new
Priority: major | Milestone:
Component: MiscUtil | Version:
Resolution: | Keywords: warning exception
-----------------------+-------------------------------
Changes (by skaplun):
* keywords: => warning exception
* priority: critical => major
Comment:
Hi Joe,
I guess the rationale behind this is that the above query has no syntax
errors. It just happens that the values you are using are not matching the
expected types for the column. But this is not an SQL issue, rather
something related to the external client (Python) code.
So it's a matter of policies whether to consider this an error or just a
warning (which is the above case).
MySQL-Python implementers decided they would have simply raised a
"warning", in this case.
A warning is a special kind of Python message, that is half-way to an
exception, and can be indeed transformed into this.
<http://docs.python.org/library/warnings.html>
Indeed what we can do (I just recently discovered how to implement this),
is to transform any warning into an Exception that must be catched, in
case CFG_DEVEL_SITE is True, so that a developer can test is own code.
Or we can even decide to permanently transform this warnings into
exceptions, although sometimes this is not needed (e.g. when MySQL decides
to truncate an integer because it exceed the precision...)
Cheers!
Sam
--
Ticket URL: <http://invenio-software.org/ticket/598#comment:1>
Invenio <http://invenio-software.org>