Norbert,

Thanks for the quick response.  Below is the SQL statement that is
getting executed and below that is code.  It appears that the issue
might revolve around the dbsqlok().  When dbsqlok() is called in
mssql_odbx_result() the following sequence occurs 1) mssql_msg_handler()
is called with the primary key violation message, 2) mssql_err_handler()
is called, and 3) mssql_msg_handler() is called indicating that the
statement has been terminated.  Then dbsqlok() returns with a return
value other than FAIL.  Since dbsqlok() does not return FAIL,
-ODBX_ERR_BACKEND is not returned and an exception is not raised.

Please let me know what you think.

Thanks, Brian.

EXEC P_CC_REQUEST_ADD
@SESSION_ID=1,@REQUEST_NUMBER=0,@EVENTTIMESTAMP='2013-10-04T14:28:34.000
',@REQUEST_TYPE=1,@RATING_GROUP=0,@REPORTING_REASON=-1,@USED_TIME=0,@USE
D_TOTAL_OCTETS=0,@USED_INPUT_OCTETS=0,@USED_OUTPUT_OCTETS=0

Void GYMessageCCR::recordMessage(GYSession& session, OpenDBX::Conn&
conn)
{
    FTString sql, sevts;
    FTTime evts;
    eCCRequestType type;

    try
    {
        type = getCCRequestType();
        evts = getEventTimestamp();
        evts.Format(sevts,"%i", False);

        sql.format("EXEC P_CC_REQUEST_ADD"
            " @SESSION_ID=%lld"
            ",@REQUEST_NUMBER=%ld"
            ",@EVENTTIMESTAMP='%s'"
            ",@REQUEST_TYPE=%d"
            ",@RATING_GROUP=%d"
            ",@REPORTING_REASON=%d"
            ",@USED_TIME=%d"
            ",@USED_TOTAL_OCTETS=%lld"
            ",@USED_INPUT_OCTETS=%lld"
            ",@USED_OUTPUT_OCTETS=%lld",
            session.getSessionId(),
            getCCRequestNumber(),
            sevts.c_str(),
            (Int)type,
            getCCRRatingGroup(),
            getCCRReportingReason(),
            getUsedTime(),
            getUsedTotalOctets(),
            getUsedInputOctets(),
            getUsedOutputOctets());

        OpenDBX::Result r = conn.create(sql).execute();

        odbxres stat;
        while ((stat = r.getResult()) != ODBX_RES_DONE)
        {
            switch(stat)
            {
                case ODBX_RES_TIMEOUT:
                case ODBX_RES_NOROWS:
                    continue;
                default:
                    break;
            }
        }
    }
    catch (OpenDBX::Exception ex)
    {
        FTError *err = new FTError(FTError::Warning);
        err->setTextf("OpenDBX EXCEPTION: %s - %s", ex.what(),
sql.c_str());
        throw err;
    }
}

-----Original Message-----
From: Norbert Sendetzky [mailto:norb...@linuxnetworks.de] 
Sent: Friday, October 04, 2013 9:48 AM
To: OpenDBX devel list
Subject: Re: [opendbx] Error handling

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Brian

> We are considering using OpenDBX in a project that will access
> mssql from linux.  I am using the C++ API.  I have a query that is
> generating a primary key violation (severity 14), but the error is
> not being surfaced.  How should this be handled?

Can you show me example code?

Severity 14 is considered a warning in the MSSQL backend but should
nevertheless create an backend error which would throw an Exception in
the OpenDBX C++ API.


Norbert

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJSTtU0AAoJEA3e3tWv2uU+5l4P/iD+u2RHHdfyrVHb/icLbqOz
sbQ93SY4k6JCSaJtUDuC92uqkJludf24OQNiowGwDZx7zVmdwAbyCuw+unO6J/0E
yyGa9srSspxS34ISGtmLGz+yE3o2sxSv7+l/WdeMPzq0NRiNyH0xLQBjyj99bfLy
QtzRXPU791szE8HhvKe+NgoBuwwT5SnHTjdxz4M2pR7cTw2xXxjGYDg6b5DSPxdc
p/WPLoUivjBvtzH9e/0EpzQRZqvVua1dmFTeo7Sry4DlrwHdM5/WhCSaygTbetqe
PnmIYAUtcOAxB8fwUNNiWvkkSHcWo6x3z2Mbu0IyAvDi9yEh7J3HyPA06iT8VdrY
zzlB65pft9FOWQf+0dTNkaD6jXSjG9QQeQFYk4XOe6nCMjNV1Ljc1WMzdE+D19b3
nthiReIef9erM6EE8xpApR530Q7l9qSPUSu1dfpUYg7brHjRgXwNKNI+Www9jHXx
7bKYnypPwetRFN10xr0yOialH7AZPZrvbaLA80vteHpSJsgFFK5HNgEVyFEKtJin
/WDq1vgy1T207XtzeOg6VnucpC+kIy7Q0l+6lpvNGkG/IJ1IUlyD5ANfQeCfyJWa
mnNEBCHSo6fuB6ombbEVyohpKNUzjQBU278GrMEJLj11M/k0u3tsj1t9RLwc69z9
Y35TlPUZxtdDvJYpT+7X
=iumk
-----END PGP SIGNATURE-----

------------------------------------------------------------------------
------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most
from 
the latest Intel processors and coprocessors. See abstracts and register
>
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clk
trk
_______________________________________________
libopendbx-devel mailing list
libopendbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopendbx-devel
http://www.linuxnetworks.de/doc/index.php/OpenDBX

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
_______________________________________________
libopendbx-devel mailing list
libopendbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopendbx-devel
http://www.linuxnetworks.de/doc/index.php/OpenDBX

Reply via email to