Re: making cake sql-function-aware?

2006-11-09 Thread Chris Hartjes

On 11/9/06, sbarre <[EMAIL PROTECTED]> wrote:
>
>
> I've been digging around in the archives with searches and I've come
> across a few people who have this problem, namely dealing with the
> CakePHP saving routines that aren't DB-keyword-aware..
>
> By this I mean the quoting of NULL and the inability to use functions
> like PASSWORD() and other database functions.
>
> I appreciate that there are PHP-specific solutions to the PASSWORD()
> problem but I would like my MySQL data to be a bit more portable than
> that, and not rely on business-logic-level methods to operate on.

Well, if you start using MySQL-specific function calls then you've
pretty much guaranteed that you can't ever move your data to another
database like PostgreSQL or Oracle or whatever without a lot of major
work.

Being a path-of-least-resistance guy I'd rather go with custom SQL
than monkey around with patches to the model class.  Besides, you can
always create your own models that use the MySQL functions themselves
and return data in a format you can easily manipuate.

Maybe not the answer you were hoping for, but I hope it helps.  It has
been my experience that once you tie yourself to a particular database
server you can never go back.




-- 
Chris Hartjes

"The greatest inefficiencies come from solving problems you will never have."
-- Rasmus Lerdorf

@TheBallpark - http://www.littlehart.net/attheballpark
@TheKeyboard - http://www.littlehart.net/atthekeyboard

--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---



making cake sql-function-aware?

2006-11-09 Thread sbarre


I've been digging around in the archives with searches and I've come
across a few people who have this problem, namely dealing with the
CakePHP saving routines that aren't DB-keyword-aware..

By this I mean the quoting of NULL and the inability to use functions
like PASSWORD() and other database functions.

I appreciate that there are PHP-specific solutions to the PASSWORD()
problem but I would like my MySQL data to be a bit more portable than
that, and not rely on business-logic-level methods to operate on.

I would also like to have a more generic solution that is future-proof
in case I want to use other MySQL functions in the future (which I can
abstract if necessary)..

So I'm wondering if anyone out there has come up with solutions for
this problem?  I know that phpMyAdmin just maintains an array of MySQL
keywords and method names so it can intelligently quote..  This is also
the approach I took in a previous project..

It would involve patching the value() method in the appropriate
DboSource subclass (dbo_mysqli in my case)..

The sloppy solution I can thin of is to stick a call in beforeSave()
that does an execute() call to retrieve a SELECT call with the password
and then stick that in there..  but why use up another query if it can
be avoided..

thoughts?


--~--~-~--~~~---~--~~
 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
-~--~~~~--~~--~--~---