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
d94345d3
Commit
d94345d3
authored
May 27, 2012
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport testcase to verify behavior is correct.
parent
8f4709bc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
22 deletions
+38
-22
TemporaryTableTest.php
tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
+38
-22
No files found.
tests/Doctrine/Tests/DBAL/Functional/TemporaryTableTest.php
View file @
d94345d3
...
@@ -12,65 +12,81 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -12,65 +12,81 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
{
{
parent
::
setUp
();
parent
::
setUp
();
try
{
try
{
$this
->
_conn
->
exec
(
$this
->
_conn
->
getDatabasePlatform
()
->
getDropTableSQL
(
"non
_
temporary"
));
$this
->
_conn
->
exec
(
$this
->
_conn
->
getDatabasePlatform
()
->
getDropTableSQL
(
"nontemporary"
));
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
}
}
}
}
public
function
tearDown
()
{
if
(
$this
->
_conn
)
{
try
{
$tempTable
=
$this
->
_conn
->
getDatabasePlatform
()
->
getTemporaryTableName
(
"temporary"
);
$this
->
_conn
->
exec
(
$this
->
_conn
->
getDatabasePlatform
()
->
getDropTemporaryTableSQL
(
$tempTable
));
}
catch
(
\Exception
$e
)
{
}
}
}
/**
/**
* @group DDC-1337
* @group DDC-1337
* @return void
* @return void
*/
*/
public
function
testDropTemporaryTableNotA
borts
Transaction
()
public
function
testDropTemporaryTableNotA
utoCommit
Transaction
()
{
{
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
$columnDefinitions
=
array
(
"id"
=>
array
(
"type"
=>
Type
::
getType
(
"integer"
),
"notnull"
=>
true
));
$columnDefinitions
=
array
(
"id"
=>
array
(
"type"
=>
Type
::
getType
(
"integer"
),
"notnull"
=>
true
));
$tempTable
=
$platform
->
getTemporaryTableName
(
"temporary"
);
$tempTable
=
$platform
->
getTemporaryTableName
(
"temporary"
);
$
t
empTableSQL
=
$platform
->
getCreateTemporaryTableSnippetSQL
()
.
' '
.
$tempTable
.
' ('
$
createT
empTableSQL
=
$platform
->
getCreateTemporaryTableSnippetSQL
()
.
' '
.
$tempTable
.
' ('
.
$platform
->
getColumnDeclarationListSQL
(
$columnDefinitions
)
.
')'
;
.
$platform
->
getColumnDeclarationListSQL
(
$columnDefinitions
)
.
')'
;
$this
->
_conn
->
executeUpdate
(
$createTempTableSQL
);
$table
=
new
Table
(
"non
_
temporary"
);
$table
=
new
Table
(
"nontemporary"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
setPrimaryKey
(
array
(
'id'
));
$this
->
_conn
->
getSchemaManager
()
->
createTable
(
$table
);
foreach
(
$platform
->
getCreateTableSQL
(
$table
)
AS
$sql
)
{
$this
->
_conn
->
beginTransaction
(
);
$this
->
_conn
->
executeQuery
(
$sql
);
$this
->
_conn
->
insert
(
"non_temporary"
,
array
(
"id"
=>
1
));
}
$this
->
_conn
->
exec
(
$tempTableSQL
);
$this
->
_conn
->
beginTransaction
();
$this
->
_conn
->
insert
(
"nontemporary"
,
array
(
"id"
=>
1
));
$this
->
_conn
->
exec
(
$platform
->
getDropTemporaryTableSQL
(
$tempTable
));
$this
->
_conn
->
exec
(
$platform
->
getDropTemporaryTableSQL
(
$tempTable
));
$this
->
_conn
->
insert
(
"nontemporary"
,
array
(
"id"
=>
2
));
$this
->
_conn
->
insert
(
"non_temporary"
,
array
(
"id"
=>
2
));
$this
->
_conn
->
rollback
();
$this
->
_conn
->
rollback
();
$rows
=
$this
->
_conn
->
fetchAll
(
'SELECT * FROM non
_
temporary'
);
$rows
=
$this
->
_conn
->
fetchAll
(
'SELECT * FROM nontemporary'
);
$this
->
assertEquals
(
array
(),
$rows
);
$this
->
assertEquals
(
array
(),
$rows
,
"In an event of an error this result has one row, because of an implicit commit."
);
}
}
/**
/**
* @group DDC-1337
* @group DDC-1337
* @return void
* @return void
*/
*/
public
function
testCreateTemporaryTableNotA
borts
Transaction
()
public
function
testCreateTemporaryTableNotA
utoCommit
Transaction
()
{
{
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
$platform
=
$this
->
_conn
->
getDatabasePlatform
();
$columnDefinitions
=
array
(
"id"
=>
array
(
"type"
=>
Type
::
getType
(
"integer"
),
"notnull"
=>
true
));
$columnDefinitions
=
array
(
"id"
=>
array
(
"type"
=>
Type
::
getType
(
"integer"
),
"notnull"
=>
true
));
$tempTable
=
$platform
->
getTemporaryTableName
(
"temporary"
);
$tempTable
=
$platform
->
getTemporaryTableName
(
"temporary"
);
$
t
empTableSQL
=
$platform
->
getCreateTemporaryTableSnippetSQL
()
.
' '
.
$tempTable
.
' ('
$
createT
empTableSQL
=
$platform
->
getCreateTemporaryTableSnippetSQL
()
.
' '
.
$tempTable
.
' ('
.
$platform
->
getColumnDeclarationListSQL
(
$columnDefinitions
)
.
')'
;
.
$platform
->
getColumnDeclarationListSQL
(
$columnDefinitions
)
.
')'
;
$table
=
new
Table
(
"non
_
temporary"
);
$table
=
new
Table
(
"nontemporary"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
addColumn
(
"id"
,
"integer"
);
$table
->
setPrimaryKey
(
array
(
'id'
));
foreach
(
$platform
->
getCreateTableSQL
(
$table
)
AS
$sql
)
{
$this
->
_conn
->
executeQuery
(
$sql
);
}
$this
->
_conn
->
getSchemaManager
()
->
createTable
(
$table
);
$this
->
_conn
->
beginTransaction
();
$this
->
_conn
->
beginTransaction
();
$this
->
_conn
->
insert
(
"non
_
temporary"
,
array
(
"id"
=>
1
));
$this
->
_conn
->
insert
(
"nontemporary"
,
array
(
"id"
=>
1
));
$this
->
_conn
->
exec
(
$
t
empTableSQL
);
$this
->
_conn
->
exec
(
$
createT
empTableSQL
);
$this
->
_conn
->
insert
(
"non
_
temporary"
,
array
(
"id"
=>
2
));
$this
->
_conn
->
insert
(
"nontemporary"
,
array
(
"id"
=>
2
));
$this
->
_conn
->
rollback
();
$this
->
_conn
->
rollback
();
...
@@ -80,7 +96,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
...
@@ -80,7 +96,7 @@ class TemporaryTableTest extends \Doctrine\Tests\DbalFunctionalTestCase
}
}
$rows
=
$this
->
_conn
->
fetchAll
(
'SELECT * FROM non
_
temporary'
);
$rows
=
$this
->
_conn
->
fetchAll
(
'SELECT * FROM nontemporary'
);
$this
->
assertEquals
(
array
(),
$rows
);
$this
->
assertEquals
(
array
(),
$rows
,
"In an event of an error this result has one row, because of an implicit commit."
);
}
}
}
}
\ No newline at end of file
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