Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
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
Yeray Santana Hualde
syncEnrollments
Commits
4737c6d8
Commit
4737c6d8
authored
Jan 21, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #244 from codler/patch-7
DB::raw should have higher precedence than alias
parents
8e5c7363
b158a7a4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
grammar.php
laravel/database/grammar.php
+5
-5
No files found.
laravel/database/grammar.php
View file @
4737c6d8
...
@@ -17,6 +17,11 @@ abstract class Grammar {
...
@@ -17,6 +17,11 @@ abstract class Grammar {
*/
*/
public
function
wrap
(
$value
)
public
function
wrap
(
$value
)
{
{
// Expressions should be injected into the query as raw strings,
// so we do not want to wrap them in any way. We'll just return
// the string value from the expression to be included.
if
(
$value
instanceof
Expression
)
return
$value
->
get
();
// If the value being wrapped contains a column alias, we need to
// If the value being wrapped contains a column alias, we need to
// wrap it a little differently as each segment must be wrapped
// wrap it a little differently as each segment must be wrapped
// and not the entire string. We'll split the value on the "as"
// and not the entire string. We'll split the value on the "as"
...
@@ -28,11 +33,6 @@ abstract class Grammar {
...
@@ -28,11 +33,6 @@ abstract class Grammar {
return
$this
->
wrap
(
$segments
[
0
])
.
' AS '
.
$this
->
wrap
(
$segments
[
2
]);
return
$this
->
wrap
(
$segments
[
0
])
.
' AS '
.
$this
->
wrap
(
$segments
[
2
]);
}
}
// Expressions should be injected into the query as raw strings,
// so we do not want to wrap them in any way. We'll just return
// the string value from the expression to be included.
if
(
$value
instanceof
Expression
)
return
$value
->
get
();
// Since columns may be prefixed with their corresponding table
// Since columns may be prefixed with their corresponding table
// name so as to not make them ambiguous, we will need to wrap
// name so as to not make them ambiguous, we will need to wrap
// the table and the column in keyword identifiers.
// the table and the column in keyword identifiers.
...
...
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