[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Again - Perl: DB.PHP.Cache




Maybe I need another cup o' joe.  To make sure we're on the same page, can
you maybe do a few example lines of output of the script based on the
actual values of the DB?  Just so I can see what you want you want me to
take and how to output it.  I think I get it, but I'd hate to find out
that I'm doing it all wrong. :-)

On Tue, 16 Nov 1999, Jason Pincin wrote:

> Again - directed mainly at Aaron - I dunno who our other Perl coders
> are... and this is another Perl thing - so if yur interested catch up with
> Aaron.
> 
> This is for caching Object structures from the Database into a PHP
> definition file since they don't change often enough to warrant a query
> every time there's a page load.  Currently every page load is generating 3
> or 4 database queris just to determine the structure of the objects... I
> find this unnecisary - since after go live, this will happen rarely.
> 
> So - as I mentioned to Aaron previously - I'm thinking a perl script to
> query the DB and build a file PHP can include would be much better.  This
> include will simply define variables that contain object information.
> 
> Here is the way I think the variables should be built... and below are the
> querys that should work:
> 
> $OBJECT_TYPES[0 -?] = Array of valid Object Type ID's
> 
> $TYPE_PROPERTIES[ $OBJECT_TYPE[x] ]["Name"] =
> $TYPE_PROPERTIES[ $OBJECT_TYPE[x] ]["Desc"] =
> $TYPE_PROPERTIES[ $OBJECT_TYPE[x] ]["ValidChildren"] =
> $TYPE_PROPERTIES[ $OBJECT_TYPE[x] ]["Class"] = 
> $TYPE_PROPERTIES[ $OBJECT_TYPE[x] ]["DefaultActionID"] = 
> $TYPE_PROPERTIES[ $OBJECT_TYPE[x] ]["ExtensionTable"] =
> $TYPE_PROPERTIES[ $OBJECT_TYPE[x] ]["RenderPath"] =
> 
> $OBJECT_ACTIONS[ $OBJECT_TYPE[x] ] = Array of actions ID's for Object x
> 
> $ACTION_PROPERTIES[ ActionID ]["RenderFile"] =
> $ACTION_PROPERTIES[ ActionID ]["Name"] =
> $ACTION_PROPERTIES[ ActionID ]["Desc"] = 
> $ACTION_PROPERTIES[ ActionID ]["Image"] =
> 
> $OBJECT_PROPERTIES[ $OBJECT_TYPE[x] ] = Array of Property IDs for Object x
> 
> $PROPERTY_PROPERTIES[ PropertyID ]["Name"] =
> $PROPERTY_PROPERTIES[ PropertyID ]["FieldMap"] =
> $PROPERTY_PROPERTIES[ PropertyID ]["Type"] =
> 
> The SQL commands will be pretty easy.  I assume the difficult part is to
> get Perl to build the file *shrug*?
> 
> OK - the query to build $OBJECT_TYPES and $TYPE_PROPERTIES would be:
> select * from ObjectTypes;
> 
> Then just go through what's returned... 
> 
> To build $OBJECT_ACTIONS and $ACTION_PROPERTIES just do:
> select * from ObjectActions;
> 
> You'll build $OBJECT_ACTIONS by referencing ActionID and ObjectType in the
> records returned...
> 
> And you'll do the same for $OBJECT_PROPERTIES and $PROPERTY_PROPERTIES:
> select * from ObjectProperties;
> 
> and do it just like the actions...
> 
> If this isn't clear in anyway - especially the variable structure... lets
> talk...
> 
> This script would make my like SO much easier... and it would speed up the
> system incredibly.  This one script will eliminate 3 to 5 DB queries on
> EVERY page load.  Thats an incredible amount.  
> 
> So what are your thoughts on this?  Easy enough?  Comments and thoughts
> welcome and urged!
> 
> 
> 
> -- 
> Jason
> http://vodka.linuxkb.org/~chardros
> 

--
Aaron Turner, Core Developer       http://vodka.linuxkb.org/~aturner/
Linux Knowledge Base Organization  http://linuxkb.org/
Because world domination requires quality open documentation.