Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
5dd0adfe
Commit
5dd0adfe
authored
May 14, 2013
by
Guilherme Blanco
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #314 from deeky666/microoptimize-connection-insert
Remove unnecessary code from Connection::insert
parents
38f67937
5b86fad8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
11 deletions
+2
-11
Connection.php
lib/Doctrine/DBAL/Connection.php
+2
-11
No files found.
lib/Doctrine/DBAL/Connection.php
View file @
5dd0adfe
...
@@ -533,22 +533,13 @@ class Connection implements DriverConnection
...
@@ -533,22 +533,13 @@ class Connection implements DriverConnection
{
{
$this
->
connect
();
$this
->
connect
();
// column names are specified as array keys
$cols
=
array
();
$placeholders
=
array
();
foreach
(
$data
as
$columnName
=>
$value
)
{
$cols
[]
=
$columnName
;
$placeholders
[]
=
'?'
;
}
if
(
!
is_int
(
key
(
$types
)))
{
if
(
!
is_int
(
key
(
$types
)))
{
$types
=
$this
->
extractTypeValues
(
$data
,
$types
);
$types
=
$this
->
extractTypeValues
(
$data
,
$types
);
}
}
$query
=
'INSERT INTO '
.
$tableName
$query
=
'INSERT INTO '
.
$tableName
.
' ('
.
implode
(
', '
,
$cols
)
.
')'
.
' ('
.
implode
(
', '
,
array_keys
(
$data
)
)
.
')'
.
' VALUES ('
.
implode
(
', '
,
$placeholders
)
.
')'
;
.
' VALUES ('
.
implode
(
', '
,
array_fill
(
0
,
count
(
$data
),
'?'
)
)
.
')'
;
return
$this
->
executeUpdate
(
$query
,
array_values
(
$data
),
$types
);
return
$this
->
executeUpdate
(
$query
,
array_values
(
$data
),
$types
);
}
}
...
...
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