Home » U++ Library support » U++ SQL » ODBC Assertion failed
|
|
|
Re: ODBC Assertion failed [message #57092 is a reply to message #55812] |
Mon, 24 May 2021 14:54   |
Giorgio
Messages: 218 Registered: August 2015
|
Experienced Member |
|
|
Hi there,
so, here's my test case.
The basic functioning of the test case is the following: an object of the class Order is created (there is a in the test case class that creates a fake order, in my application the order is entered by the user through a UI), the order is then converted in a ValueMap and finally is inserted in the DB using SqlIds and other facilities provided by U++. I use this database connection to integrate my application with an accounting software. This accounting software provides a special table of tye database to allow other software to insert data in it (i.e. I'm using the table of the accounting software for their designed purpose).
I'll try now to go through each class to explain the goal of each one.
The class Order (alongside with the class OrderRow) represents a customer order: it has the classic header/body structure.
The file TesDbSql.h contains definitions of the SqlIds used by Upp's Sql class (for insert etc.).
The class TestDAO contains the actual functions that save data into the database.
The class TestDocumentMapping transform an Order object into a ValueMap, so it can be easily processed by the DAO.
The CreateOrder class creates a fake order.
The util class contains some functions that I use to convert the Order object into a ValueMap.
Finally the Db.sql file contains the script used to create the test database.
The crash happens only when the application is compiled, not in debug mode. With the real ms sql database the behaviour is really "consistent": I can insert one order without problems, but, if I try to insert a second one immediately after I inserted the first, the application crashes. With the database included in my test case the behaviour is much more erratic. I noticed however that there are some patterns: if I enter some orders with the application, exits the application, delete the content of the tables in the db and then launch the application and insert an order again, the application usually crashes. It usually crashes even if I insert some orders, exit the application, launch it again and insert some new orders.
If you have additional question let me know.
Regards,
gio
|
|
|
|
Re: ODBC Assertion failed [message #57194 is a reply to message #57104] |
Tue, 08 June 2021 10:08   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Giorgio wrote on Tue, 25 May 2021 17:16Hi,
I created the test case here.
Regards,
gio
You seem to set
test_db.ThrowOnError();
but nowwhere I can see any catches for Sql exception. As provided, it tends to err on duplicate keys, which without catches to Sql errors leads to aborting the app. Can that be a reason?
After commenting out above line, all works as expected, no crashes....
(OK, I think there will be more, but this where I got for now testing your testcase...)
Mirek
[Updated on: Tue, 08 June 2021 10:08] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Sat Apr 26 14:59:56 CEST 2025
Total time taken to generate the page: 0.01192 seconds
|