Legacy code recordset.field suddenly fails

I am maintaining a legacy app which was built in 2014 in Xojo. Until last week calls to recordset.field(“name”).StringValue did return values as expected.

I don’t know whether it is related or not, but after adding some XojoScript functions this recordset.field function no longer returns the value. As a workaround, I use recordset.IdxField and the app works again.

I wonder if using syntax of the new framework can break code for the whole app?

I’m using Xojo 2020 r1.2 to maintain the code and until last week it seemed to work as expected. I am sandboxing and notarizing this database app and everything seems to pass well.

Has anyone written down some guidelines on how to migrate an old app to the new framework?

It looks like I have to decide whether to drop that app sooner or later or to undergo the migration.
So far I did not migrate the application, because I simply did not have the time for the huge work that I’m expecting from it.

the new class is RowSet with .Column(“id”).IntegerValue
and there was some issues if you just use .Column(“name”) could result in empty.
in german enviroment there are issues with dot and comma for double,currency values and postgreSQL.

Is that the whole recordset?
Is id ihre first field and is there no other id field due to a JOIN?

What are the unexpected values?

In this project I am not (yet) using rowset anywhere. And the database is CubeSQLServer 5.8.0 64bit on Linux.

Yes, id is the first field.

The screenshot is not showing the whole recordset, but there is no join here, or any other visible way which would indicate the existance of several id field usage. Debugging into the recordset is actually showing existing id values. The code was working fine for more than 8 years (old framework).

I remember Geoff writing about old and new framework code could be used in the same project, but I did avoid this until last week, where I added some JSON functions to XojoScript context class. I used JSONMBS in there and also was writing ‘var’ instead of ‘dim’ - I wonder if this can trigger the new framework to hook in, also for the database?

With rs.Field(“id”).StringValue an empty string is returned (not expected, as there actually is a value for id in the recordset).

With rs.Field(“id”).IntegerValue 0 (Zero) is returned (not expected).

With rs.IdxField(1).StringValue a string containing the record ID is returned, like “226”, which is the expected result

Did you recently update the CubeSQL Plugin?

The plugin interface for databases asks the plugin to provide the field list and the field values based on index, so if the plugin doesn’t work perfectly, the database class can’t fix it.

And I hope there is no regression in the database class here.

No, no recent update for CubeSQL plugin, in this project.

CubeSQLPlugin.xojo_plugin, of 12 June 2016 at 18:12

Have you tried a newer one?
Or asked Marco for assistance?

Christian’s intuition of a seasoned veteran pointed in the right direction … as usual, the main suspect is the coder himself: culpa mea!

I made some idiotic configuration change which lead to an alias of “id” for some other database column, resulting in having 2 columns in the recordset with an identic key, namely “id” :hot_face:

I appologize for stealing your time.

1 Like