Re: Re: Design points (was: parent_ctor())
| From: | Kristian Köhntopp | Date: | Tue, 18 Jul 2000 16:26:55 +0000 |
| Subject: | Re: Re: Design points (was: parent_ctor()) | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-24978@lists.php.net to get a copy of this message | ||
Stanislav Malyshev wrote:
> KK>> Actually, I consider the ability to keep structures with references
> KK>> across serialization essential (*1), and the language below should make
> KK>> this easy, or at least possible.
>
> But that doesn't mean PHP references don't work right. They aren't just a
> tool for what you want to do (yet?)
You are right, PHP references are just a tool, and currently an
inadequate tool.
> KK>> (*1) As I explained, referenced are to data structures what foreign
> KK>> keys are to sql tables. They are needed to normalize a design.
>
> BTW, not that SQL tables _do not_ have any "references". In most
> implementations, AFAIK, foreign keys work in entirely different way. In
> SQL foreign key is a property of the table, not the row, AFAIK. So to make
> 1-1 correspondence between SQL foreign keys and PHP references is not
> right.
A SQL table is a programming language type (specifically, a C-struct
or a similar construct in other languages).
A C struct like
struct bla {
int a;
float b;
char c[80];
};
is a SQL table
create table bla (
a integer,
b decimal,
c char(80)
);
Staying with C, a foreign key is a table property just as a
pointer is a property of the struct and not a variable of
that struct type:
struct bla {
...
int *d;
};
and
create table bla (
...
d integer references fasel.d
);
Now, if you have a variable of type "struct bla" this is just
as having a row in table "bla".
Kristian
--
Kristian Köhntopp, NetUSE AG Siemenswall, D-24107 Kiel
Tel: +49 431 386 436 00, Fax: +49 431 386 435 99
Using PHP3? See our web development library at http://phplib.netuse.de/