-
Notifications
You must be signed in to change notification settings - Fork 1
/
NullPDO.php
94 lines (74 loc) · 2.13 KB
/
NullPDO.php
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<?php
namespace Ingenerator\KohanaDoctrine;
use PDO;
class NullPDO extends \PDO
{
/**
* @var string
*/
private $driver;
public function __construct($driver_name)
{
if ($driver_name === 'pdo_mysql') {
$this->driver = 'mysql';
} else {
throw new \InvalidArgumentException(__CLASS__.' only supports pdo_mysql, got `'.$driver_name.'`');
}
}
public function setAttribute($attribute, $value)
{
// No-op
}
public function getAttribute($attribute)
{
switch ($attribute) {
case static::ATTR_DRIVER_NAME:
return $this->driver;
}
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function prepare($statement, $driver_options = [])
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function beginTransaction()
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function commit()
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function rollBack()
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function inTransaction()
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function exec($statement)
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function query($statement, $mode = PDO::ATTR_DEFAULT_FETCH_MODE, $arg3 = NULL, array $ctorargs = [])
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function lastInsertId($name = NULL)
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function errorCode()
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function errorInfo()
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
public function quote($string, $parameter_type = PDO::PARAM_STR)
{
throw DatabaseNotConfiguredException::forMethod(__METHOD__);
}
}