freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] FreeTDS 0.64.dev.2005041 dblib rpc failure
- From: liam AT inodes.org
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] FreeTDS 0.64.dev.2005041 dblib rpc failure
- Date: Wed, 13 Apr 2005 21:55:52 +1000
Hi,
The following test case works fine with 0.63-dev.20040824 but fails
with 0.64.dev.20050411.
Is the test case valid? It seems so to me. Please let me know if
I'm doing anything wrong.
I get the following dblib error message:
Attempt to initiate a new SQL Server operation with results
pending
This happens on the first iteration of the 'for' loop in the second
iteration of the dbresults() 'while' loop. It has already fetched
the result at this stage and expects to get NO_MORE_RESULTS on
the second time around the loop.
The stored procedure simply does a SELECT MAX(field) FROM TABLE.
It also sets a return code. It takes no parameters.
Thanks.
#include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include <sybfront.h> #include <sybdb.h> int dblib_err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr) { if ((dbproc == NULL) || (DBDEAD(dbproc))) { return(INT_CONTINUE); } else { printf("dblib error: %s\n", dberrstr); if (oserr != DBNOERR) printf("dblib os error: %s\n", oserrstr); } return(INT_CONTINUE); } int dblib_msg_handler(dbproc, msgno, msgstate, severity, msgtext, srvname, procname, line) DBPROCESS *dbproc; DBINT msgno; int msgstate; int severity; char *msgtext; char *srvname; char *procname; int line; { printf( "%s %ld; level %d; state %d; server: %s proc: %s: line %d: text: %s\n", "dblib message", (long) msgno, severity, msgstate, strlen(srvname) > 0 ? srvname : "none", strlen(procname) > 0 ? procname : "none", line > 0 ? line : 0, msgtext); return (INT_CONTINUE); } int main(void) { LOGINREC *login; DBPROCESS *dbproc; int x; putenv(FREETDS_CONF); if (dbinit() == FAIL) { exit(0); } dberrhandle((EHANDLEFUNC) dblib_err_handler); dbmsghandle((MHANDLEFUNC) dblib_msg_handler); login = dblogin(); if (login == NULL) { perror("dblogin"); return 1; } DBSETLUSER(login, USER); DBSETLPWD(login, PWD); dbproc = dbopen(login, HOST); if (dbproc == NULL) { perror("dbopen"); return 1; } if (dbuse(dbproc, DB) == FAIL) { perror("dbuse"); return 1; } if (dbsetopt(dbproc, DBBUFFER, "0", 0) == FAIL) { perror("dbsetopt"); return 1; } for (x = 0; x < 1000; x++) { int value; if (dbrpcinit(dbproc, DATA_PROC, 0) == FAIL) { dbcancel(dbproc); dbclose(dbproc); dbloginfree(login); return 1; } if (dbrpcsend(dbproc) == FAIL) { dbcancel(dbproc); dbclose(dbproc); dbloginfree(login); return 1; } if (dbsqlok(dbproc) == FAIL) { dbcancel(dbproc); dbclose(dbproc); dbloginfree(login); return 1; } if (dbhasretstat(dbproc) == TRUE) { if (dbretstatus(dbproc) != 0) { dbcancel(dbproc); return 0; } } while (dbresults(dbproc) != NO_MORE_RESULTS) { dbbind(dbproc, 1, INTBIND, (DBINT) 0, (BYTE *) &value); dbnextrow(dbproc); } dbcancel(dbproc); } dbclose(dbproc); dbloginfree(login); return 0; }
-
[freetds] FreeTDS 0.64.dev.2005041 dblib rpc failure,
liam, 04/13/2005
- <Possible follow-up(s)>
-
RE: [freetds] FreeTDS 0.64.dev.2005041 dblib rpc failure,
Thompson, Bill D (London), 04/13/2005
- Re: [freetds] FreeTDS 0.64.dev.2005041 dblib rpc failure, liam, 04/13/2005
-
RE: [freetds] FreeTDS 0.64.dev.2005041 dblib rpc failure,
Thompson, Bill D (London), 04/14/2005
- Re: [freetds] FreeTDS 0.64.dev.2005041 dblib rpc failure, liam, 04/14/2005
Archive powered by MHonArc 2.6.24.