Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
5f46da1c
Unverified
Commit
5f46da1c
authored
4 years ago
by
Eileen McNaughton
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #19537 from colemanw/aliasLength
APIv4 - Increase alias max length to 256
parents
445e4ab2
8f508853
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Civi/Api4/Query/Api4SelectQuery.php
+1
-1
1 addition, 1 deletion
Civi/Api4/Query/Api4SelectQuery.php
Civi/Api4/Query/SqlExpression.php
+2
-2
2 additions, 2 deletions
Civi/Api4/Query/SqlExpression.php
with
3 additions
and
3 deletions
Civi/Api4/Query/Api4SelectQuery.php
+
1
−
1
View file @
5f46da1c
...
...
@@ -534,7 +534,7 @@ class Api4SelectQuery {
// Which might contain an alias. Split on the keyword "AS"
list
(
$entity
,
$alias
)
=
array_pad
(
explode
(
' AS '
,
$entity
),
2
,
NULL
);
// Ensure alias is a safe string, and supply default if not given
$alias
=
$alias
?
\CRM_Utils_String
::
munge
(
$alias
)
:
strtolower
(
$entity
);
$alias
=
$alias
?
\CRM_Utils_String
::
munge
(
$alias
,
'_'
,
256
)
:
strtolower
(
$entity
);
// First item in the array is a boolean indicating if the join is required (aka INNER or LEFT).
// The rest are join conditions.
$side
=
array_shift
(
$join
)
?
'INNER'
:
'LEFT'
;
...
...
This diff is collapsed.
Click to expand it.
Civi/Api4/Query/SqlExpression.php
+
2
−
2
View file @
5f46da1c
...
...
@@ -73,7 +73,7 @@ abstract class SqlExpression {
public
static
function
convert
(
string
$expression
,
$parseAlias
=
FALSE
,
$mustBe
=
[],
$cantBe
=
[
'SqlWild'
])
{
$as
=
$parseAlias
?
strrpos
(
$expression
,
' AS '
)
:
FALSE
;
$expr
=
$as
?
substr
(
$expression
,
0
,
$as
)
:
$expression
;
$alias
=
$as
?
\CRM_Utils_String
::
munge
(
substr
(
$expression
,
$as
+
4
))
:
NULL
;
$alias
=
$as
?
\CRM_Utils_String
::
munge
(
substr
(
$expression
,
$as
+
4
)
,
'_'
,
256
)
:
NULL
;
$bracketPos
=
strpos
(
$expr
,
'('
);
$firstChar
=
substr
(
$expr
,
0
,
1
);
$lastChar
=
substr
(
$expr
,
-
1
);
...
...
@@ -153,7 +153,7 @@ abstract class SqlExpression {
* @return string
*/
public
function
getAlias
():
string
{
return
$this
->
alias
??
$this
->
fields
[
0
]
??
\CRM_Utils_String
::
munge
(
$this
->
expr
);
return
$this
->
alias
??
$this
->
fields
[
0
]
??
\CRM_Utils_String
::
munge
(
$this
->
expr
,
'_'
,
256
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment