Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
bd2527a4
Commit
bd2527a4
authored
Nov 21, 2006
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Patch
#98059
by chx: trying to get the never-ending regex mess right.
parent
e66c520a
No related branches found
No related tags found
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
includes/database.mysql.inc
+1
-1
1 addition, 1 deletion
includes/database.mysql.inc
includes/database.mysqli.inc
+1
-1
1 addition, 1 deletion
includes/database.mysqli.inc
includes/database.pgsql.inc
+1
-1
1 addition, 1 deletion
includes/database.pgsql.inc
with
3 additions
and
3 deletions
includes/database.mysql.inc
+
1
−
1
View file @
bd2527a4
...
...
@@ -431,7 +431,7 @@ function db_table_exists($table) {
function
db_distinct_field
(
$table
,
$field
,
$query
)
{
$field_to_select
=
'DISTINCT('
.
$table
.
'.'
.
$field
.
')'
;
// (?<!text) is a negative look-behind (no need to rewrite queries that already use DISTINCT).
return
preg_replace
(
'/(SELECT.*)('
.
$table
.
'\.)
?
(?<!DISTINCT\()(?<!DISTINCT\('
.
$table
.
'\.)'
.
$field
.
'(.*FROM )/AUsi'
,
'\1'
.
$field_to_select
.
'\
3
'
,
$query
);
return
preg_replace
(
'/(SELECT.*)(
?:
'
.
$table
.
'\.
|\s
)(?<!DISTINCT\()(?<!DISTINCT\('
.
$table
.
'\.)'
.
$field
.
'(.*FROM )/AUsi'
,
'\1
'
.
$field_to_select
.
'\
2
'
,
$query
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
includes/database.mysqli.inc
+
1
−
1
View file @
bd2527a4
...
...
@@ -416,7 +416,7 @@ function db_table_exists($table) {
function
db_distinct_field
(
$table
,
$field
,
$query
)
{
$field_to_select
=
'DISTINCT('
.
$table
.
'.'
.
$field
.
')'
;
// (?<!text) is a negative look-behind (no need to rewrite queries that already use DISTINCT).
return
preg_replace
(
'/(SELECT.*)('
.
$table
.
'\.)
?
(?<!DISTINCT\()(?<!DISTINCT\('
.
$table
.
'\.)'
.
$field
.
'(.*FROM )/AUsi'
,
'\1'
.
$field_to_select
.
'\
3
'
,
$query
);
return
preg_replace
(
'/(SELECT.*)(
?:
'
.
$table
.
'\.
|\s
)(?<!DISTINCT\()(?<!DISTINCT\('
.
$table
.
'\.)'
.
$field
.
'(.*FROM )/AUsi'
,
'\1
'
.
$field_to_select
.
'\
2
'
,
$query
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
includes/database.pgsql.inc
+
1
−
1
View file @
bd2527a4
...
...
@@ -414,7 +414,7 @@ function db_check_setup() {
function
db_distinct_field
(
$table
,
$field
,
$query
)
{
$field_to_select
=
'DISTINCT ON ('
.
$table
.
'.'
.
$field
.
")
$table
.
$field
"
;
// (?<!text) is a negative look-behind (no need to rewrite queries that already use DISTINCT).
$query
=
preg_replace
(
'/(SELECT.*)('
.
$table
.
'\.)
?
(?<!DISTINCT\()(?<!DISTINCT\('
.
$table
.
'\.)'
.
$field
.
'(.*FROM )/AUsi'
,
'\1'
.
$field_to_select
.
'\
3
'
,
$query
);
$query
=
preg_replace
(
'/(SELECT.*)(
?:
'
.
$table
.
'\.
|\s
)(?<!DISTINCT\()(?<!DISTINCT\('
.
$table
.
'\.)'
.
$field
.
'(.*FROM )/AUsi'
,
'\1
'
.
$field_to_select
.
'\
2
'
,
$query
);
$query
=
preg_replace
(
'/(ORDER BY )(?!'
.
$table
.
'\.'
.
$field
.
')/'
,
'\1'
.
"
$table
.
$field
, "
,
$query
);
return
$query
;
}
...
...
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