Subject | Re: followup to 'execute function' |
---|---|
Author | craigp98072 |
Post date | 2004-06-07T18:29:11Z |
--- In firebird-support@yahoogroups.com, Helen Borrie <helebor@t...>
wrote:
a bit fuzzy in some ways. I understand from reading the InterBase
docs that UDF's should be very short, simple functions so they won't
tie up the database, esp. in the multi-threaded server (and, as you
said, they shouldn't query the database - and they certainly
shouldn't modify it as that may leave the database in an
inconsistent state. IIRC).
So, that's pretty distinctive. ;-)
But is there anything wrong with creating a simple UDF that returns
a value, like this:
isql> select generate_guid_udf();
Rather than having this weird syntax (I guess that's where I'm
confused - why is this necessary? Is this even the proper idiom? I
just grabbed it and started using it because it worked)
isql> select generate_guid_udf() from RDB$DATABASE;
thnaks!
--craig
wrote:
> At 11:05 PM 6/06/2004 +0000, you wrote:any SQL
> >I just looked into rfunc2 source code, and they seem to use the
> >following idiom:
> >
> > select func(...) from RDB$DATABASE;
> >
> >I guess I missed this in the docs.
> >
> >I still think 'execute function' support would be nice syntactical
> >sugar.
>
> Hmm, a function is a function, not a procedure! It's just like
> function: designed to take constants as inputs and return aresult.
> Functions operate on values, procedures operate on objects.writing a
>
> Actually, you can sometimes satisfy a need for a function by
> stored procedure: that is, it is not a requirement for aprocedure to
> query the database. The reverse is not true: you must neverwrite a
> function that has to query the database.the
>
> Things are getting more blurred these days: RDBMS engines, esp.
> object-relational ones, are acquiring the ability to let youdefine
> internal objects with their own functionality using a specialisedJVM
> that's part of the engine. There's been discussion from time totime in
> firebird-architect about doing something like this with Firebird,via a
> plug-in - so don't give up hope!Hmm; sorry, the distinction between stored procs and UDF's is still
a bit fuzzy in some ways. I understand from reading the InterBase
docs that UDF's should be very short, simple functions so they won't
tie up the database, esp. in the multi-threaded server (and, as you
said, they shouldn't query the database - and they certainly
shouldn't modify it as that may leave the database in an
inconsistent state. IIRC).
So, that's pretty distinctive. ;-)
But is there anything wrong with creating a simple UDF that returns
a value, like this:
isql> select generate_guid_udf();
Rather than having this weird syntax (I guess that's where I'm
confused - why is this necessary? Is this even the proper idiom? I
just grabbed it and started using it because it worked)
isql> select generate_guid_udf() from RDB$DATABASE;
thnaks!
--craig