Re: [PHP-PEAR] Re: [PHP-CVS] cvs: php4 /pear/Cache/Container db.php

[email protected] (Ulf Wendel) Fri, 02 Mar 2001 16:49:58 +0100
Newsgroups php.pear
Message-ID <[email protected]>

Chuck Hagenbuch schrieb:
> 
> Quoting Ulf Wendel <[email protected]>:
> 
> >    - the fieldname "data" is a reserved word in old MySQL versions,
> >      changed to "content"
> 
> To avoid future problems with reserved words, portability, etc., how about
> standardizing on this db schema:
> 
> CREATE TABLE Cache (
>     cache_ID       varchar(32) NOT NULL DEFAULT '',
>     cache_Content  mediumtext NOT NULL DEFAULT '',
>     cache_Expires  int(9) NOT NULL DEFAULT 0,
>     cache_Changed  int,
>     INDEX(cache_Expires),
>     PRIMARY KEY(cache_ID)
> )

No, we should not make things more complicated as they are. There're
already enough rules in PEAR. And please no mixed case for DB
fieldnames.

> I realize there will be code changes necessary to deal with changing the
> timestamp field to an int (in which we'd just store a unix timestamp), but I

When I wrote this I tought of an automatically updated timestamp field
(mysql feature) which every (mysql) database table should have as it
makes debugging much easier. There's no need for this field for the
cache logic. If you don't like it, remove it. 

More important but the discussion on yet another (I'm sick of them)
coding rule is in my eyes the question where to place SQL snippets. SQL
snippet should not be hidden in the (doc) comments. I suggest having
cache_mysql.sql, cache_xy.sql files in Cache/. 

Ulf

-- 
Ulf Wendel, NetUSE AG Siemenswall, D-24107 Kiel
Tel: +49 431 386 436 00, Fax: +49 431 386 435 99