Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute() does not fail if an incorrect number of parameters is specified #18

Open
philip-stoev opened this issue Jun 10, 2013 · 2 comments
Labels

Comments

@philip-stoev
Copy link
Contributor

Statements such as:

    cursor.execute("SELECT ? FROM DUAL");
    cursor.execute("SELECT ?, ? FROM DUAL", []);

must fail with an exception such as "wrong number of parameters specified, expected X got Y". Otherwise, simple typos may lead to data loss or wrong results.

Others fail with an exception "TypeError: init() takes exactly 2 arguments (1 given)" which is not very informative.

@jgetto
Copy link
Contributor

jgetto commented Jun 11, 2013

I improved the "incorrect number of parameters error message" and made it account for

cursor.execute("SELECT ?, ? FROM DUAL", []);

This caused test_toomany_parameters and test_insufficient_parameters to error out. Do you want to fix them? I also noticed that they aren't using the

with self.assertRaises(SomeException):
    do_something()

assertion. That might be more stable than try/except+asssert?

@jgetto
Copy link
Contributor

jgetto commented Jun 11, 2013

The cursor.execute("SELECT ? FROM DUAL"); is tracked as DB-3312, since NuoDB doesn't seem to complain at a non-prepared statement with parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants