How to print query...

2008-10-22 Thread xelios

I've an error in my sql query. How can I print query for debugging
purposes.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to print query...

2008-10-22 Thread Amit Badkas
2008/10/22 xelios [EMAIL PROTECTED]


 I've an error in my sql query. How can I print query for debugging
 purposes.


- If the debug setting is greater than 1 then SQL queries will get outputted
at the bottom of page

-- 
Amit

http://amitrb.wordpress.com/
http://coppermine-gallery.net/
http://cheesecake-photoblog.org/
http://www.sanisoft.com/blog/author/amitbadkas

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to print query...

2008-10-22 Thread [EMAIL PROTECTED]

app/config/core.php - the first line of code.

---
/**
 * CakePHP Debug Level:
 *
 * Production Mode:
 *  0: No error messages, errors, or warnings shown. Flash messages
redirect.
 *
 * Development Mode:
 *  1: Errors and warnings shown, model caches refreshed, flash
messages halted.
 *  2: As in 1, but also with full debug messages and SQL output.
 *  3: As in 2, but also with full controller dump.
 *
 * In production mode, flash messages redirect after a time interval.
 * In development mode, you need to click the flash message to
continue.
 */
---


On Oct 22, 12:20 pm, xelios [EMAIL PROTECTED] wrote:
 I've an error in my sql query. How can I print query for debugging
 purposes.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to print query...

2008-10-22 Thread xelios

My debug line is as follows:
Configure::write('debug', 2);

but still its not showing queries


On Oct 22, 3:24 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 app/config/core.php - the first line of code.

 ---
 /**
  * CakePHP Debug Level:
  *
  * Production Mode:
  *      0: No error messages, errors, or warnings shown. Flash messages
 redirect.
  *
  * Development Mode:
  *      1: Errors and warnings shown, model caches refreshed, flash
 messages halted.
  *      2: As in 1, but also with full debug messages and SQL output.
  *      3: As in 2, but also with full controller dump.
  *
  * In production mode, flash messages redirect after a time interval.
  * In development mode, you need to click the flash message to
 continue.
  */
 ---

 On Oct 22, 12:20 pm, xelios [EMAIL PROTECTED] wrote:

  I've an error in my sql query. How can I print query for debugging
  purposes.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to print query...

2008-10-22 Thread phpcurious

if you don't see any debug dump, that could have been due to your
$cakeDebug is either empty or not in default.ctp layout

On Oct 22, 6:38 pm, xelios [EMAIL PROTECTED] wrote:
 My debug line is as follows:
 Configure::write('debug', 2);

 but still its not showing queries

 On Oct 22, 3:24 pm, [EMAIL PROTECTED]

 [EMAIL PROTECTED] wrote:
  app/config/core.php - the first line of code.

  ---
  /**
   * CakePHP Debug Level:
   *
   * Production Mode:
   *      0: No error messages, errors, or warnings shown. Flash messages
  redirect.
   *
   * Development Mode:
   *      1: Errors and warnings shown, model caches refreshed, flash
  messages halted.
   *      2: As in 1, but also with full debug messages and SQL output.
   *      3: As in 2, but also with full controller dump.
   *
   * In production mode, flash messages redirect after a time interval.
   * In development mode, you need to click the flash message to
  continue.
   */
  ---

  On Oct 22, 12:20 pm, xelios [EMAIL PROTECTED] wrote:

   I've an error in my sql query. How can I print query for debugging
   purposes.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to print query...

2008-10-22 Thread xelios

Following is the out put of my error:
/
*/
Warning (512): SQL Error: 1064: 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 'addStar' at line 1 [CORE\cake\libs\model
\datasources\dbo_source.php, line 521]

Code | Context

$sql=   addStar
$error  =   1064: 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 'addStar' at line 1
$out=   null

