1
<?php
2
/**
3
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14
 *
15
 * This software consists of voluntary contributions made by many individuals
16
 * and is licensed under the LGPL. For more information please see
17
 * <http://phing.info>.
18
 */
19

20
/**
21
 * Factory for generating dbms-specific syntax-generating objects
22
 *
23
 * @author  Luke Crouch at SourceForge (http://sourceforge.net)
24
 * @package phing.tasks.ext.dbdeploy
25
 */
26
class DbmsSyntaxFactory
27
{
28
    private $dbms;
29

30
    /**
31
     * @param $dbms
32
     */
33 0
    public function __construct($dbms)
34
    {
35 0
        $this->dbms = $dbms;
36
    }
37

38 0
    public function getDbmsSyntax()
39
    {
40 0
        switch ($this->dbms) {
41 0
            case ('sqlite'):
42 0
                include_once 'phing/tasks/ext/dbdeploy/DbmsSyntaxSQLite.php';
43

44 0
                return new DbmsSyntaxSQLite();
45 0
            case ('mysql'):
46 0
                include_once 'phing/tasks/ext/dbdeploy/DbmsSyntaxMysql.php';
47

48 0
                return new DbmsSyntaxMysql();
49 0
            case 'odbc':
50 0
            case ('mssql'):
51 0
            case 'dblib':
52 0
                include_once 'phing/tasks/ext/dbdeploy/DbmsSyntaxMsSql.php';
53

54 0
                return new DbmsSyntaxMsSql();
55 0
            case ('pgsql'):
56 0
                include_once 'phing/tasks/ext/dbdeploy/DbmsSyntaxPgSQL.php';
57

58 0
                return new DbmsSyntaxPgSQL();
59 0
            case 'oci':
60 0
                include_once 'phing/tasks/ext/dbdeploy/DbmsSyntaxOracle.php';
61

62 0
                return new DbmsSyntaxOracle();
63 0
            default:
64 0
                throw new Exception($this->dbms . ' is not supported by dbdeploy task.');
65
        }
66
    }
67
}

Read our documentation on viewing source code .

Loading