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
 * @package phing.tasks.ext.pdo
20
 */
21

22
/**
23
 * Dummy query splitter: converts entire input into single
24
 * SQL string
25
 *
26
 * @author  Michiel Rook <mrook@php.net>
27
 * @package phing.tasks.ext.pdo
28
 */
29
class DummyPDOQuerySplitter extends PDOQuerySplitter
30
{
31
    /**
32
     * Returns entire SQL source
33
     *
34
     * @return string|null
35
     */
36 0
    public function nextQuery()
37
    {
38 0
        $sql = null;
39

40 0
        while (($line = $this->sqlReader->readLine()) !== null) {
41 0
            $delimiter = $this->parent->getDelimiter();
42 0
            $project = $this->parent->getOwningTarget()->getProject();
43 0
            $line = $project->replaceProperties(trim($line));
44

45 0
            if (
46 0
                ($line != $delimiter)
47 0
                && (StringHelper::startsWith("//", $line)
48 0
                    || StringHelper::startsWith("--", $line)
49 0
                    || StringHelper::startsWith("#", $line))
50 0
            ) {
51 0
                continue;
52
            }
53

54 0
            $sql .= " " . $line . "\n";
55

56
            /**
57
             * fix issue with PDO and wrong formated multistatements
58
             *
59
             * @issue 1108
60
             */
61 0
            if (StringHelper::endsWith($delimiter, $line)) {
62 0
                break;
63
            }
64
        }
65

66 0
        return $sql;
67
    }
68
}

Read our documentation on viewing source code .

Loading