I've got a DB with legacy data and column names, and because other
applications (currently) use it, we're sticking with the DB naming
conventions (which is, of course, totally non-Cake). So, its not an
option to change the DB naming convention, and its not an option to
not use Cake. :)

One of the conventions in our DB is a table name prefix - all tables
have a unique prefix that is used for the table name and its column.
So, for example, our user table is usr_user, and the login column is
usr_login. It would be really nice to be able to refer to usr_login as
login

Thanks to some direction from nate, I have a good solution for
automagicly saving custom created and updated column names. But thats
just Now for the fun part. I was looking at using beforeFind(),
afterFind(), beforeSave() and afterSave() to convert my schema to the
non-prefixed schema on the fly. So the beforeFind() would look through
all the conditions and such to convert any non-prefixed column names
to their prefixed equivalent, the afterFind() would convert the
retrieved prefixed data to its non-prefixed version, the beforeSave()
would convert non-prefixed data to prefixed, and the afterSave() would
convert any prefixed results to non-prefixed. Whew. Seems like a lot
of work, but considering all the tables we have and all the usr_ and
pat_ and cat_ and upr_ and such that would be littered throughout the
code, it might be worth it.

Then a different throught struck me - we're using mySQL 5.x, and we
can use views. Views are (theoretically) readable AND writable. I
don't know much about views in mysql. Could I just define a view for
each table that maps the prefixed column names to the non-prefixed
columns (and even the non-cake convention table names to names that
match the cake conventions) and call it a day? Is that totally stupid?
Would that kill performance?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to