Prepared Statement in Interface problem

In a posting last year, Oliver Osswald suggested using an interface so a program could use either SQLite or CubeSQL. I started to implement his suggestions and ran into a problem with prepared statements which are handled completely differently in the two databases. The error I am getting before I even start to work on the differences is [quote]Return type (interface PreparedSQLStatement) does not match overridden method’s return type (class SQLitePreparedStatement) Function Prepare(statement as String) As Prepared Statement.[/quote] How can I handle the differences in the returned type? Can I subclass both SQLiteDatabase and CubeSQLDatabase adding a new method (“Prep” perhaps) that would return class PreparedSQLStatement? This is the first time I have tried to work with an interface and am not anxious to spend a day or two working on this to find out it is never going to work.

The original post was about using SQLite and CubeSQL in the same program was

[quote] Oliver Osswald 25 May 2015 Beta Testers, Xojo Pro Europe (Switzerland, Basel)
Edited last year by Oliver Osswald

Use an interface.

You could define your own database class interface. Then you add database classes implementing that interface, like a “mySQLite” class, or a “myCubeSQL” class and so on. In a module you define a property of your interface type. Then you can instantiate your classes (according to a user choice during login, for instance) and store it in that property. From now on you just use that property in order to access the methods of the chosen database.

For example:

Use Insert, Class Interface and name it myDBInterface
Add method definitions to the interface (just name, parameters and return types. You may want to include everything from the generic database class , plus your application specific methods)
Create new classes for each database type you wish to connect and from its Interfaces list select myDBInterface
Implement each method of the interface (Like SQLExecute or SQLSelect, but also your own, like myDBCreateIndexes, etc)
In a module, create a property of type myDBInterface, like myDB As imDBInterface
Add startup code to your app where the database is selected and then stored: myDB = New mySQLite
Now throughout your application, use this interface to interact with your database, like myDB.SQLSelect("Select * from mytable"), etc

Like this you can more easily write a GUI, independently from your database. You also can implement other databases for your application by simply adding new classes which implement your myDBInterface.[/quote]

I would not expose the prepared statement in the interface at all, it’s an implementation detail, alternatively declare an interface for it and return that.