Hello,
on 09/19/2008 01:13 AM nixanz said the following:
> 1 PrepareQuery: UPDATE inventory_item SET notes=?, mandatory=?,
> shared=?, calculation=?, sort=?, description=?, grams=?, item=?,
> inventory=? WHERE id=?
> 1 Query: UPDATE inventory_item SET notes='', mandatory='N',
> shared='N', calculation='', sort=1, description='', grams=, item=10,
> inventory=75 WHERE id=792
> 1 Query error: You have an error in your SQL syntax; check the manual
> that corresponds to your MySQL server version for the right syntax to
> use near ' item=10, inventory=75 WHERE id=792' at line 1
>
> You can clearly see that the 'grams' field in the 'PrepareQuery' is
> '?' (ie, 'grams' has not yet been defined for this object), but in the
> 'Query' line below that, the 'grams' is simply blank. I was under the
> impression that Metastorage should be making it a 'NULL'.
>
> Is this what is supposed to happen?
>
> Or do I have to manually check each and every field every time before
> I 'persist'?
If the variable can be set to NULL, it means it is optional. Are you
defining it as <optional>1</optional> ?
The generated class should fail the persist function if you do not set
it to optional and you do not initialize its value. Are you assigning
the variable value to something?
--
Regards,
Manuel Lemos
Find and post PHP jobs
http://www.phpclasses.org/jobs/
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/