Extend Standard SQLExecute and SQLSelect Class

Hey there,
is it possible to extend the standard “SQLExecute” and “SQLSelect” classes?
For sure I can create my own like
Class: SQL_Select
Params:

extends db as MySQLCommunityServer, sql as string

Code:

db.SQLSelect(sql) If db.Error (...)

I know, its no big difference but i’d like to know if this is possible.

thanks in advance :slight_smile:

Yes,
why not. Try it, it costs you only a few minutes.

No, this doesn’t work - Extends does not override the method declared in a class. You have to use an unused method name or a different parameter list (overloading).

[quote=101107:@Torsten Gaidies]Yes,
why not. Try it, it costs you only a few minutes.[/quote]
and how to? :smiley:
Like Eli Ott said, i didnt find a method to override/extend the standard classes/methods.

It works,
in your code your have no return type from SQLSelect, that means you have another function delaration

Use this and your code and try it

Sub SQLSelect(extends db as MySQLCommunityServer, sql as string)
  MsgBox("Hello World")
End Sub

And what happens when you call db.SQLSelect inside your extension function?
(I know the answer)

This works, but only if the method signature is not identical. If you add a second string for example, the compiler will know exactly what to do when you call SQLSelect with two strings vs one string.

When you try clone the method signature, the compiler can’t figure out your intentions. At best you’ll get an ambiguity error, at worst a stack overflow.

The best option is to subclass MySQLCommunityServer and actually overload the method.