Re: parameterised SQL views

From: Paul Singleton <p.singleton_at_keele.ac.uk>
Date: Fri, 20 Oct 2000 15:31:50 +0100
Message-ID: <39F05756.F3AD9AEA_at_keele.ac.uk>


Robert Marti wrote:

> Your above question in prolog would look like this:
>
> ?- empSnapshot(Name, Dept1, '12th Sep 1989'),
> empSnapshot(Name, Dept2, '25th Mar 1989'),
> Dept1 \= Dept2.
>
> or, if you will:
>
> ?- empSnapshot(Name, Dept1, When1),
> empSnapshot(Name, Dept2, When2),
> When1 = '12th Sep 1989',
> When2 = '25th Mar 1989',
> Dept1 \= Dept2.
>
> Either of these two (equivalent) Prolog queries can be
> translated by an automatic translator into the SQL
> queries that you wrote. (About 10 years ago, we
> even implemented a system which did just that.)

I use a slightly tweaked version of Christoph Draxler's "Prolog to SQL compiler" for other purposes (not yet for this): if you know where he is, please put me in touch, as I'd hope to persuade him to release this compiler under e.g. GPL2

I think I'm beginning to see a strategy:

  • forget views (they're not generally useful)
  • forget stored procedures (they're inadequately standardised and too platform-dependent, also perhaps inelegant)
  • generate parameterised dynamic SQL queries (as suggested by Bob Badour) lazily within each instance of the client app, e.g. by translating from Prolog
  • track dependencies (for impact analysis, source browsing, build and configuration management) through the Prolog "source" of each query

Paul Received on Fri Oct 20 2000 - 16:31:50 CEST

Original text of this message