Re: Queries and OO

From: Daniel Parker (danielaparker_at_spam?nothanks.windupbird.com)
Date: 01/13/05


Date: Wed, 12 Jan 2005 16:01:05 -0800


"Doc O'Leary" <droleary.usenet@2005.subsume.com> wrote in message
news:droleary.usenet-1C2B91.07362112012005@corp.supernews.com...
> In article <BaZEd.30267$TN6.922746@news20.bellglobal.com>,
> "Daniel Parker" <danielaparker@spam?nothanks.windupbird.com> wrote:
>
>> There is no
>> counterpart to querying a collection of objects and applying logical
>> operations to obtain projections on the original set, at least not in a
>> statically typed language. Reflection has nothing to do with it.
>
> You sure have a way of obfuscating your point! All (I guess) you're
> saying is that an object query cannot create new *classes* in the same
> way an SQL query result is a "table" of rows/columns. You're right, but
> given the "static" qualification I could just as easily argue that SQL
> doesn't do what you say because the results of a query aren't *really* a
> table,

A query against a relation, whether it's a restriction (subset of rows), a
projection (subset of columns) or a join, all result in another relation.
You should immediately see the benefits of clear well defined terms :-)
Relational theory is not about database tables.

> and a creating a view in the database breaks a corresponding
> "static" qualification. The database result corresponds more to an
> associative array (aka, hash/map/dictionary) collection, and in that
> manner there would be a corresponding OO way to query those objects to
> get a subset. The question, then, is whether or not you want a query
> mechanism that returns objects themselves, or returns just the
> information that is queried? My assumption is that people don't *want*
> to create classes/objects by doing a query; they want existing objects.
> The query results may not directly correspond to what other mechanisms
> provide, but that doesn't change the fact that you *can*, in theory,
> provide an object query mechanism that doesn't require you to call
> methods on objects to execute the query.

The point is that the relational calculus gives you a very rich way of
querying for data, subsets of data, supersets of data, according to the
rules of logic. There is nothing comparable to that in the idea of queryng
sets of objects. What you do with the data, once you have it, is up to you.
Database API's that support SQL give you some of the power of the relational
calculus, and all the data comes back with a full set of metadata, the same
metadata as it would come back with if it did come from a "table." You can
bind that data to the properites of objects, you can do so through
introspection and reflection, and you can automate the conversion of types
from database types to class data member types. I know about that :-)

Regards,
Daniel Parker



Relevant Pages

  • Re: [Wss] lists
    ... Ishai Sagi is over zealous in saying that you shouldn't query the database ... There is nothing wrong with *querying* the database, ... *amending* the database in any way (except via the WSS UI or as he writes by ...
    (microsoft.public.sharepoint.windowsservices)
  • Re: Query runs long in one db, fast in another....
    ... Check the 'Indexes' button on the tablein each database you are ... querying. ... if you imported the query but the tables ... that there is an index that is aiding the query ...
    (comp.databases.ms-access)
  • Re: Hiding Access to Multiple Databases
    ... >query DB C, it is actually querying DB A and DB B. ... It is called a distributed database. ...
    (comp.object)
  • Re: Queries from Access
    ... If I open up the database the lock file appears and the query shows all ... If you have a web page which should be querying a Jet database but, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Multiple relation in dataset.
    ... attempting to do here (importing CSV files and querying across tables). ... Just like database, there will be "columns" in the CSV files that will ... -Get related information (basically, run a query) ...
    (microsoft.public.dotnet.framework.adonet)