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