$out = null;
if ($error) {
trigger_error(span style = \color:Red;text-
align:left\bSQL Error:/b {$this-error}/span,
E_USER_WARNING);

DboSource::showQuery() - CORE\cake\libs\model\datasources
\dbo_source.php, line 521
DboSource::execute() - CORE\cake\libs\model\datasources
\dbo_source.php, line 208
DboSource::fetchAll() - CORE\cake\libs\model\datasources
\dbo_source.php, line 344
DboSource::query() - CORE\cake\libs\model\datasources\dbo_source.php,
line 305
Model::call__() - CORE\cake\libs\model\model.php, line 404
Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 59
AppModel::addStar() - [internal], line ??
BooksController::star() - APP\controllers\books_controller.php, line
65
Object::dispatchMethod() - CORE\cake\libs\object.php, line 116
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 259
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 213
[main] - APP\webroot\index.php, line 90

Query: addStar

Warning (2): Cannot modify header information - headers already sent
by (output started at C:\xampp\htdocs\cake12\CakePHP\cake\basics.php:
111) [CORE\cake\libs\controller\controller.php, line 587]

Code | Context

$status =   Location: http://localhost/cake12/CakePHP/books;

header - [internal], line ??
Controller::header() - CORE\cake\libs\controller\controller.php, line
587
Controller::redirect() - CORE\cake\libs\controller\controller.php,
line 568
BooksController::star() - APP\controllers\books_controller.php, line
68
Object::dispatchMethod() - CORE\cake\libs\object.php, line 116
Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 259
Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 213
[main] - APP\webroot\index.php, line 90

(default) 1 query took 0 ms Nr  Query   Error   AffectedNum. rows   
Took
(ms)
1   addStar 1064: 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 'addStar' at line 10

/
*/


BUT I WANT TO SEE ACTUAL QUERY EXECUTED.






On Oct 22, 3:47 pm, phpcurious [EMAIL PROTECTED] wrote:
 if you don't see any debug dump, that could have been due to your
 $cakeDebug is either empty or not in default.ctp layout

 On Oct 22, 6:38 pm, xelios [EMAIL PROTECTED] wrote:

  My debug line is as follows:
  Configure::write('debug', 2);

  but still its not showing queries

  On Oct 22, 3:24 pm, [EMAIL PROTECTED]

  [EMAIL PROTECTED] wrote:
   app/config/core.php - the first line of code.

   ---
   /**
    * CakePHP Debug Level:
    *
    * Production Mode:
    *      0: No error messages, errors, or warnings shown. Flash messages
   redirect.
    *
    * Development Mode:
    *      1: Errors and warnings shown, model caches refreshed, flash
   messages halted.
    *      2: As in 1, but also with full debug messages and SQL output.
    *      3: As in 2, but also with full controller dump.
    *
    * In production mode, flash messages redirect after a time interval.
    * In development mode, you need to click the flash message to
   continue.
    */
   ---

   On Oct 22, 12:20 pm, xelios [EMAIL PROTECTED] wrote:

I've an error in my sql query. How can I print query for debugging
purposes.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to print query...

2008-10-22 Thread Gonzalo Servat
On Wed, Oct 22, 2008 at 8:51 AM, xelios [EMAIL PROTECTED] wrote:


 Following is the out put of my error:
 /

 */
 Warning (512): SQL Error: 1064: 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 'addStar' at line 1 [CORE\cake\libs\model
 \datasources\dbo_source.php, line 521]

 Code | Context

 $sql=   addStar
 $error  =   1064: 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 'addStar' at line 1
 $out=   null

[..snip..]

From reading the log, it looks like the query executed is just 'addStar' ??

- Gonzalo

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: How to print query...

2008-10-22 Thread Adam Royle

The query executed is there... it just doesn't look like a regular
query.

Query: addStar

I'm guessing you've got a $this-Book-addStar() call but haven't
defined the addStar()  method??

This happens because cakephp automatically executes a query by the
same name of the method, assuming it's a stored procedure. Can be very
confusing if you don't know this already.

Cheers,
Adam


On Oct 22, 8:51 pm, xelios [EMAIL PROTECTED] wrote:
 Following is the out put of my error:
 /
 */
 Warning (512): SQL Error: 1064: 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 'addStar' at line 1 [CORE\cake\libs\model
 \datasources\dbo_source.php, line 521]

 Code | Context

 $sql    =       addStar
 $error  =       1064: 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 'addStar' at line 1
 $out    =       null

             $out = null;
             if ($error) {
                 trigger_error(span style = \color:Red;text-
 align:left\bSQL Error:/b {$this-error}/span,
 E_USER_WARNING);

 DboSource::showQuery() - CORE\cake\libs\model\datasources
 \dbo_source.php, line 521
 DboSource::execute() - CORE\cake\libs\model\datasources
 \dbo_source.php, line 208
 DboSource::fetchAll() - CORE\cake\libs\model\datasources
 \dbo_source.php, line 344
 DboSource::query() - CORE\cake\libs\model\datasources\dbo_source.php,
 line 305
 Model::call__() - CORE\cake\libs\model\model.php, line 404
 Overloadable::__call() - CORE\cake\libs\overloadable_php5.php, line 59
 AppModel::addStar() - [internal], line ??
 BooksController::star() - APP\controllers\books_controller.php, line
 65
 Object::dispatchMethod() - CORE\cake\libs\object.php, line 116
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 259
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 213
 [main] - APP\webroot\index.php, line 90

 Query: addStar

 Warning (2): Cannot modify header information - headers already sent
 by (output started at C:\xampp\htdocs\cake12\CakePHP\cake\basics.php:
 111) [CORE\cake\libs\controller\controller.php, line 587]

 Code | Context

 $status =       Location:http://localhost/cake12/CakePHP/books;

 header - [internal], line ??
 Controller::header() - CORE\cake\libs\controller\controller.php, line
 587
 Controller::redirect() - CORE\cake\libs\controller\controller.php,
 line 568
 BooksController::star() - APP\controllers\books_controller.php, line
 68
 Object::dispatchMethod() - CORE\cake\libs\object.php, line 116
 Dispatcher::_invoke() - CORE\cake\dispatcher.php, line 259
 Dispatcher::dispatch() - CORE\cake\dispatcher.php, line 213
 [main] - APP\webroot\index.php, line 90

 (default) 1 query took 0 ms Nr  Query   Error   Affected        Num. rows     
   Took
 (ms)
 1       addStar 1064: 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 'addStar' at line 1                    0

 /
 */

 BUT I WANT TO SEE ACTUAL QUERY EXECUTED.

 On Oct 22, 3:47 pm, phpcurious [EMAIL PROTECTED] wrote:

  if you don't see any debug dump, that could have been due to your
  $cakeDebug is either empty or not in default.ctp layout

  On Oct 22, 6:38 pm, xelios [EMAIL PROTECTED] wrote:

   My debug line is as follows:
   Configure::write('debug', 2);

   but still its not showing queries

   On Oct 22, 3:24 pm, [EMAIL PROTECTED]

   [EMAIL PROTECTED] wrote:
app/config/core.php - the first line of code.

---
/**
 * CakePHP Debug Level:
 *
 * Production Mode:
 *      0: No error messages, errors, or warnings shown. Flash messages
redirect.
 *
 * Development Mode:
 *      1: Errors and warnings shown, model caches refreshed, flash
messages halted.
 *      2: As in 1, but also with full debug messages and SQL output.
 *      3: As in 2, but also with full controller dump.
 *
 * In production mode, flash messages redirect after a time interval.
 * In development mode, you need to click the flash message to
continue.
 */
---

On Oct 22, 12:20 pm, xelios [EMAIL PROTECTED] wrote:

 I've an error in my sql query. How can I print query for debugging
 purposes.
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---