Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Custom functions
Tue, Nov 12 2013 11:58 AMPermanent Link

aduna

how can i add in my own delphi-elevate-databaseserver some functions for sql statements?

our sql statements are now written for microsoft sql server. there are ISNULL or GETDATE() functions. i don't want use the sql-functions per database.

is there any other opportunity to add a custom function in the delphi code and add to the TEDBEngine?
Wed, Nov 13 2013 5:17 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

aduna

>how can i add in my own delphi-elevate-databaseserver some functions for sql statements?
>
>our sql statements are now written for microsoft sql server. there are ISNULL or GETDATE() functions. i don't want use the sql-functions per database.
>
>is there any other opportunity to add a custom function in the delphi code and add to the TEDBEngine?

ElevateDB supports custom functions at two levels - one's written in SQL and one's written in Delphi. To use Delphi you have to develop the function as a dll (one dll can contain many functions) and reference it to the engine. There are examples of external functions in the extensions newsgroup and quite a few posts in this newsgroup.

Roy Lambert [Team Elevate]
Sun, Nov 17 2013 4:02 AMPermanent Link

Adam Brett

Orixa Systems

aduna

EDB Has Current_Date and Current_Timestamp to return the date or time.

You can use the following:

Current_Date - INTERVAL '1' MONTH to return today less one month.

You can use the following:

WHERE SomeDate = DATE '2013-01-01'

to cast a correctly formatted string to a date. Once cast you can also use "INTERVAL" to add and subtract from this new date.

--

ISNULL()

This function is already present in EDB. There are also useful variations:

You can use

IF(Somefield IS NULL then 'something' else 'something else')

or

WHERE Somefield IS NULL

If you open EDBMgr, and load the help (sometimes you will have to set the help path in File, Preferences, Help first) there is a good section of help on all the available functions:

Numeric Functions,
String Functions,
Array Functions
... plus more.

Please look in the help.
Image