If done correctly, you could even do a complete migration without adjusting a single thing
I wouldn't have to change, never mind to recompile my frontend.
But with the proposed unit, you would neither.
Well, I take it you have some config, with the connection details (IP or similar, username, password). Those you give to the ODBC.
In this you could also have the DB engine type. In fact, if you don't recompile, then you must have it, because
Function GetSQLStatement(Const AStatement:Integer; Const AConnType:String):String;
takes AConnType.
So you could easily map this into
var MyConnType: TDbEngine;
And use it to look up statements in the table.
Well, ok, you need to recompile to add a new engine....
But then, if your client wants to run on a new engine, how is is DB being populated? Does your app include the code to create the db on first run? Or do users need to manually run some SQL.
Only in the latter case, you could indeed just supply some new sql, to support the new db-engine.
IMHO (matter of opinion) that is rare enough to allow for a new compile... (and make it easier for the user, by allowing the app to initialize the db on first run)
Then again, you run the risk that you run an invalid combinations of versions.
Well ok, if your app expects a diff version of the sql (and table structures) it will likely fail (because a new field from a table might be missing, either in the app, or in the db).
But with the sql in the table, there is an extra layer of potential error. Let's say the name of two sql-params (for one of the statements) where changed (they still exist, but have new meanings) => your app may run. No hard error, just incorrect action on the data.
Yes that can happen with the sql coded into you app too. As I said, just one more layer.
There are lots of considerations that come for different use case scenarios.
If you write a desktop app, that stores a list of local documents and allows to browse them, with comments and other meta data... => You neither have particular needs for speed nor security.
If the app runs as server (website for a business), with millions of clients connecting, speed may be really important. You may group statements that often run together into stored procedures. Different db engines may have different support for that. So the amount and order of interactions with the DB may differ between engines. It's not just replacing the sql text. There may be different design approaches. (E.g. some db can take multiple statements in a single call, other can or can't handle stored proc. and yet others again may do some work in triggers, and not need all the statements....)
You also have security considerations. You may need to limit what your application is allowed to see/change on the db.
If you store statements in the db and your app will execute those statements with certain permissions granted, then that table needs to be protected. Otherwise an attacker may be able to sneak in "destructive" statements.
Yes, you have to design correct grants for all else anyway, so you can to that for the statement table too. It's just one more table to take care off in your security concept.