Ehmm...
(I don't currently have access to the software, so this advice is
somewhat of a shot in the dark:)
You seem to be reusing the cursor to execute a second query before
you're really through
with the results from the earlier query. Sybase has a strong dislike for
this. If I'm right,
you should see the printing of the first query result before the
exception. If so, to fix, you
need to either put the conn.cursor() and cursor.close() calls in the
loop, or otherwise make
sure to fetch until there are no more records.
Just to make things simpler, try something like
cursor = conn.cursor()
cursor.execute("SELECT id, queuetype FROM Components WHERE id = @n",
{"@n":'a'} )
(c,qtype) = cursor.fetchone()
print comp, qtype
outside any loop.
Hope this helps,
Shai.
-----Original Message-----
From: Nicholas Veeser [mailto:[email protected]]
Sent: Monday, April 21, 2003 21:26
To: [email protected]
Subject: RE: [python-sybase] Problem binding params with FreeTDS
Ok, I tried the @n with single quotes, with double quotes escaped, with
no quotes
and I still get the same problem every time.
thoughts?
Nicholas
:CODE:
cursor = conn.cursor()
comps = ('a', 'b', 'c', 'd')
for comp in comps:
cursor.execute("SELECT id, queuetype FROM Components WHERE id =
@n", {"@n":comp} )
(c,qtype) = cursor.fetchone()
print comp, qtype
cursor.close()
:ERROR:
Traceback (most recent call last):
File "./DB.py", line 69, in ?
_query3(conn)
File "./DB.py", line 56, in _query3
cursor.execute("SELECT id, queuetype FROM Components WHERE id = @n",
{"@n":comp} )
File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 380, in
execute
self._raise_error(Error, 'ct_param')
File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 310, in
_raise_error
raise exc(text)
Sybase.Error: ct_param
-----Original Message-----
From: [email protected]
[mailto:[email protected]]
Sent: Sunday, April 20, 2003 3:54 AM
To: Nicholas Veeser; [email protected]
Subject: RE: [python-sybase] Problem binding params with FreeTDS
Assuming your command is as reported in the traceback (...id = '@n') and
not as in the source, just remove the single quotes from around the
"@n". Your command specifies not a parameter named "@n", but a string
constant.
Hope this helps,
Shai.
-----Original Message-----
From: Nicholas Veeser [mailto:[email protected]]
Sent: Saturday, April 19, 2003 02:02
To: [email protected]
Subject: [python-sybase] Problem binding params with FreeTDS
I am using FreeTDS 0.61
I am doing a basic bind with parameters and I am getting an error.
cursor = conn.cursor()
comps = ('a', 'b', 'c')
for comp in comps:
cursor.execute("SELECT id, queuetype FROM Components WHERE id =
'@' ", {'@n' : comp} )
(c,qtype) = cursor.fetchone()
print comp, qtype
cursor.close()
My results are thus...
Traceback (most recent call last):
File "./DB.py", line 69, in ?
_query3(conn)
File "./DB.py", line 56, in _query3
cursor.execute("SELECT id, queuetype FROM Components WHERE id =
'@n'", { '@n' : comp} )
File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 380, in
execute
self._raise_error(Error, 'ct_param')
File "/usr/local/lib/python2.2/site-packages/Sybase.py", line 310, in
_raise_error
raise exc(text)
Sybase.Error: ct_param
Any thoughts?
Thanx
Nicholas
_______________________________________________
Python-sybase mailing list
[email protected]
https://object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase
_______________________________________________
Python-sybase mailing list
[email protected]
https://object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.