| Issue 235: | Using datetime.datetime objects as parameters causes Ingres ODBC error in subsequent queries | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem?
1. Create function get_data
def get_data(sql, params=None):
cn = pyodbc.connect(my_connection_string)
cursor = cn.cursor()
if params:
cursor.execute(sql,params)
else:
cursor.execute(sql)
results = cursor.fetchall()
columns = [ desc[0] for desc in cursor.description ]
cn.close()
return columns, results
2. Call function with something like:
get_data('select * from aircraft where date_and_time_stamp between ? and ?',[datetime.datetime(2000,1,1),datetime.datetime(2011,1,1)] )
3. It will work first time.
4. Call function again as in step 2 and you get an exception (see below)
5. If you perform the same query using dates represented as strings you can repeat the call to the function many times with no errors.
What is the expected output? What do you see instead?
I should get the proper row of rows. I get an exception (see below)
What version of the product are you using? On what operating system?
In [10]: pyodbc.version
Out[10]: '3.0.2'
Client Windows XP SP2 with Python 2.6
Ingres 9.00.0000
Ingres 3.0 ODBC Driver
Please provide any additional information below.
STACK TRACE:
C:\Documents and Settings\hiaprc\My Documents\CH149\HUMS - SUM\CH149Code\e_viz\db_layer.py in get_data(sql, params)
15
16 if params:
---> 17 cursor.execute(sql,params)
18 else:
19 cursor.execute(sql)
Error: ('5000R', '[5000R] [Ingres][Ingres ODBC Driver][Ingres]Query cannot be closed in the current state, it may only be cancelled. (13172743) (SQLExecDirectW); [22018]
[Ingres][Ingres ODBC Driver]Error in assignment (0)')
Jun 23, 2012
Project Member
#1
mkleehammer
Status:
Hold
Jun 24, 2012
Unfortunately I am unable to test with the latest version. It's not a show stopper so I can live with it. Thanks for looking into this.
Sep 29, 2012
Closing due to inactivity.
Status:
WontFix
|