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
478380fb
Commit
478380fb
authored
Jul 11, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed test brak.
parent
c16e5e42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletion
+17
-1
Schema.php
extensions/sphinx/Schema.php
+11
-0
Schema.php
framework/db/Schema.php
+6
-1
No files found.
extensions/sphinx/Schema.php
View file @
478380fb
...
@@ -518,4 +518,15 @@ class Schema extends Object
...
@@ -518,4 +518,15 @@ class Schema extends Object
throw
new
Exception
(
$message
,
$errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
throw
new
Exception
(
$message
,
$errorInfo
,
(
int
)
$e
->
getCode
(),
$e
);
}
}
}
}
/**
* Returns a value indicating whether a SQL statement is for read purpose.
* @param string $sql the SQL statement
* @return boolean whether a SQL statement is for read purpose.
*/
public
function
isReadQuery
(
$sql
)
{
$pattern
=
'/^\s*(SELECT|SHOW|DESCRIBE)\b/i'
;
return
preg_match
(
$pattern
,
$sql
)
>
0
;
}
}
}
framework/db/Schema.php
View file @
478380fb
...
@@ -520,9 +520,14 @@ abstract class Schema extends Object
...
@@ -520,9 +520,14 @@ abstract class Schema extends Object
}
}
}
}
/**
* Returns a value indicating whether a SQL statement is for read purpose.
* @param string $sql the SQL statement
* @return boolean whether a SQL statement is for read purpose.
*/
public
function
isReadQuery
(
$sql
)
public
function
isReadQuery
(
$sql
)
{
{
$pattern
=
'/^\s*(SELECT|SHOW|DESCRIBE)\b/i'
;
$pattern
=
'/^\s*(SELECT|SHOW|DESCRIBE)\b/i'
;
return
preg_match
(
$pattern
,
$sql
);
return
preg_match
(
$pattern
,
$sql
)
>
0
;
}
}
}
}
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