Handling SQLite Errors

I am in the process of updating some old code involving web apps that use SQLite databases, and I have a question. The old way of handling database errors was to do some database operation and then check the Error property of the database. At some point after I wrote the original code (I am not exactly sure when), that approach was deprecated in favor of using a try-catch structure to trap a DatabaseException.

The part that I don’t understand is how the original deprecated mechanism still works if the database is now raising exceptions instead of just setting some properties. It seems that I must must move to the new approach if I am using a modern version of Xojo to compile the app. But fixing this throughout the entire suite of applications would be a lot of work.

This is important because the code I am working on is used by other people, and must be robust. If the app fails because of unhandled exceptions, it will go offline, and no one will be able to use it.

Can anyone clarify whether the deprecated mechanism still works and if so, how?

Yes, the difference is SelectSQL versus SQLSelect. The API 2.0 version will raise exceptions while the classic API will use error codes. This helps the folks who aren’t interested in updating.

For databases, yes, this can be a larger task.

You should create a system for relaunching. I can’t offer more specifics without knowing platform and type of project; but Lifeboat keeps web apps running.

You can use the Classic design by sticking to the classic names of things. You’ll need RecordSets and SQLExecute/Select. RowSet and ExecuteSQL/SelectSQL will raise exceptions.

Thanks, Tim. That is exactly the information that I was looking for. I appreciate it!