tanrj / pyodbc

Automatically exported from code.google.com/p/pyodbc
MIT No Attribution
0 stars 0 forks source link

a single-quote ' in a comment will hide following parameter markers #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. write a query with parameters (paramter markers) and with a comment
before the markers, that includes an unmatched single-quote 
2. connect to a database
3. execute query with cursor.execute, providing the query parameters

What is the expected output? What do you see instead?
I get:

ProgrammingError: ('The SQL contains 0 parameter markers, but 1 parameters
were supplied', 'HY000')

What version of the product are you using? On what operating system?
pyodbc-2.1.6 on Ubuntu Linux

Please provide any additional information below.
You have my query attached.
It is rather large, so you should write:
 cusor.execute(open('query.sql', 'r').read(), ('10',))
to execute it.

Original issue reported on code.google.com by terminatorul@gmail.com on 26 Oct 2009 at 10:29

Attachments:

GoogleCodeExporter commented 8 years ago
This appears to be an issue with the driver.

pyodbc doesn't actually read the query - it is generally passed on to the 
driver with
no modifications.

I created a similar query and tested against SQL Server 2008 on Windows and it
correctly processes the comment containing a single quote.

What database and driver are you using?

Original comment by mkleehammer on 27 Oct 2009 at 1:28

GoogleCodeExporter commented 8 years ago
Ok, sorry for the misplaced post.

I use PosgreSql with pgODBC and unixODBC and I have also had other problems 
with this
driver.

Unlike other problems with the driver, this one raised ProgrammingError so I 
thought
pyodbc would be the cause ...

Can you please asses if the problem is in pgODBC or in unixODBC ? For me they 
are
both poor and not very reliable, so equally likely to introduce the bug ...

Original comment by terminatorul@gmail.com on 27 Oct 2009 at 12:34

GoogleCodeExporter commented 8 years ago
I can't really test the drivers for you since I don't have them setup right now 
-- I ditched my servers and need to 
rebuild my test environments using VMs.  I recommend asking in the pyodbc 
discussion group, though.

Am closing since we found this isn't pyodbc. 

Original comment by mkleehammer on 31 Dec 2009 at 6:44

GoogleCodeExporter commented 8 years ago

Original comment by mkleehammer on 21 Nov 2010 at 4:43