-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpudlNull.php
More file actions
64 lines (40 loc) · 1.78 KB
/
pudlNull.php
File metadata and controls
64 lines (40 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
if (!class_exists('pudl',false)) require_once(__DIR__.'/../pudl.php');
require_once(is_owner(__DIR__.'/pudlNullResult.php'));
////////////////////////////////////////////////////////////////////////////////
// EQUIV TO /dev/null - NOTHING IS READ, NOTHING IS WRITTEN, ANYWHERE
////////////////////////////////////////////////////////////////////////////////
class pudlNull extends pudl {
////////////////////////////////////////////////////////////////////////////
// CONSTRUCTOR
////////////////////////////////////////////////////////////////////////////
public function __construct($options=[]) {
// PRE-PROCESS OPTIONS
$options = self::_options($options);
// ALLOW CUSTOM IDENTIFIER
if (!empty($options['identifier'])) {
$this->identifier = $options['identifier'];
}
parent::__construct($options);
}
////////////////////////////////////////////////////////////////////////////
// PROCESS A QUERY (WE'RE NULL, WE DO NOTHING)
////////////////////////////////////////////////////////////////////////////
protected function process($query) {
return new pudlNullResult($this);
}
////////////////////////////////////////////////////////////////////////////
// RETURN A LIST OF TABLES
////////////////////////////////////////////////////////////////////////////
public function tables($clause=NULL) {
if (!empty($this->string)) return parent::tables($clause);
return ['dev_null'];
}
////////////////////////////////////////////////////////////////////////////
// REQUIRED METHODS, RETURN DEFAULT VALUES FOR ALL
////////////////////////////////////////////////////////////////////////////
public function insertId() { return 0; }
public function updated() { return 0; }
public function errno() { return 0; }
public function error() { return ''; }
}