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
5964c0b1
Commit
5964c0b1
authored
Nov 04, 2011
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some more thinking, essentially how to test this?
parent
bd6c20bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
MasterSlaveConnection.php
lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
+17
-1
LoggingTest.php
tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php
+0
-2
MasterSlaveTest.php
tests/Doctrine/Tests/DBAL/Functional/MasterSlaveTest.php
+11
-0
No files found.
lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php
View file @
5964c0b1
...
...
@@ -29,11 +29,27 @@ use Doctrine\DBAL\Connection,
/**
* Master-Slave Connection
*
* Connection can be used with master-slave setups. Instantiation through the DriverManager looks like:
* Connection can be used with master-slave setups.
*
* Important for the understanding of this connection should be how it picks the slave and master.
*
* 1. Master picked when 'exec', 'executeUpdate', 'insert', 'delete', 'update', 'createSavepoint',
* 'releaseSavepoint', 'beginTransaction', 'rollback', 'commit' or 'getWrappedConnection' is called.
* 2. If master was picked once during the lifetime of the connection it will always get picked afterwards.
* 3. Slave if master was never picked before and 'query', 'prepare' or 'executeQuery' is used.
*
* ATTENTION: You can write to the slave with this connection if you execute a write query without
* opening up a transaction. For example:
*
* $conn = DriverManager::getConnection(...);
* $conn->query("DELETE FROM table");
*
* Instantiation through the DriverManager looks like:
*
* @example
*
* $conn = DriverManager::getConnection(array(
* 'wrapperClass' => 'Doctrine\DBAL\Connections\MasterSlaveConnection',
* 'master' => array('driver' => 'pdo_mysql', 'user' => '', 'password' => '', 'host' => '', 'dbname' => ''),
* 'slaves' => array(
* array('user' => 'slave1', 'password', 'host' => '', 'dbname' => ''),
...
...
tests/Doctrine/Tests/DBAL/Functional/LoggingTest.php
View file @
5964c0b1
...
...
@@ -2,8 +2,6 @@
namespace
Doctrine\Tests\DBAL\Functional
;
require_once
__DIR__
.
'/../../TestInit.php'
;
class
LoggingTest
extends
\Doctrine\Tests\DbalFunctionalTestCase
{
public
function
testLogExecuteQuery
()
...
...
tests/Doctrine/Tests/DBAL/Functional/MasterSlaveTest.php
0 → 100644
View file @
5964c0b1
<?php
namespace
Doctrine\Tests\DBAL\Functional
;
class
MasterSlaveTest
extends
\Doctrine\Tests\DbalFunctionalTestCase
{
public
function
test
()
{
}
}
\ 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