Subject | Re: [Firebird-Architect] transient data sets and procedures |
---|---|
Author | Nando Dessena |
Post date | 2005-02-19T10:38:35Z |
Ann,
A> I tend to write small procedures that perform specific transformations,
A> so I need the ability to create a transient data set in one procedure -
A> or in my code - and transform it in another procedure. Allowing a
A> procedure to use a previously constructed transient data set is very
A> attractive.
would it be that much of an overhaul to allow passing TDSs as
procedure parameters and map the local declaration to an inbound
parameter name? Example:
create procedure fattest_cats (counter integer,
fatter_cats transient data set)
returns (name varchar (30), age integer, salary integer)
as
describe fatter_cats
(name varchar (30), age integer, salary integer);
begin
...
end
I can see it's ugly, but I fear that a more elegant solution would
involve stricter typing through domains and require the use of domains
as procedure parameters:
create domain d_fattest_cats
as table (name varchar (30), age integer, salary integer);
...
create procedure fattest_cats (counter integer,
fatter_cats d_fattest_cats
/* accepts a TDS or possibly other kinds of "table" */)
returns (name varchar (30), age integer, salary integer)
as
begin
...
end
I don't think Fb is anywhere near tis.
A> We could add a "local" attribute, saying that this declaration creates a
A> new transient data set, local to this procedure. That's fine, until I
A> decide that the procedure is too complicated for me to understand or
A> debug and want to break it into separate processing steps. Can you
A> suggest a way to declare the data set local to a group of related
A> procedures?
I can see only two ways: parameters as above or something like
Oracle's packages (actually sort of namespaces).
A> Is it important to be able to destroy a transient data set?
if it's global, yes. If not, scoping rules would do.
Ciao
--
Nando Dessena
http://www.flamerobin.org
A> I tend to write small procedures that perform specific transformations,
A> so I need the ability to create a transient data set in one procedure -
A> or in my code - and transform it in another procedure. Allowing a
A> procedure to use a previously constructed transient data set is very
A> attractive.
would it be that much of an overhaul to allow passing TDSs as
procedure parameters and map the local declaration to an inbound
parameter name? Example:
create procedure fattest_cats (counter integer,
fatter_cats transient data set)
returns (name varchar (30), age integer, salary integer)
as
describe fatter_cats
(name varchar (30), age integer, salary integer);
begin
...
end
I can see it's ugly, but I fear that a more elegant solution would
involve stricter typing through domains and require the use of domains
as procedure parameters:
create domain d_fattest_cats
as table (name varchar (30), age integer, salary integer);
...
create procedure fattest_cats (counter integer,
fatter_cats d_fattest_cats
/* accepts a TDS or possibly other kinds of "table" */)
returns (name varchar (30), age integer, salary integer)
as
begin
...
end
I don't think Fb is anywhere near tis.
A> We could add a "local" attribute, saying that this declaration creates a
A> new transient data set, local to this procedure. That's fine, until I
A> decide that the procedure is too complicated for me to understand or
A> debug and want to break it into separate processing steps. Can you
A> suggest a way to declare the data set local to a group of related
A> procedures?
I can see only two ways: parameters as above or something like
Oracle's packages (actually sort of namespaces).
A> Is it important to be able to destroy a transient data set?
if it's global, yes. If not, scoping rules would do.
Ciao
--
Nando Dessena
http://www.flamerobin.org