What is your save query, and what is the SQL generated?

When saving using the standard Model->save() syntax, the data provided
is assumed to be unquoted - and will automatically be made safe for
SQL.

$this->Model->save(
        array('Model'=>array(
                'field1' => "'value'",
                'field2' => 'value',
        ))
);

will save field1 to 'value' (with quotes), and field2 to value (no
quotes).


On Jul 8, 1:32 am, "Nirav Mehta" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a problem escaping quotes in my SQL queries. I initially assumed that
> cakePHP's implementation for postgres in cake/libs/model/dbo_postgres.php
> escapes all data strings using pg_escape_string(). I have a string which is
> already in single quotes. I am supplying that to the model->save() function
> expecting that cake will take care of the rest. But the query fails because
> of the quotes.
>
> I know this is a very common issue and I tried everything (addslashes, etc.)
> but cant kind a way out. Please let me know if I am missig something.
>
> - Nirav
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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