SQLDatabaseMBS versus MySQLCommunityServer

I’m facing a strange issue. I noticed by pure coincidence and I was missing one database entry in a webListBox. Through debugging I could find out that rowsFound is already missing that entry.

mySQL = "SELECT version, email, datum from usedversions where email <> 'jeannot.muller@teccompanion.com' and email <>'info@teccompanion.com' ORDER BY version DESC, datum DESC;"

Var rowsFound As rowset
rowsFound = myDB.SelectSQL( mySQL )

For each row as databaseRow in rowsFound

etc.

Now if I’m changing myDB to use a new MySQLCommunityServer instead of SqlDatabaseMBS (and I’m not changing anything else in my code!) it is working fine and that missing entry appears. MBS 20.5 plugin release.

This is the last mySQL database I’m using, on postgres all seems to be working fine.

usedversions is a databaseview in MySQL not a table, but that shouldn’t matter either.

I would not use <> for not equals in SQL queries, I would use != which I understand is the correct syntax. I used to use the <> syntax and used to get unexpected results.

1 Like

The SQL statement doesn’t matter in this case, it goes wrong even without any WHERE clause at all.

BTW. <> and != are technically identical, and ‘<>’ the preferred writing as ANSI-compliant since SQL-92 and now ISO compliant (means portable to all DBs ).

https://www.sqlshack.com/sql-not-equal-operator/

My issue is that whatever the SQL statement is (as long as it is a working one :wink: ) SQLDatabaseMBS absorbs the first entry. Very strange …

Seems to me to be a bug in the Plugin. I tried older plugins and the latest pre-release, nothing changes, but it only applies to mySQL, I don’t see the issue with Postgres. @Christian_Schmitz. (and no rush please, x-mas has a higher priority than any bug).

Really, first row missing?

Does it work with RecordSet?

correct, first row missing. Didn’t try recordset though (as I won’t use rs anyways any longer).

Interesting, thanks. I did not know ‘<>’ was correct. Thank you for letting me know. If MBS is not producing the expected result, provide your evidence to Christian, he provides very good support.

1 Like

Yes, excellent support. And I really like the plugins, specifically the SQL Plugins, as the performance is outstanding. I am only using Postgres for our own stuff, this is the last database running on mySQL.

The interesting thing is that I bumped into by pure coincidence. It is basically a table with all the logins, showing what version of an App the customer is using. This customer is often using an outdated version (despite the “warnings” they should update :wink: ).

Yesterday I did know that one particular customer did login, but I couldn’t see him on our dashboard … I just can’t explain it to myself. It is probably related to rowset versus recordset. I will dive into it, once back at my machine.

1 Like

Indeed it does! :-). Weird! So we have a workaround for the worst case. But still, this is a nasty behaviour, isn’t it? It can easily be overlooked that one result item is missing … :-(.

1 Like

I can’t reproduce it here right now. Maybe you can check with our SQLite examples to reproduce it there?
And load 20.6pr3?

Nope, working on SQLite. It is working fine on Postgres too. Seems to be related to mySQL only. Could it be related to the lib? My code is:

mydb.SetFileOption SQLConnectionMBS.kOptionLibraryMySQL, SpecialFolder.Resources.Child("libmysqlclient.21.dylib")

libmysqlclient.21.dylib not sure if that’s outdated, I probably never changed it for months.

I’ve sent you an email. Please send me back debugging output.
And I wonder what your code looks like.

1 Like

Both on its way, thank you!

Hello,

i have same problem with MBS SQL plugins 21 and Mysql.

Both on mac app or windows app… the first row missing.

When i tried with recordset, the app does’nt launch and i need to force to quit.

Is it a bug or somebody have a tips to solve that ?

(Please excuse my English, it’s not my current language)

Can you show some code?
We can quite well debug our SQLDatabaseMBS class.

Dear Christian,

thank to take time for us.

I send you a email with Xojo Code, Mysql Dump, Screenshot.