Re: Why there are so many 'DESCRIBE' when I enable debug model?

2009-03-16 Thread Martin Westin

Richard is right.
Describe does just that... describes the tables so that Cake can know
that Article should have a tltle field and that it contains up to 255
characters and so on and so on...
As Richard also writes this is cached but when you are in debug-mode
you are expected to alter the database every now and then and this way
you don't have to manually empty the cache every time you do that.



On Mar 16, 1:39 pm, Richard  wrote:
> My understanding is that this enables CakePHP Models to identify details
> about your schema. By extracting this metadata, the models can be further
> exploited by ohter areas in cake,  such as the helpers. The form helper, for
> example uses the metadata to automatically set size and limits on fields in
> the generated HTML.
>
> As far as I'm aware, this information is cached, in tmp/models/*. This cache
> is used when not in debug mode. Hopefully someone else may be able to
> confirm or correct me if I'm wrong.
>
> Richard
>
> On Mon, Mar 16, 2009 at 12:35 PM, joshua  wrote:
> > I find there is a sql which will took >17ms everytime when the action needs
> > authentication in ACL model. That means if I use ACL database model in my
> > application , there will always
> > be >17ms was taken.
> > Can someone give an explanation of this?
>
> > //sql
> > SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`, `Aco`.`foreign_key`,
> > `Aco`.`alias`
> > FROM `acos` AS `Aco` LEFT JOIN `acos` AS `Aco0` ON (`Aco0`.`alias` =
> > 'controllers')
> >  JOIN `acos` AS `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
> > `Aco0`.`rght`
> >  `Aco1`.`alias` = 'Users')
> > LEFT JOIN `acos` AS `Aco2` ON (`Aco2`.`lft` > `Aco1`.`lft` AND
> > `Aco2`.`rght` < `Aco1`.`rght`
> > AND `Aco2`.`alias` = 'activity')
> > WHERE ((`Aco`.`lft` <= `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`)
> > OR (`Aco`.`lft` <= `Aco2`.`lft` AND `Aco`.`rght` >= `Aco2`.`rght`))
> > ORDER BY `Aco`.`lft` DESC
> > //end
>
> > On Mon, Mar 16, 2009 at 8:22 PM, Joshua  wrote:
>
> >> As you can see, the 'describe' sql took (7+17+17) ms! Why they are
> >> there? Can I disable it?
>
> >> 1       DESCRIBE `aros`         7       7       7
> >> 2       DESCRIBE `acos`         7       7       17
> >> 3       DESCRIBE `aros_acos`    7       7       17
>
> > --
> > Thanks
> > Joshua
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Why there are so many 'DESCRIBE' when I enable debug model?

2009-03-16 Thread Richard
My understanding is that this enables CakePHP Models to identify details
about your schema. By extracting this metadata, the models can be further
exploited by ohter areas in cake,  such as the helpers. The form helper, for
example uses the metadata to automatically set size and limits on fields in
the generated HTML.

As far as I'm aware, this information is cached, in tmp/models/*. This cache
is used when not in debug mode. Hopefully someone else may be able to
confirm or correct me if I'm wrong.

Richard

On Mon, Mar 16, 2009 at 12:35 PM, joshua  wrote:

> I find there is a sql which will took >17ms everytime when the action needs
> authentication in ACL model. That means if I use ACL database model in my
> application , there will always
> be >17ms was taken.
> Can someone give an explanation of this?
>
> //sql
> SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`, `Aco`.`foreign_key`,
> `Aco`.`alias`
> FROM `acos` AS `Aco` LEFT JOIN `acos` AS `Aco0` ON (`Aco0`.`alias` =
> 'controllers')
>  JOIN `acos` AS `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
> `Aco0`.`rght`
>  `Aco1`.`alias` = 'Users')
> LEFT JOIN `acos` AS `Aco2` ON (`Aco2`.`lft` > `Aco1`.`lft` AND
> `Aco2`.`rght` < `Aco1`.`rght`
> AND `Aco2`.`alias` = 'activity')
> WHERE ((`Aco`.`lft` <= `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`)
> OR (`Aco`.`lft` <= `Aco2`.`lft` AND `Aco`.`rght` >= `Aco2`.`rght`))
> ORDER BY `Aco`.`lft` DESC
> //end
>
> On Mon, Mar 16, 2009 at 8:22 PM, Joshua  wrote:
>
>>
>> As you can see, the 'describe' sql took (7+17+17) ms! Why they are
>> there? Can I disable it?
>>
>>
>> 1   DESCRIBE `aros` 7   7   7
>> 2   DESCRIBE `acos` 7   7   17
>> 3   DESCRIBE `aros_acos`7   7   17
>>
>>
>
>
> --
> Thanks
> Joshua
>
> >
>

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



Re: Why there are so many 'DESCRIBE' when I enable debug model?

2009-03-16 Thread joshua
I find there is a sql which will took >17ms everytime when the action needs
authentication in ACL model. That means if I use ACL database model in my
application , there will always
be >17ms was taken.
Can someone give an explanation of this?

//sql
SELECT `Aco`.`id`, `Aco`.`parent_id`, `Aco`.`model`, `Aco`.`foreign_key`,
`Aco`.`alias`
FROM `acos` AS `Aco` LEFT JOIN `acos` AS `Aco0` ON (`Aco0`.`alias` =
'controllers')
 JOIN `acos` AS `Aco1` ON (`Aco1`.`lft` > `Aco0`.`lft` AND `Aco1`.`rght` <
`Aco0`.`rght`
 `Aco1`.`alias` = 'Users')
LEFT JOIN `acos` AS `Aco2` ON (`Aco2`.`lft` > `Aco1`.`lft` AND `Aco2`.`rght`
< `Aco1`.`rght`
AND `Aco2`.`alias` = 'activity')
WHERE ((`Aco`.`lft` <= `Aco0`.`lft` AND `Aco`.`rght` >= `Aco0`.`rght`)
OR (`Aco`.`lft` <= `Aco2`.`lft` AND `Aco`.`rght` >= `Aco2`.`rght`))
ORDER BY `Aco`.`lft` DESC
//end

On Mon, Mar 16, 2009 at 8:22 PM, Joshua  wrote:

>
> As you can see, the 'describe' sql took (7+17+17) ms! Why they are
> there? Can I disable it?
>
>
> 1   DESCRIBE `aros` 7   7   7
> 2   DESCRIBE `acos` 7   7   17
> 3   DESCRIBE `aros_acos`7   7   17
> >
>


-- 
Thanks
Joshua

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



Why there are so many 'DESCRIBE' when I enable debug model?

2009-03-16 Thread Joshua

As you can see, the 'describe' sql took (7+17+17) ms! Why they are
there? Can I disable it?


1   DESCRIBE `aros` 7   7   7
2   DESCRIBE `acos` 7   7   17
3   DESCRIBE `aros_acos`7   7   17
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---