Playing with DBKit and MySQL


I just started a new WebProject and would like to play a bit with DBKit.
When saving a new entry, I run into this line Connector->SaveRow (line 196):

CurrentRow = Connection.SelectSQL("SELECT * FROM " + Table + " WHERE rowid = " + rowID.ToString)

There is no field named “rowid” in my tables and, of course, it should not be mandatory to have one. This is SQLite stuff.
Then the variable rowID is set to 0 when the Exception about that missing “rwoid” field raises. The newly inserted rows primarykey in db is 5. So 0 seems wrong here.

Some lines later there is a similar query, but there the query is build in a way it could propably work (line 218):

CurrentRow = Connection.SelectSQL("SELECT * FROM " + Table + " WHERE " + PrimaryKeyColumn + " = " + PrimaryKeyValue)

So, after some minutes with dbkit, that seems really buggy or did I miss something?


Hmm, ok, when I look at this small part of the code - only in this method - , I find it all a bit dubious.
All these variables are simply parsed into the queries unscaped.
Then these ifs:

The if is no different than the elseif before it.


The #Target-If does nothing.

This is pretty far from good code quality, but especially when testing, an exception is thrown directly with the very first function (add entry). This is code that is delivered as an example (e.g. for beginners) with a Xojo version, not some alpha stage “I quickly programmed something down”.

To be honest, I’m a bit shocked.

1 Like

You may want to ping @Geoff_Perlman
I believe he is working on DBKit.