RecordSet Deprecated

Have a project where Autocomplete on RecordSet isn’t working. And then found out Field was deprecated, replaced by Column.

I’m running 2019 r 3.2.

I replace Field with Column and compiler said it didn’t exist. Replaced it with field and it compiled. But the AutoComplete on RecordSet still is not working.

I then discovered RecordSet was also deprecated. Why didn’t the compiler tell me that?

I made the changes and now compiler is saying:
Type mismatch error. Expected class RowSet, but got class RecordSet
rs = Session.sesAspeDB.SQLSelect(lsSql)
What do I do about this?

I’m now at a loss. sesAspeDB is MySQLCommunityServer

I am using thousands of recordsets in my code, when will the compiler stop allowing it?

Call me confused: :woozy_face:

use 2019r11 and continue to use recordsets and fields
if not, recordset still works, but the autocomplete forces you to use rowsets.
I asked long ago to have a préférence to choose which API we want for autocomplete but it never implemented, and pretty sure it will never be !

1 Like

I want to use 2019 r 3.2 and bring code upto date. But why did the compiler throw this error:

Type mismatch error. Expected class RowSet, but got class RecordSet
rs = Session.sesAspeDB.SQLSelect(lsSql)

Now I discovered SQLSelect was deprecated for SelectSQL???

Why make these silly little changes?

But the real question is WHY doesn’t the compiler tell is these things have been deprecated?

1 Like

SQLSelect returns a recordset
SelectSQL returns a rowset.

1 Like

it will tell you if you analyze the project
(be prepared for thousands of warnings !)

Analyze does not give one warning!

Make sure you have the deprecation warnings turned on.

But to answer your question…

SQLSelect was replaced with a new version which returns a RowSet but also easily does prepared statements, taking the sql query followed by the properties in an array or paramarray. All of the types are inferred automatically.

Where do you turn on deprecation warnings?

Ii found it.

Typically when will support for deprecated items stop?

When they are removed
Watch the release notes for this or just realize that at some point when they are removed your code will just not compile as is

1 Like

So I’m safe for now.

Thanks Norman.

There are actually real improvements behind a lot of this. It helps to read the Relase Notes as you move to a new version. Deprecated stuff only actually gets removed very slowly.

The big advantage regarding these database changes, for me, is that I could throw away my own methods for encapsulating the prepare/bind stuff. I used not to use prepared statements, then it was made clearer that one ought to. But I wasn’t going to replace hundreds of selects/executes, each a single call, with many prepare/bind steps for each one. That would have made the code much longer and much less readable. Hence why I made my own methods, which I’ve now dumped and I now use the new SelectSQL which does prepare/bind internally, automatically.

So you see that replacing SQLSelect with SelectSQL is not just a silly little change.

I understand now it’s not just a silly change. But there is a reason behind it.

So I made sure all depricated warnings were turned on and checked our membership app and found 19,000 warmings. I’d say 99% are related to the database stuff. The question I havee now is what is the best way to make these corrections moving forward?

Also do you think a global search and replace, like changing field to column works?

I’m just a little overwhelmed. Any strategies to move forward would be appreciated.

Thank you!

The 4 biggies with database are

  1. DatabaseRecord to DatabaseRow
  2. Recordset to RowSet
  3. SQLSelect to SelectSQL
  4. SQLExecute to ExecuteSQL

Global replacement of Field to Column can be problematic unless you can include the RowSet name in the search. So replacing <rowset>.Field to <rowset>.column should work. You will still have to go back and fix up the column types. Be aware that if you have 3rd party plugins, some of them haven’t been updated to the new paradigm and will require some"old style" code remain in place.

And do NOT try to globally change .text to .value as there are still places where .text is used. Also, be aware that certain string functions, like ‘Middle’ vs ‘Mid’ have changed the index.

Good luck and keep smiling.

My biggest problem is our membership app is not something that can be frozen in time as I’m always making updates. So I have to devise a strategy where I can do a little at a time.

Thank you for taking the time to respond!

For the database stuff maybe convert one method at a time
That way you can narrowly test changes to see that you havent altered functionality
As you get more comfortable with the new stuff & the fact you best now be catching exceptions instead of checking error codes then maybe you do a couple

Not sure search and replace is a good choice as you could introduce so many changes at once that you have an impossible task trying to find & fix them before you can do a debug run again

Really will depend on how you have coded things
Methods that return recordsets that are called in lots of places could result in needing to alter all those callers before you can move forward
Progress slowly & methodically and eventually you can get there

Its just a matter of time & effort :stuck_out_tongue:

don’t forget:

  • it now throws Exceptions, so you have to handle these and get rid of the error checking code
  • it now uses Prepared Statements internally, so you can remove the code that used them manually in most places
  • Indexes need changes: RecordSet.IdxField is 1-based, RowSet.ColumnAt is 0-based

So esp. with the database stuff, the change to API2 is not a ‘simple’ search / replace operation.

Don’t get rid of that code, just put it in your exception handling.

HI, Have started changing over to rowset etc and the selectSQL etc all works great. However for some reason I cant get the result of the rowset to populate the text fields I have created.
eg: txtPersonne(0).value = recdata.Column(“Surname”).stringvalue
txtPersonne(1).value = recdata.column(“GivenNames”).StringValue
txtPersonne(2).value = recdata.column(“Address1”).StringValue
txtPersonne(3).value = recdata.column(“Address2”).StringValue

I autocomplete works a treat but the program runs and returns an error on the first line.
The record is returned, I am error trap as well, and the debugger is reporting that every thing is OK. It just doesnt allow me to place the data into the text fields on the form.
Any ideas guys
THX in advance