Editing Database Table Causes Crash

I have an app written in Xojo that I’ve been using for at least 10 years to manipulate data in a MySQL database hosted by my web site provider. Starting a couple of days ago, the app started crashing whenever it executes code that edits a record in one table in the database. The crash appears to happen when the app tries to edit data and then move to the next record in the recordset. There is no exception raised by Xojo, the app just crashes. Here’s a fragment of the Mac OS crash log:

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY

Application Specific Information:
Performing @selector(performClick:) from sender XOJButton 0x608000158940
abort() called
terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fffa5981d42 __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fffa5a6f457 pthread_kill + 90
2 libsystem_c.dylib 0x00007fffa58e7420 abort + 129
3 libc++abi.dylib 0x00007fffa443b94a abort_message + 266
4 libc++abi.dylib 0x00007fffa4460c17 default_terminate_handler() + 243
5 libobjc.A.dylib 0x00007fffa4f6f713 _objc_terminate() + 124
6 libc++abi.dylib 0x00007fffa445dd49 std::__terminate(void (*)()) + 8
7 libc++abi.dylib 0x00007fffa445d7be __cxa_throw + 121
8 libc++abi.dylib 0x00007fffa445de47 operator new(unsigned long) + 87
9 MySQLCommunityPlugin.dylib 0x000000010cdd3d06 0x10cd5b000 + 494854
10 MySQLCommunityPlugin.dylib 0x000000010cdd3fc3 0x10cd5b000 + 495555
11 com.mckernon.JMSRegistrationDB 0x000000010b115bbb DatabaseCursor.Edit%%o + 11
12 com.mckernon.JMSRegistrationDB 0x000000010b114b6a RecordSet.Edit%%o + 26

My guess is that the table it’s editing is corrupted, but I’m not sure how to find that out or how to repair the damage. I’m going to download the database and try working with it locally.

The host server is running MySQL version 5.6.41, is that compatible with Xojo? Tech support at the host says their SQL log for that database doesn’t show any errors.

FWIW, I’ve tried Xojo 2016R3 all the way up to the current beta of 2018r3, and all are crashing at the same point in my code.

Thoughts?

If the table is damaged, connect to the database with mysql command and then use

repair table TABLE_NAME;

To repair the table

I checked the table, it’s OK - but a bunch of the fields in the last two records are null…

This can be a source of conflict if you’re using recordsets to update.

What’s the better method? I’m up for anything that gets this working again…:slight_smile:

Straight up SQL

Personally I use recordsets to get data OUT of a table, never to put it in, nor to update it

delete the records that are not conform with any sql editor
then try to use the database again.

[quote=409462:@Dave S]Straight up SQL

Personally I use recordsets to get data OUT of a table, never to put it in, nor to update it[/quote]

This part of the code is pretty old, probably from before I learned SQL prepared statements. It should be pretty easy to update.

[quote=409464:@Jean-Yves Pochez]delete the records that are not conform with any sql editor
then try to use the database again.[/quote]

I’ll give that a try as my immediate solution, then work on Dave’s improvements.

Thank you all!