[python-sybase] Problem binding params with FreeTDS

Shai.Berger@integration.sungard.com Shai.Berger at integration.sungard.com
Sun, 20 Apr 2003 13:54:14 +0300


Assuming your command is as reported in the traceback (...id =3D '@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:nicholas.veeser@plumtree.com]=20
Sent: Saturday, April 19, 2003 02:02
To: python-sybase@object-craft.com.au
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 =3D conn.cursor()
    comps =3D ('a', 'b', 'c')

    for comp in comps:
        cursor.execute("SELECT id, queuetype FROM Components WHERE id =
=3D
'@' ", {'@n' : comp} )

        (c,qtype) =3D 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 =3D
'@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
Python-sybase@object-craft.com.au
https://object-craft.com.au/cgi-bin/mailman/listinfo/python-sybase