Re: String 'NULL' inserted instead of value NULL with ACL, MSSQL. Help?

2009-03-11 Thread George

I found what so far seems like a temporary fix for this issue. It's
probably not ideal, but the only drawback I think would be if you
wanted to actually insert the string 'NULL', you can't after this fix.

On line 278 in cake/libs/model/datasources/dbo/dbo_mssql.php, change:

if (in_array($column, array('integer', 'float', 'binary')) &&
is_numeric($data)) {

to

if ((in_array($column, array('integer', 'float', 'binary')) &&
is_numeric($data)) || $data == 'NULL') {

Now, if $data is NULL, it will get caught in this conditional and
return without enclosing single quotes. I suppose you could change the
last part to strtolower($data) == 'null' to catch any form of NULL
instead.



On Mar 11, 9:04 am, George  wrote:
> I've been grinding away with ACL on a project, and I'm running into
> what appears to be a bug with the ACL code and dbo_mssql.php.
> Basically inserting new aco records fail due to cake generating
> incorrect SQL code (it puts single quotes around a NULL, thus
> inserting the string "NULL", not NULL itself). I found this ticket
> (https://trac.cakephp.org/ticket/6024) in the trac which is basically
> exactly what's happening to me as well. It appears this hasn't been
> fixed in the latest nightly though, and I was wondering if anyone had
> an idea on how to apply a fix until the bug has been resolved. I also
> found an older reported bug that appears to be the same thing (https://
> trac.cakephp.org/ticket/5381).
>
> I've been digging in libs/model/datasources/dbo/dbo_mssql.php, and
> libs/model/db_acl.php, but haven't been able to see where the quotes
> are being applied to the NULL value. My guess is there just needs to
> be an extra conditional to check for a null value and not apply quotes
> in that case. If anyone knows where this can be resolved, that would
> be awesome.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



String 'NULL' inserted instead of value NULL with ACL, MSSQL. Help?

2009-03-11 Thread George

I've been grinding away with ACL on a project, and I'm running into
what appears to be a bug with the ACL code and dbo_mssql.php.
Basically inserting new aco records fail due to cake generating
incorrect SQL code (it puts single quotes around a NULL, thus
inserting the string "NULL", not NULL itself). I found this ticket
(https://trac.cakephp.org/ticket/6024) in the trac which is basically
exactly what's happening to me as well. It appears this hasn't been
fixed in the latest nightly though, and I was wondering if anyone had
an idea on how to apply a fix until the bug has been resolved. I also
found an older reported bug that appears to be the same thing (https://
trac.cakephp.org/ticket/5381).

I've been digging in libs/model/datasources/dbo/dbo_mssql.php, and
libs/model/db_acl.php, but haven't been able to see where the quotes
are being applied to the NULL value. My guess is there just needs to
be an extra conditional to check for a null value and not apply quotes
in that case. If anyone knows where this can be resolved, that would
be awesome.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---