[freetds] state of dbrpcsend()

Thompson, Bill D (London) bill_d_thompson at ml.com
Thu Jun 10 03:46:55 EDT 2004

A good idea would be to enable dblibrary message and error handlers.
This would then display any objections the server may have to the submitted
rpc call.

you do this as follows :

1) define the error handling functions. here's two examples:

int err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, 
                     char *dberrstr, char *oserrstr)
    if ((dbproc == NULL) || (DBDEAD(dbproc)))
        fprintf (stderr, "DB-Library error:\n\t%s\n", dberrstr);
        if (oserr != DBNOERR)
            fprintf (stderr, "Operating-system error:\n\t%s\n", oserrstr);

int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, 
                        int severity, char *msgtext,
                        char *srvname, char *procname, DBUSMALLINT line)
    fprintf (stderr, "Msg %ld, Level %d, State %d\n",
            msgno, severity, msgstate);
    if (strlen(srvname) > 0)
        fprintf (stderr, "Server '%s', ", srvname);
    if (strlen(procname) > 0)
        fprintf (stderr, "Procedure '%s', ", procname);
    if (line > 0)
        fprintf (stderr, "Line %d", line);
    fprintf (stderr, "\n\t%s\n", msgtext);

2) then enable them as follows:

between dbinit() and dblogin(), code :



> -----Original Message-----
> From:	liam at inodes.org [SMTP:liam at inodes.org]
> Sent:	10 June 2004 02:08
> To:	FreeTDS Development Group
> Subject:	Re: [freetds] state of dbrpcsend()
> On Wed, Jun 09, 2004 at 03:16:19PM +0100, Thompson, Bill D (London) wrote:
> > to make the C code match your sp you'd have to omit the third call to
> > dbrpcparam() and capture the return status with the appropriate calls
> > to
> > dbresults, dbhasretstat and dbretstatus 
> Thanks for your response.
> I've changed the code to call dbrpcparam() twice only but it still fails
> in dbrpcsend(). Again, it never reaches the wire. Given that it doesn't
> touch the wire after dblogin() is called, would it even matter if I had
> my arguments specified incorrectly? It appears something is amiss inside
> dbrpcsend().
> Suggestions?
> I might go and compile FreeTDS and dblib with -g and see what's going
> on.
> Cheers.
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds


If you are not an intended recipient of this e-mail, please notify
the sender, delete it and do not read, act upon, print, disclose,
copy, retain or redistribute it.

Click here for important additional terms relating to this e-mail.


More information about the FreeTDS mailing list