Re: Storing query language in relations
Date: 23 Sep 2002 17:36:24 -0700
Message-ID: <fedf3d42.0209231636.108e0a78_at_posting.google.com>
pbrazier_at_cosmos-uk.co.uk (Paul) wrote in message news:<51d64140.0209230146.320e13b2_at_posting.google.com>...
> If we accept that a relational database is the
> most logical way to
> hold structured data, why not go a step further
> and store the actual
> queries in relational format?
What is "unstructured" data anyway?! :-)
> ...why not go a step further and store the actual
> queries in relational format?
Sure... but there is no reason you couldn't do a whole imperative language including queries (expressions). It would only be a matter of having a table for each language element. Something like this:
create table InsertStatement
{
Statement_ID : StatementID,
SourceExpression : ExpressionID,
TargetExpression : ExpressionID,
key { Statement_ID },
...
};
create table Expression
{
ID : ExpressionID,
ResultType : TypeID,
ExpressionType : ExpressionType,
key { ID }
};
create table UnaryOperatorExpression
{
Expression_ID : ExpressionID,
Operand : ExpressionID,
key { Expression_ID },
...
};
create table IntegerLiteralExpression
{
Expression_ID : ExpressionID,
Value : Integer,
key { Expression_ID },
...
};
Of course you would want to build some supporting operators:
create operator EvaluateExpression(AExpressionID : ExpressionID) :
Generic
What would also be an interesting exercise would be to model a word
...
-- Nathan AllanReceived on Tue Sep 24 2002 - 02:36:24 CEST