very slow response from CakePHP when performing a simple query
Hi there, I am new to CakePHP and is trying to setup my first "Hello World" project. When working on that, I experienced a very slow response from CakePHP when performing a simple query to the DB. Here are the steps that I have done: 1. Download the CakePHP framework (2.3.0 RC1) 2. Create a Test DB with an empty table named "tests" inside it. 3. Edit the default AppController.php as following class AppController extends Controller { var $uses = array('Test'); function say_hello() { $this->Test->query("select * from test where id=0"); echo "hello"; } } After that, I accessed the link http://localhost/app/say_hello, it took more than 1 second to response. If I commented out the query statement as following: class AppController extends Controller { var $uses = array('Test'); function say_hello() { //$this->Test->query("select * from test where id=0"); echo "hello"; } } Then, the link http://localhost/app/say_hello only took around 60ms to response. This doesn't seems right to me as performing a very simple query on an empty table should not take 940ms. I also tried doing the debug with DebugKit and it showed that more than 1s of time were spending on the ControllerAction which is pretty simple in this case. I am not what is causing the slowness of the response here. Can any of the CakePHP experienced members shed me something on how to solve this slowness issue? Thanks, Quoc -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en.
Re: can someone please explain to me what {n} is?
thanks to both of you guys! On Feb 14, 12:22 am, su6z3r0 <[EMAIL PROTECTED]> wrote: > {n} is a placeholder for numbered keys in arrays. > > So this would translate into something like > > [1]['Role']['id'] > [2]['Role']['id'] > [3]['Role']['id'] > . > . > . > > Check this > page:http://www.thinkingphp.org/2007/02/24/cake-12s-set-class-eats-arrays-... > > Felix explains how tho use Set::extract which also uses the {n} syntax > > HTH, > Alex > > On Feb 14, 1:55 am, quoc <[EMAIL PROTECTED]> wrote: > > > In the cake manual this is an example of the generateList function: > > > $this->set( > > 'Roles', > > $this->Role->generateList(null, 'role_name ASC', null, > > '{n}.Role.id', '{n}.Role.role_name') > > ); > > > I see this around a lot {n}.Role.id but I can't seem to figure out > > what the {n} means. I've been trying to search for it but I can't find > > anything on it. > > > thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
can someone please explain to me what {n} is?
In the cake manual this is an example of the generateList function: $this->set( 'Roles', $this->Role->generateList(null, 'role_name ASC', null, '{n}.Role.id', '{n}.Role.role_name') ); I see this around a lot {n}.Role.id but I can't seem to figure out what the {n} means. I've been trying to search for it but I can't find anything on it. thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---