Yii Framework Forum: SQL Debugging.. - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

SQL Debugging.. Rate Topic: -----

#1 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 12 September 2009 - 04:34 PM

I am trying out the nestedset extension only now I get a error:

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: Syntax error or access violation: 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 '>= '0' AND right <= '1' ORDER BY left ASC' at line 1


How do I set it so debugging shows the entire query ?
0

#2 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 12 September 2009 - 06:00 PM

First of all enable logging.

Add to protected/config/main.php,
to the 'components' section (e.g. for web and file logging):
  'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
      array(
        'class'=>'CWebLogRoute',  'levels'=>'trace, info, error, warning',
      ),
      array(
        'class'=>'CFileLogRoute',  'levels'=>'trace, info, error, warning',
      ),
    )
  )


to the 'preload' section:
  'preload'=>array('log'),


File logging to protected/runtime/application.log

/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#3 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 13 September 2009 - 02:32 AM

Ah thanks works very good :D I see can add..

'categories' => 'system.db.*',

To have it log only database ^^


View Posttri, on 12 September 2009 - 06:00 PM, said:

First of all enable logging.

Add to protected/config/main.php,
to the 'components' section (e.g. for web and file logging):
  'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
      array(
        'class'=>'CWebLogRoute',  'levels'=>'trace, info, error, warning',
      ),
      array(
        'class'=>'CFileLogRoute',  'levels'=>'trace, info, error, warning',
      ),
    )
  )


to the 'preload' section:
  'preload'=>array('log'),


File logging to protected/runtime/application.log

/Tommy

0

#4 User is offline   mech7 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 220
  • Joined: 26-March 09

Posted 16 September 2009 - 04:27 AM

is there a way to log insert queries too? I have a query that is succesfull... but some fields do not get updated..
0

#5 User is offline   augustin 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 07-April 10

Posted 08 April 2010 - 03:08 PM

is there?

View Postmech7, on 16 September 2009 - 04:27 AM, said:

is there a way to log insert queries too? I have a query that is succesfull... but some fields do not get updated..

0

#6 User is offline   augustin 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 07-April 10

Posted 14 April 2010 - 05:17 AM

just set logging traces to file. add to config/main.php

'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'trace, info, error, warning',
),
0

#7 User is offline   Backslider 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 292
  • Joined: 23-July 09

Posted 31 December 2011 - 01:16 PM

View Posttri, on 12 September 2009 - 06:00 PM, said:

First of all enable logging.

Add to protected/config/main.php,
to the 'components' section (e.g. for web and file logging):
  'log'=>array(
    'class'=>'CLogRouter',
    'routes'=>array(
      array(
        'class'=>'CWebLogRoute',  'levels'=>'trace, info, error, warning',
      ),
      array(
        'class'=>'CFileLogRoute',  'levels'=>'trace, info, error, warning',
      ),
    )
  )


to the 'preload' section:
  'preload'=>array('log'),


File logging to protected/runtime/application.log

/Tommy


This works just fine on the front end, however I see nothing when viewing pages in a module.

How do I turn this on for my module?
We were all once expert at....... nothing.

yii-language-behavior

My Blog
0

#8 User is offline   Backslider 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 292
  • Joined: 23-July 09

Posted 31 December 2011 - 01:37 PM

View PostBackslider, on 31 December 2011 - 01:16 PM, said:

This works just fine on the front end, however I see nothing when viewing pages in a module.

How do I turn this on for my module?



Ignore that.... it is working in my module.

BUT.... it does nothing when loading CGridView using filters.

How can I see database queries when filtering in CGridview?
We were all once expert at....... nothing.

yii-language-behavior

My Blog
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users