Re: Loosing Control With Bad SQL
Dann Corbit <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <87F42982BF2B434F831FCEF4C45FC33E4201CB03@EXCHANGE.corporate.connx.com> |
Did you look at: dbcanquery(dbproc) > -----Original Message----- > From: [email protected] [mailto:freetds- > [email protected]] On Behalf Of Ken Collins > Sent: Thursday, September 30, 2010 11:00 AM > To: FreeTDS Development Group > Subject: [freetds] Loosing Control With Bad SQL > > > Hey All, > > I am writing a tiny tds client using db-lib (currently testing 0.82) > and I am not able to cleanup/cancel the command buffer after executing > some bad sql. Given this small example below. > > dbcmd(dbproc,sql); // sql = "SELECT * FROM [foobar]" > dbsqlexec(dbproc); > > or > > dbcmd(dbproc,sql); // sql = "SELECT * FROM [foobar]" > dbsqlsend(dbproc); > dbsqlok(dbproc); > > I can never get dbsqlexec or dbsqlok to return a status, just seems my > program stops at that point. So the next time I come back around to > putting something in the command buffer and executing it, I get a > "Attempt to initiate a new Adaptive Server operation with results > pending" error. It looks as tho I might be in a situation of checking > the connection's state before on my own (which I'm sure I can do) and > then doing the cleanup of the previous failure. Tho I'm thinking I am > missing something and would love some input. The freetds.log is below > if interested. > > > - Thanks in advance, > Ken > > > dblib.c:1243:dbcmd(0x10151c850, SELECT * FROM [foobar]) > dblib.c:1250:dbcmd() bufsz = 0 > dblib.c:6722:dbsqlsend(0x10151c850) > mem.c:563:tds_free_all_results() > util.c:162:Changed query state from IDLE to QUERYING > write.c:136:tds_put_string converting 22 bytes of "SELECT * FROM > [foobar]" > write.c:164:tds_put_string wrote 44 bytes > util.c:162:Changed query state from QUERYING to PENDING > net.c:779:Sending packet > 0000 01 01 00 34 00 00 01 00-53 00 45 00 4c 00 45 00 |...4.... > S.E.L.E.| > 0010 43 00 54 00 20 00 2a 00-20 00 46 00 52 00 4f 00 |C.T. .*. > .F.R.O.| > 0020 4d 00 20 00 5b 00 66 00-6f 00 6f 00 62 00 61 00 |M. .[.f. > o.o.b.a.| > 0030 72 00 5d 00 - |r.].| > > dblib.c:4532:dbsqlok(0x10151c850) > net.c:592:Received header > 0000 04 01 00 70 00 35 01 00- |...p.5..| > > net.c:671:Received packet > 0000 aa 5c 00 d0 00 00 00 01-10 1d 00 49 00 6e 00 76 |.\...... > ...I.n.v| > 0010 00 61 00 6c 00 69 00 64-00 20 00 6f 00 62 00 6a |.a.l.i.d . > .o.b.j| > 0020 00 65 00 63 00 74 00 20-00 6e 00 61 00 6d 00 65 |.e.c.t. > .n.a.m.e| > 0030 00 20 00 27 00 66 00 6f-00 6f 00 62 00 61 00 72 |. .'.f.o > .o.b.a.r| > 0040 00 27 00 2e 00 0b 53 00-51 00 4c 00 53 00 45 00 |.'....S. > Q.L.S.E.| > 0050 52 00 56 00 45 00 52 00-30 00 38 00 00 01 00 fd |R.V.E.R. > 0.8.....| > 0060 02 00 fd 00 00 00 00 00- |........| > > dblib.c:4565:dbsqlok() not done, calling tds_process_tokens() > token.c:495:tds_process_tokens(0x10151cb30, 0x7fff5fbedf88, > 0x7fff5fbedf8c, 0x6914) > util.c:162:Changed query state from PENDING to READING > token.c:510:processing result tokens. marker is aa(ERROR) > token.c:108:tds_process_default_tokens() marker is aa(ERROR) > token.c:2451:tds_process_msg() reading message from server > token.c:2516:tds_process_msg() calling client msg handler > dbutil.c:86:_dblib_handle_info_message(0x10151d400, 0x10151cb30, > 0x7fff5fbeddb0) > dbutil.c:87:msgno 208: "Invalid object name 'foobar'." > _______________________________________________ > FreeTDS mailing list > [email protected] > http://lists.ibiblio.org/mailman/listinfo/freetds