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
41906695
Unverified
Commit
41906695
authored
Jan 28, 2018
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some more code style
parent
0e99c343
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
192 additions
and
152 deletions
+192
-152
TableGenerator.php
lib/Doctrine/DBAL/Id/TableGenerator.php
+7
-5
Connection.php
lib/Doctrine/DBAL/Portability/Connection.php
+1
-1
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+2
-1
QueryBuilder.php
lib/Doctrine/DBAL/Query/QueryBuilder.php
+3
-3
BlobTest.php
tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
+12
-4
ConnectionTest.php
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
+2
-2
DataAccessTest.php
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
+19
-27
PDOPgsqlConnectionTest.php
...e/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php
+1
-1
NamedParametersTest.php
tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
+145
-108
No files found.
lib/Doctrine/DBAL/Id/TableGenerator.php
View file @
41906695
...
@@ -22,6 +22,7 @@ namespace Doctrine\DBAL\Id;
...
@@ -22,6 +22,7 @@ namespace Doctrine\DBAL\Id;
use
Doctrine\DBAL\DriverManager
;
use
Doctrine\DBAL\DriverManager
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\Connection
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\FetchMode
;
use
Doctrine\DBAL\LockMode
;
/**
/**
* Table ID Generator for those poor languages that are missing sequences.
* Table ID Generator for those poor languages that are missing sequences.
...
@@ -120,12 +121,13 @@ class TableGenerator
...
@@ -120,12 +121,13 @@ class TableGenerator
try
{
try
{
$platform
=
$this
->
conn
->
getDatabasePlatform
();
$platform
=
$this
->
conn
->
getDatabasePlatform
();
$sql
=
"SELECT sequence_value, sequence_increment_by "
.
$sql
=
'SELECT sequence_value, sequence_increment_by'
"FROM "
.
$platform
->
appendLockHint
(
$this
->
generatorTableName
,
\Doctrine\DBAL\LockMode
::
PESSIMISTIC_WRITE
)
.
" "
.
.
' FROM '
.
$platform
->
appendLockHint
(
$this
->
generatorTableName
,
LockMode
::
PESSIMISTIC_WRITE
)
"WHERE sequence_name = ? "
.
$platform
->
getWriteLockSQL
();
.
' WHERE sequence_name = ? '
.
$platform
->
getWriteLockSQL
();
$stmt
=
$this
->
conn
->
executeQuery
(
$sql
,
[
$sequenceName
]);
$stmt
=
$this
->
conn
->
executeQuery
(
$sql
,
[
$sequenceName
]);
$row
=
$stmt
->
fetch
(
FetchMode
::
ASSOCIATIVE
);
if
(
$row
=
$stmt
->
fetch
(
FetchMode
::
ASSOCIATIVE
)
)
{
if
(
$row
!==
false
)
{
$row
=
array_change_key_case
(
$row
,
CASE_LOWER
);
$row
=
array_change_key_case
(
$row
,
CASE_LOWER
);
$value
=
$row
[
'sequence_value'
];
$value
=
$row
[
'sequence_value'
];
...
...
lib/Doctrine/DBAL/Portability/Connection.php
View file @
41906695
...
@@ -90,7 +90,7 @@ class Connection extends \Doctrine\DBAL\Connection
...
@@ -90,7 +90,7 @@ class Connection extends \Doctrine\DBAL\Connection
// make use of c-level support for case handling
// make use of c-level support for case handling
$this
->
_conn
->
setAttribute
(
\PDO
::
ATTR_CASE
,
$params
[
'fetch_case'
]);
$this
->
_conn
->
setAttribute
(
\PDO
::
ATTR_CASE
,
$params
[
'fetch_case'
]);
}
else
{
}
else
{
$this
->
case
=
(
$params
[
'fetch_case'
]
==
ColumnCase
::
LOWER
)
?
CASE_LOWER
:
CASE_UPPER
;
$this
->
case
=
(
$params
[
'fetch_case'
]
==
=
ColumnCase
::
LOWER
)
?
CASE_LOWER
:
CASE_UPPER
;
}
}
}
}
}
}
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
41906695
...
@@ -150,7 +150,8 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
...
@@ -150,7 +150,8 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
$row
=
$this
->
stmt
->
fetch
(
$fetchMode
);
$row
=
$this
->
stmt
->
fetch
(
$fetchMode
);
$iterateRow
=
$this
->
portability
&
(
Connection
::
PORTABILITY_EMPTY_TO_NULL
|
Connection
::
PORTABILITY_RTRIM
);
$iterateRow
=
$this
->
portability
&
(
Connection
::
PORTABILITY_EMPTY_TO_NULL
|
Connection
::
PORTABILITY_RTRIM
);
$fixCase
=
!
is_null
(
$this
->
case
)
&&
(
$fetchMode
==
FetchMode
::
ASSOCIATIVE
||
$fetchMode
==
FetchMode
::
MIXED
)
$fixCase
=
!
is_null
(
$this
->
case
)
&&
(
$fetchMode
===
FetchMode
::
ASSOCIATIVE
||
$fetchMode
===
FetchMode
::
MIXED
)
&&
(
$this
->
portability
&
Connection
::
PORTABILITY_FIX_CASE
);
&&
(
$this
->
portability
&
Connection
::
PORTABILITY_FIX_CASE
);
$row
=
$this
->
fixRow
(
$row
,
$iterateRow
,
$fixCase
);
$row
=
$this
->
fixRow
(
$row
,
$iterateRow
,
$fixCase
);
...
...
lib/Doctrine/DBAL/Query/QueryBuilder.php
View file @
41906695
...
@@ -263,9 +263,9 @@ class QueryBuilder
...
@@ -263,9 +263,9 @@ class QueryBuilder
* ->setParameter(':user_id', 1);
* ->setParameter(':user_id', 1);
* </code>
* </code>
*
*
* @param string|int
eger
$key The parameter position or name.
* @param string|int $key The parameter position or name.
* @param mixed
$value The parameter value.
* @param mixed $value The parameter value.
* @param string|int
eger
|null $type One of the {@link \Doctrine\DBAL\ParameterType} constants.
* @param string|int|null $type One of the {@link \Doctrine\DBAL\ParameterType} constants.
*
*
* @return $this This QueryBuilder instance.
* @return $this This QueryBuilder instance.
*/
*/
...
...
tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
View file @
41906695
...
@@ -37,10 +37,18 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -37,10 +37,18 @@ class BlobTest extends \Doctrine\Tests\DbalFunctionalTestCase
public
function
testInsert
()
public
function
testInsert
()
{
{
$ret
=
$this
->
_conn
->
insert
(
'blob_table'
,
$ret
=
$this
->
_conn
->
insert
(
'blob_table'
,
[
array
(
'id'
=>
1
,
'clobfield'
=>
'test'
,
'blobfield'
=>
'test'
,
'binaryfield'
=>
'test'
),
'id'
=>
1
,
array
(
ParameterType
::
INTEGER
,
ParameterType
::
STRING
,
ParameterType
::
LARGE_OBJECT
,
ParameterType
::
LARGE_OBJECT
)
'clobfield'
=>
'test'
,
);
'blobfield'
=>
'test'
,
'binaryfield'
=>
'test'
,
],
[
ParameterType
::
INTEGER
,
ParameterType
::
STRING
,
ParameterType
::
LARGE_OBJECT
,
ParameterType
::
LARGE_OBJECT
,
]);
self
::
assertEquals
(
1
,
$ret
);
self
::
assertEquals
(
1
,
$ret
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/ConnectionTest.php
View file @
41906695
...
@@ -244,8 +244,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -244,8 +244,8 @@ class ConnectionTest extends \Doctrine\Tests\DbalFunctionalTestCase
public
function
testQuote
()
public
function
testQuote
()
{
{
self
::
assertEquals
(
self
::
assertEquals
(
$this
->
_conn
->
quote
(
"foo"
,
Type
::
STRING
),
$this
->
_conn
->
quote
(
'foo'
,
Type
::
STRING
),
$this
->
_conn
->
quote
(
"foo"
,
ParameterType
::
STRING
)
$this
->
_conn
->
quote
(
'foo'
,
ParameterType
::
STRING
)
);
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
View file @
41906695
...
@@ -195,8 +195,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -195,8 +195,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetime
=
new
\DateTime
(
$datetimeString
);
$datetime
=
new
\DateTime
(
$datetimeString
);
$sql
=
"SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"
;
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$data
=
$this
->
_conn
->
fetchAll
(
$sql
,
array
(
1
,
$datetime
),
array
(
ParameterType
::
STRING
,
Type
::
DATETIME
)
);
$data
=
$this
->
_conn
->
fetchAll
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Type
::
DATETIME
]
);
self
::
assertCount
(
1
,
$data
);
self
::
assertCount
(
1
,
$data
);
...
@@ -227,8 +227,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -227,8 +227,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
public
function
testFetchBoth
()
public
function
testFetchBoth
()
{
{
$sql
=
"SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?"
;
$sql
=
'SELECT test_int, test_string FROM fetch_table WHERE test_int = ? AND test_string = ?'
;
$row
=
$this
->
_conn
->
executeQuery
(
$sql
,
array
(
1
,
'foo'
)
)
->
fetch
(
FetchMode
::
MIXED
);
$row
=
$this
->
_conn
->
executeQuery
(
$sql
,
[
1
,
'foo'
]
)
->
fetch
(
FetchMode
::
MIXED
);
self
::
assertNotFalse
(
$row
);
self
::
assertNotFalse
(
$row
);
...
@@ -265,8 +265,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -265,8 +265,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetime
=
new
\DateTime
(
$datetimeString
);
$datetime
=
new
\DateTime
(
$datetimeString
);
$sql
=
"SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"
;
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$row
=
$this
->
_conn
->
fetchAssoc
(
$sql
,
array
(
1
,
$datetime
),
array
(
ParameterType
::
STRING
,
Type
::
DATETIME
)
);
$row
=
$this
->
_conn
->
fetchAssoc
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Type
::
DATETIME
]
);
self
::
assertNotFalse
(
$row
);
self
::
assertNotFalse
(
$row
);
...
@@ -306,8 +306,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -306,8 +306,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetime
=
new
\DateTime
(
$datetimeString
);
$datetime
=
new
\DateTime
(
$datetimeString
);
$sql
=
"SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"
;
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$row
=
$this
->
_conn
->
fetchArray
(
$sql
,
array
(
1
,
$datetime
),
array
(
ParameterType
::
STRING
,
Type
::
DATETIME
)
);
$row
=
$this
->
_conn
->
fetchArray
(
$sql
,
[
1
,
$datetime
],
[
ParameterType
::
STRING
,
Type
::
DATETIME
]
);
self
::
assertNotFalse
(
$row
);
self
::
assertNotFalse
(
$row
);
...
@@ -351,13 +351,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -351,13 +351,8 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetimeString
=
'2010-01-01 10:10:10'
;
$datetime
=
new
\DateTime
(
$datetimeString
);
$datetime
=
new
\DateTime
(
$datetimeString
);
$sql
=
"SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?"
;
$sql
=
'SELECT test_int, test_datetime FROM fetch_table WHERE test_int = ? AND test_datetime = ?'
;
$column
=
$this
->
_conn
->
fetchColumn
(
$column
=
$this
->
_conn
->
fetchColumn
(
$sql
,
[
1
,
$datetime
],
1
,
[
ParameterType
::
STRING
,
Type
::
DATETIME
]);
$sql
,
array
(
1
,
$datetime
),
1
,
array
(
ParameterType
::
STRING
,
Type
::
DATETIME
)
);
self
::
assertNotFalse
(
$column
);
self
::
assertNotFalse
(
$column
);
...
@@ -402,18 +397,15 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -402,18 +397,15 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
$datetime
=
new
\DateTime
(
'2010-02-02 20:20:20'
);
$datetime
=
new
\DateTime
(
'2010-02-02 20:20:20'
);
$sql
=
'INSERT INTO fetch_table (test_int, test_string, test_datetime) VALUES (?, ?, ?)'
;
$sql
=
'INSERT INTO fetch_table (test_int, test_string, test_datetime) VALUES (?, ?, ?)'
;
$affectedRows
=
$this
->
_conn
->
executeUpdate
(
$sql
,
$affectedRows
=
$this
->
_conn
->
executeUpdate
(
$sql
,
[
array
(
1
=>
50
,
1
=>
50
,
2
=>
'foo'
,
2
=>
'foo'
,
3
=>
$datetime
,
3
=>
$datetime
,
],
[
),
1
=>
ParameterType
::
INTEGER
,
array
(
2
=>
ParameterType
::
STRING
,
1
=>
ParameterType
::
INTEGER
,
3
=>
Type
::
DATETIME
,
2
=>
ParameterType
::
STRING
,
]);
3
=>
Type
::
DATETIME
,
)
);
self
::
assertEquals
(
1
,
$affectedRows
);
self
::
assertEquals
(
1
,
$affectedRows
);
self
::
assertEquals
(
1
,
$this
->
_conn
->
executeQuery
(
self
::
assertEquals
(
1
,
$this
->
_conn
->
executeQuery
(
...
...
tests/Doctrine/Tests/DBAL/Functional/Driver/PDOPgsqlConnectionTest.php
View file @
41906695
...
@@ -43,7 +43,7 @@ class PDOPgsqlConnectionTest extends DbalFunctionalTestCase
...
@@ -43,7 +43,7 @@ class PDOPgsqlConnectionTest extends DbalFunctionalTestCase
self
::
assertEquals
(
self
::
assertEquals
(
$charset
,
$charset
,
$connection
->
query
(
"SHOW client_encoding"
)
$connection
->
query
(
'SHOW client_encoding'
)
->
fetch
(
FetchMode
::
COLUMN
)
->
fetch
(
FetchMode
::
COLUMN
)
);
);
}
}
...
...
tests/Doctrine/Tests/DBAL/Functional/NamedParametersTest.php
View file @
41906695
This diff is collapsed.
Click to expand it.
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