From: Dave C. <dj...@ob...> - 2004-07-23 21:19:32
|
Erik Thiele wrote: > hi. > > i am using > > - gentoo linux. > - sybase-0.36 > - freetds-0.62.3 > - python 2.3.3 > > from this linux machine i am accessing a mssql 7 server on an nt4.0 windows server. > > i am doing > > db=Sybase.connect('myserver','myuser','mypass','mydb') > c=db.cursor() > c.execute('select * from foo where something=@x', {'@x' : "blabla"}) > > it sais: > > Sybase.DatabaseError: ------ > Must declare the variable '@x' > > ??? i do not understand. why is this so? > > i am trying to use python DB API 2.0. but i find the documentation for this > not very sufficient. there seems to be no good example at all on the net. > > questions never covered and done wrong in almost all examples is the issue > with escaping the datatypes. some really do > c.execute("select from where x="%s"" % mystring) > this is of course fatal since mystring may contain closing " and then sql commands. > > anyway... how do i get the module to work? FreeTDS has historically had problems with named parameters. Are you able to test the same query using the Perl bindings to FreeTDS? > and... why is there several styles in DB API 2.0? i mean the Sybase.paramstyle > thing. i thought DB API was there for portability, and then i find out > that different modules have different ways to create sql queries. so there > is absolute zero portability. why? You will have to ask the database vendors that one. - Dave -- http://www.object-craft.com.au |