Board index » delphi » db handle/transaction handle in UDF with API functions

db handle/transaction handle in UDF with API functions

Hello!

I'm writing a UDF that use some API functions.
In some of them is necessary to pass a db handle or transaction handle as
params.
In my case, I am creating a function that receive a string with sql
instruction and return a value.
Example:

==============================================
Strored Procedure xxxxx
SQL commands
...
VAR = CALCULATE_VALUES('SELECT FIELD1, FIELD2 FROM TABLE');
...
SQL commands

end

==============================================

So,
In my UDF (Calculate_Values(SQL: String):String)
I whant to make some API call's that ask me for DB handle or Transaction
Handle and I can't create DB Handle's or Transactions Handle's, I have to
work with the transaction/DB handles that make the call of the UDF.

Please! my english is not god, I now, but is the best I can do!

Thank's!

Bye!

Moa.

---
Este e-mail foi validado ao ser enviado e n?o contm virus!
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.298 / Virus Database: 161 - Release Date: 13/11/01

 

Re:db handle/transaction handle in UDF with API functions


No, you cannot pass these to a UDF.

Besides that, a UDF shouldn't execute SQL statements anyway - it wasn't
designed to do that.

If you need processing that involve SQL statements, better use a Stored
Procedure.

--
Martijn Tonies
InterBase Workbench - the developer tool for InterBase and Firebird
http://www.interbaseworkbench.com

Upscene Productions
http://www.upscene.com

"This is an object-oriented system.
If we change anything, the users object."

Quote
"Moacir Cardoso" <MoacirCard...@hotmail.com> wrote in message

news:3c053ee7_2@dnews...
Quote
> Hello!

> I'm writing a UDF that use some API functions.
> In some of them is necessary to pass a db handle or transaction handle as
> params.
> In my case, I am creating a function that receive a string with sql
> instruction and return a value.
> Example:

> ==============================================
> Strored Procedure xxxxx
> SQL commands
> ...
> VAR = CALCULATE_VALUES('SELECT FIELD1, FIELD2 FROM TABLE');
> ...
> SQL commands

> end

> ==============================================

> So,
> In my UDF (Calculate_Values(SQL: String):String)
> I whant to make some API call's that ask me for DB handle or Transaction
> Handle and I can't create DB Handle's or Transactions Handle's, I have to
> work with the transaction/DB handles that make the call of the UDF.

> Please! my english is not god, I now, but is the best I can do!

> Thank's!

> Bye!

> Moa.

> ---
> Este e-mail foi validado ao ser enviado e n?o contm virus!
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.298 / Virus Database: 161 - Release Date: 13/11/01

Other Threads