From: <sk...@po...> - 2008-06-19 15:01:42
|
I have a simple test script which creates a table, inserts a row, selects the contents then deletes the table: import Sybase print Sybase.__version__ db = Sybase.connect('TEST', 'skip', 'xxxxxx') curs = db.cursor() curs.execute("CREATE TABLE tempdb..skip (symbol CHAR(5))") dbvalues = (["A%d" % i] for i in range(10)) # this could be a recarray curs.executemany("INSERT into tempdb..skip VALUES (@1)" , dbvalues) curs.execute("SELECT * from tempdb..skip") print curs.fetchall() # I'm not sure why I have to open a new cursor to drop the table. A bug? #curs.execute("DROP TABLE tempdb..skip") curs.close() db.close() db = Sybase.connect('TEST', 'skip', 'xxxxxx') curs = db.cursor() curs.execute("DROP TABLE tempdb..skip") curs.close() db.close() I've tried several variants of this code which would allow me to drop the table with the original cursor and database connection. All fail in one way or another. For example, if I comment out the db.close() and "db = ..." statements near the end I get this error executing the DROP TABLE statement: Sybase.DatabaseError: Msg 2762, Level 16, State 4, Line 1 The 'DROP TABLE' command is not allowed within a multi-statement transaction in the 'tempdb' database. (I'd display the traceback, but apparently because I've installed 0.39x using eggs it can't find the correct line/file information. What I see references our antiquated 0.36 install (done pre-egg).) Is this a feature of Sybase, and bug in the adapter or something else? Thanks, Skip |