Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
1e0e5f02
Commit
1e0e5f02
authored
Dec 28, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed DB query logging category.
parent
4d9d4cb1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
DbPanel.php
extensions/yii/debug/panels/DbPanel.php
+1
-1
Command.php
framework/yii/db/Command.php
+6
-6
No files found.
extensions/yii/debug/panels/DbPanel.php
View file @
1e0e5f02
...
@@ -117,7 +117,7 @@ EOD;
...
@@ -117,7 +117,7 @@ EOD;
public
function
save
()
public
function
save
()
{
{
$target
=
$this
->
module
->
logTarget
;
$target
=
$this
->
module
->
logTarget
;
$messages
=
$target
->
filterMessages
(
$target
->
messages
,
Logger
::
LEVEL_PROFILE
,
[
'yii\db\Command::query
Internal
'
]);
$messages
=
$target
->
filterMessages
(
$target
->
messages
,
Logger
::
LEVEL_PROFILE
,
[
'yii\db\Command::query
'
,
'yii\db\Command::execute
'
]);
return
[
'messages'
=>
$messages
];
return
[
'messages'
=>
$messages
];
}
}
}
}
framework/yii/db/Command.php
View file @
1e0e5f02
...
@@ -368,7 +368,7 @@ class Command extends \yii\base\Component
...
@@ -368,7 +368,7 @@ class Command extends \yii\base\Component
$db
=
$this
->
db
;
$db
=
$this
->
db
;
$rawSql
=
$this
->
getRawSql
();
$rawSql
=
$this
->
getRawSql
();
Yii
::
info
(
$rawSql
,
__METHOD__
);
Yii
::
info
(
$rawSql
,
'yii\db\Command::query'
);
/** @var \yii\caching\Cache $cache */
/** @var \yii\caching\Cache $cache */
if
(
$db
->
enableQueryCache
&&
$method
!==
''
)
{
if
(
$db
->
enableQueryCache
&&
$method
!==
''
)
{
...
@@ -383,14 +383,14 @@ class Command extends \yii\base\Component
...
@@ -383,14 +383,14 @@ class Command extends \yii\base\Component
$rawSql
,
$rawSql
,
];
];
if
((
$result
=
$cache
->
get
(
$cacheKey
))
!==
false
)
{
if
((
$result
=
$cache
->
get
(
$cacheKey
))
!==
false
)
{
Yii
::
trace
(
'Query result served from cache'
,
__METHOD__
);
Yii
::
trace
(
'Query result served from cache'
,
'yii\db\Command::query'
);
return
$result
;
return
$result
;
}
}
}
}
$token
=
$rawSql
;
$token
=
$rawSql
;
try
{
try
{
Yii
::
beginProfile
(
$token
,
__METHOD__
);
Yii
::
beginProfile
(
$token
,
'yii\db\Command::query'
);
$this
->
prepare
();
$this
->
prepare
();
$this
->
pdoStatement
->
execute
();
$this
->
pdoStatement
->
execute
();
...
@@ -405,16 +405,16 @@ class Command extends \yii\base\Component
...
@@ -405,16 +405,16 @@ class Command extends \yii\base\Component
$this
->
pdoStatement
->
closeCursor
();
$this
->
pdoStatement
->
closeCursor
();
}
}
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
endProfile
(
$token
,
'yii\db\Command::query'
);
if
(
isset
(
$cache
,
$cacheKey
)
&&
$cache
instanceof
Cache
)
{
if
(
isset
(
$cache
,
$cacheKey
)
&&
$cache
instanceof
Cache
)
{
$cache
->
set
(
$cacheKey
,
$result
,
$db
->
queryCacheDuration
,
$db
->
queryCacheDependency
);
$cache
->
set
(
$cacheKey
,
$result
,
$db
->
queryCacheDuration
,
$db
->
queryCacheDependency
);
Yii
::
trace
(
'Saved query result in cache'
,
__METHOD__
);
Yii
::
trace
(
'Saved query result in cache'
,
'yii\db\Command::query'
);
}
}
return
$result
;
return
$result
;
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
Yii
::
endProfile
(
$token
,
__METHOD__
);
Yii
::
endProfile
(
$token
,
'yii\db\Command::query'
);
if
(
$e
instanceof
Exception
)
{
if
(
$e
instanceof
Exception
)
{
throw
$e
;
throw
$e
;
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment