| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* $Id: FormatterElement.php 148 2007-02-13 11:15:53Z mrook $
|
|
|
4 |
*
|
|
|
5 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
6 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
7 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
8 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
9 |
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
10 |
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
11 |
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
12 |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
13 |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
14 |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
15 |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
16 |
*
|
|
|
17 |
* This software consists of voluntary contributions made by many individuals
|
|
|
18 |
* and is licensed under the LGPL. For more information please see
|
|
|
19 |
* <http://phing.info>.
|
|
|
20 |
*/
|
|
|
21 |
|
|
|
22 |
require_once 'phing/system/io/PhingFile.php';
|
|
|
23 |
|
|
|
24 |
/**
|
|
|
25 |
* Abstract
|
|
|
26 |
*
|
|
|
27 |
* @author Hans Lellelid <hans@xmpl.org>
|
|
|
28 |
* @package phing.tasks.ext.pdo
|
|
|
29 |
* @since 2.3.0
|
|
|
30 |
*/
|
|
|
31 |
abstract class PDOResultFormatter
|
|
|
32 |
{
|
|
|
33 |
/**
|
|
|
34 |
* Output writer.
|
|
|
35 |
*
|
|
|
36 |
* @var Writer
|
|
|
37 |
*/
|
|
|
38 |
protected $out;
|
|
|
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Sets the output writer.
|
|
|
42 |
*
|
|
|
43 |
* @param Writer $out
|
|
|
44 |
*/
|
|
|
45 |
public function setOutput(Writer $out) {
|
|
|
46 |
$this->out = $out;
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
* Gets the output writer.
|
|
|
51 |
*
|
|
|
52 |
* @return Writer
|
|
|
53 |
*/
|
|
|
54 |
public function getOutput() {
|
|
|
55 |
return $this->out;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
/**
|
|
|
59 |
* Gets the preferred output filename for this formatter.
|
|
|
60 |
* @return string
|
|
|
61 |
*/
|
|
|
62 |
abstract public function getPreferredOutfile();
|
|
|
63 |
|
|
|
64 |
/**
|
|
|
65 |
* Perform any initialization.
|
|
|
66 |
*/
|
|
|
67 |
public function initialize() {
|
|
|
68 |
|
|
|
69 |
}
|
|
|
70 |
|
|
|
71 |
/**
|
|
|
72 |
* Processes a specific row from PDO result set.
|
|
|
73 |
*
|
|
|
74 |
* @param array $row Row of PDO result set.
|
|
|
75 |
*/
|
|
|
76 |
abstract public function processRow($row);
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* Perform any final tasks and Close the writer.
|
|
|
80 |
*/
|
|
|
81 |
public function close() {
|
|
|
82 |
$this->out->close();
|
|
|
83 |
}
|
|
|
84 |
}
|