Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
cd6a08d8
Commit
cd6a08d8
authored
Apr 19, 2010
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#772554
by Crell: Remove delay() method from insert queries.
parent
f62d41af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
31 deletions
+2
-31
includes/database/mysql/query.inc
includes/database/mysql/query.inc
+2
-4
includes/database/query.inc
includes/database/query.inc
+0
-27
No files found.
includes/database/mysql/query.inc
View file @
cd6a08d8
...
...
@@ -44,18 +44,16 @@ public function execute() {
public
function
__toString
()
{
$delay
=
$this
->
queryOptions
[
'delay'
]
?
'DELAYED'
:
''
;
// Default fields are always placed first for consistency.
$insert_fields
=
array_merge
(
$this
->
defaultFields
,
$this
->
insertFields
);
// If we're selecting from a SelectQuery, finish building the query and
// pass it back, as any remaining options are irrelevant.
if
(
!
empty
(
$this
->
fromQuery
))
{
return
"INSERT
$delay
INTO {"
.
$this
->
table
.
'} ('
.
implode
(
', '
,
$insert_fields
)
.
') '
.
$this
->
fromQuery
;
return
"INSERT INTO {"
.
$this
->
table
.
'} ('
.
implode
(
', '
,
$insert_fields
)
.
') '
.
$this
->
fromQuery
;
}
$query
=
"INSERT
$delay
INTO {"
.
$this
->
table
.
'} ('
.
implode
(
', '
,
$insert_fields
)
.
') VALUES '
;
$query
=
"INSERT INTO {"
.
$this
->
table
.
'} ('
.
implode
(
', '
,
$insert_fields
)
.
') VALUES '
;
$max_placeholder
=
0
;
$values
=
array
();
...
...
includes/database/query.inc
View file @
cd6a08d8
...
...
@@ -414,33 +414,6 @@ public function useDefaults(array $fields) {
return
$this
;
}
/**
* Flag this query as being delay-safe or not.
*
* If this method is never called, it is assumed that the query must be
* executed immediately. If delay is set to TRUE, then the query will be
* flagged to run "delayed" or "low priority" on databases that support such
* capabilities. In that case, the database will return immediately and the
* query will be run at some point in the future. That makes it useful for
* logging-style queries.
*
* If the database does not support delayed INSERT queries, this method
* has no effect.
*
* Note that for a delayed query there is no serial ID returned, as it won't
* be created until later when the query runs. It should therefore not be
* used if the value of the ID is known.
*
* @param $delay
* If TRUE, this query is delay-safe and will run delayed on supported databases.
* @return InsertQuery
* The called object.
*/
public
function
delay
(
$delay
=
TRUE
)
{
$this
->
delay
=
$delay
;
return
$this
;
}
public
function
from
(
SelectQueryInterface
$query
)
{
$this
->
fromQuery
=
$query
;
return
$this
;
...
...
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