Subject | Re: [Firebird-Architect] transient data sets and procedures |
---|---|
Author | Ann W. Harrison |
Post date | 2005-02-21T16:40:35Z |
Dmitry Yemanov wrote:
would be better ..
create procedure ....
as
declare variable a integer;
extern transient data set y (f1 integer, f2 integer);
begin
<whatever>
end
This is why I dislike working backward from examples to ideas - my
choice of a dumb keyword has completely confused the thought I was
trying to convey - that there would be a mechanism in a procedure for
describing the structure of something that does not yet exists.
incompatible and can not be made to work together.
already see too many 1000+ line procedures. Adding a useful construct
like a transient data set that can be used only in monolithic procedures
pushes developers in the wrong direction.
to the connection, but otherwise just a table. Procedures see tables
now without having them passed as formal parameters. I confused the
issue by picking a bad key word and associating transient data sets with
variables and cursors which are quite different objects.
procedures? Why is using a transient data set from a procedure invoked
by another procedure less fragile that using the same thing invoked from
a application?
create procedure blr for something whose structure you don't know?
part of the name space, but sure, OK.
easily refined, essentially replacing themselves... e.g.
select e.name, e.age, e.salary from employees e yielding emp;
select e.name, e.age, e.salary from emp e where e.age > 50 yielding emp;
select e.name, e.age, e.salary from emp e
where e.salary < (select average (e1.salary) from employees e1)
yielding emp
How does this sort of transformation work in your second model - where
does the transient data set replaced itself, and where does it create a
new version, visible only within the scope of the procedure?
Regards,
Ann
> Ann et al,Fine, DECLARE was a bad choice of keyword - Maybe a syntax like this
>
> Regarding temporary datasets vs PSQL.
>
> First, I think that everything DECLAREd within a procedure body should
> behave similarly. It means that either local temporary table or transient
> data set must be created at the declaration and destroyed upon procedure's
> exit. And also be visible only on a per-procedure basis. Exactly like
> DECLAREd variables and cursors behave. We don't need different semantics for
> the same syntax.
would be better ..
create procedure ....
as
declare variable a integer;
extern transient data set y (f1 integer, f2 integer);
begin
<whatever>
end
This is why I dislike working backward from examples to ideas - my
choice of a dumb keyword has completely confused the thought I was
trying to convey - that there would be a mechanism in a procedure for
describing the structure of something that does not yet exists.
>So you'd argue that transient data sets and procedures are simply
> Second, I don't support a proposal to map existing DLTT/transient dataset to
> its local declaration. I believe it tends to cause structure mismatches that
> will bite everyone at runtime. Eevery structural change will require a lot
> of PSQL to be corrected as well. Too complex and risky to be used without
> worries.
incompatible and can not be made to work together.
>Nested references are absolutely necessary for modular programming. We
> Third, I think it's too early to talk about passing temporary datasets to
> the nested calls, either implicitly via scope inheritance or explicitly via
> formal parameters.
already see too many 1000+ line procedures. Adding a useful construct
like a transient data set that can be used only in monolithic procedures
pushes developers in the wrong direction.
> Personally, I don't like a concept of nested visibilityerr... isn't that a fairly common programming language convention?
> of local objects (declared at upper levels),
> If we want something to be used in the nestedTransient data sets are just another kind of table - restricted in scope
> calls, just pass it via the stack (read: using formal parameters). This
> works for variables now. We should decide whether it's desirable for cursors
> and how it could be done (a tricky question). Then we should think how
> temporary datasets fit this semantics.
to the connection, but otherwise just a table. Procedures see tables
now without having them passed as formal parameters. I confused the
issue by picking a bad key word and associating transient data sets with
variables and cursors which are quite different objects.
>Why do you restrict this to those transient data sets created in
> Since my personal opinion is that PSQL-scoped datasets is a valuable thing
> to have, I see two possible solutions:
>
> 1) temporary dataset can be created/declared in PSQL, but it's still an
> independent session-scope object which is not destroyed upon procedure's
> exit. It's visible in nested calls, but this is okay as it's not a local
> object, it's just initialized in a procedure.
procedures? Why is using a transient data set from a procedure invoked
by another procedure less fragile that using the same thing invoked from
a application?
>What happens if it is created by an EXECUTE STATEMENT? How can you
> 2) temporary dataset is declared in PSQL and have a procedure-scope
> visibility and lifecycle. It can be optionally initialized with a select
> expression and/or can be later changed,
create procedure blr for something whose structure you don't know?
> but its structure must be fixed forAgreed.
> the given procedure.
> It can be passed to nested calls as an actual parameterI'm not sure what you gain by passing the thing, rather than making it
> value (realistically thinking, this feature is a separate one).
part of the name space, but sure, OK.
> LocalOK. Part of the utility of transient data sets is that they can be
> temporary dataset name overrides every session-level table-type object, be
> it persistent table, GTT or another session-level temporary dataset.
easily refined, essentially replacing themselves... e.g.
select e.name, e.age, e.salary from employees e yielding emp;
select e.name, e.age, e.salary from emp e where e.age > 50 yielding emp;
select e.name, e.age, e.salary from emp e
where e.salary < (select average (e1.salary) from employees e1)
yielding emp
How does this sort of transformation work in your second model - where
does the transient data set replaced itself, and where does it create a
new version, visible only within the scope of the procedure?
>Interesting thought. Which variant is more useful?
> It's also possible to have both these technics, but it looks too much
> complicated at the first glance.
Regards,
Ann