Re: Databases as objects

From: DBMS_Plumber <paul_geoffrey_brown_at_yahoo.com>
Date: 22 Dec 2006 16:23:16 -0800
Message-ID: <1166833396.066448.129560_at_a3g2000cwd.googlegroups.com>


Thomas Gagne wrote:
> Bob, you're misunderstanding me. I do not want to replace SQLese with
> OOese. I'm suggesting that the wonderful SQL you posted can be made
> into a DB-stored procedure to facilitate reuse, and that it is better
> for multiple programs to call the procedure than for each to embed the SQL.
>
> Are we still in disagreement?

 I dunno about Bob, but I disagree. Your suggestion would remove perhaps the most powerful feature of a SQL DBMS - dynamic SQL. Most of the non-trivial systems I've worked on have supported--to a greater or lesser extent--mechanisms whereby users could manipulate the UI to generate SQL queries 'on the fly'.

 If you want to pull that into a 'stored procedure', feel free to do so, but then you're just using the modern SQL-DBMS as a kind of tp-monitor or application server, only one that shares an address space with the data manager. All of which prompts a gigantic shrug.

 If you want to 'think different' about this kind of thing, then consider, instead of putting the SQL inside the procedural code, the potential of putting the procedural code inside the SQL.

  CREATE TABLE MyTable (

        ID          SomeIdentifierDomain           PRIMARY KEY,
        Data      SomeApplicationSpecificDomain   NOT NULL,
        Related  AnotherIdentifierDomain        FOREIGN KEY REFERENCES
( AnotherTable )
  );

 WITH AnalyticResult ( Label, DisplayData ) AS (

     SELECT A.SomeData,
                  SomeAggregate( T.Data )
        FROM MyTable T, AnotherTable A
     WHERE T.Related = A.ID
          AND ComplexDomainSpecificPredicate ( A.MoreData, 'Do Re Me Fa
Lo Sa Te Do')

    GROUP BY A.SomeData
  )
  SELECT OpenGraphWindow ( R.Label, R.DisplayData, :UI_Handle )

      FROM AnalyticResult R;

  But then, you can do this already. No one does, is all. Received on Sat Dec 23 2006 - 01:23:16 CET

Original text of this message