PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2_Schema » Bug #8288

updateDatabase() fully compares XML files; a date check would be faster

Details

Request #8288updateDatabase() fully compares XML files; a date check would be faster
Submitted2006-07-25 17:10 UTC
Fromme at ben-xo dot com
StatusSuspended
PackageMDB2_Schema
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2006-07-25 17:10 UTC] me at ben-xo dot com

Description:
------------
MDB2_Schema:updateDatabase() work flow appears to be like so:

load and parse file $current_schema
load and parse file $previous_schema
compare them to to generate a set of changes
changes?
yes:
> return immediately
no:
> update database to new schema
> copy new schema over old schema

if I want to use MDB2_Schema to automatically keep my database in sync with my definitions, then i will be calling updateDatabase() on every execution of my script. However, this means that 2 complete XML parse and 1 tree compare every time, when 999/1000 there will be changes to the schema.

Expected result:
----------------
suggested workflow:
file modification date (filemtime) comparison of both file
"current" newer than "previous"?
yes:
> load and parse file $current_schema
> load and parse file $previous_schema
> compare them to to generate a set of changes
> changes?
> yes:
>> update database to new schema
> copy new schema over old schema

now, 999 times out of 1000, we only have to do 2 lots of stat() and one simple comparison.

[2006-07-25 17:14 UTC] me at ben-xo dot com

Description:
------------

if I want to use MDB2_Schema to automatically keep my database in sync
with my definitions, then i will be calling updateDatabase() on every
execution of my script. However, this means that 2 complete XML parse
and 1 tree compare will take place every time, when 999 times out of 1000 there will be no changes to
the schema.

MDB2_Schema:updateDatabase() work flow appears to be like so:

load and parse file $current_schema
load and parse file $previous_schema
compare them to generate a set of changes
changes?
yes:
> return immediately
no:
> update database to new schema
> copy new schema over old schema

Expected result:
----------------
suggested workflow:
file modification date (filemtime) comparison of both file
"current" newer than "previous"?
yes:
> load and parse file $current_schema
> load and parse file $previous_schema
> compare them to generate a set of changes
> changes?
> yes:
>> update database to new schema
> copy new schema over old schema

now, 999 times out of 1000, we only have to do 2 lots of stat() and one
simple comparison.

[2006-07-25 17:15 UTC] me at ben-xo dot com

ugh i clicked on "Edit Submission", not add comment. PEAR's bug tracking system seems to be kinda broken. >:E

anyway... the 2nd post is more readable than the first, but says the same thing