i didnt't realize why the use of views should a) be not portable and b) not indexable
? nearly every database supports views, so i could't see a problem there. and the columns listed in a view of course might be indexed in the underlaying table. the only problem i see is that you might not be able to insert data into views. in oracle that's possible, but you had to write an instead of-trigger for each view. don't know if mysql supports tha. but if you want to create a readonly interface to oyur database table with cake, i can see no problem in using views. On 12 Jan., 02:25, Robby Anderson <[EMAIL PROTECTED]> wrote: > After deciding mysql views won't work - well, technically they will, > but its a not good solution - not portable (mysql only), not scalable > (no indexing) and in general a risky proposition - I'm now on a new > hunt: how to use Cake callbacks to support a $columnPrefix field in my > models. Why? I have a legacy database to work with where each table's > columns have a consistent column name prefix (ie, all tables in user > start with usr_) and while Cake easily supports that, I want to use > pretty syntax and clean code. Instead of being littered with usr_login > and usr_first_name and such, I want login and first_name and other > nice clean stuff. > > Am I crazy? Is this a silly, fruitless quest? Will converting data > back and forth kill my performance more than using mysql views, no > indexes and all? Is this just worthless, and should I just use my > prefixed columns? I dunno, I dunno. But I'm game to find out. (And if > you have answers for any of those questions ... I'm game to hear > those, too.) > > So, my first trick was to parse the results of a find and strip them > out using everyone's best friend afterFind(). Here are the first > generation, brute force results that work on basic models and > associations (haven't tested it very deeply > yet):http://bin.cakephp.org/saved/27230 > > If you have comments about ways to optimize this, I'm all ears. Beyond > that, here are the other steps as I see them: > > * Use the prefixStripper() in afterSave() to convert the data returned > from saves. > > * Make beforeFind() and beforeSave() parse all the input parameters, > and convert any non-prefixed column names into prefixed column names. > These I suspect will be the harder ones to code to catch all the > various cases. > > Again I ask, is this a waste of time, or is this a useful endeavor? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---