1 | <?php /** DriverMicro */ |
||
19 | abstract class Driver implements IDriver |
||
20 | { |
||
21 | /** @var \PDO|null $conn Connection to DB */ |
||
22 | protected $conn; |
||
23 | |||
24 | |||
25 | /** |
||
26 | * Driver constructor. |
||
27 | * |
||
28 | * @access public |
||
29 | * |
||
30 | * @param string $dsn DSN connection string |
||
31 | * @param array $config Configuration of connection |
||
32 | * @param array $options Other options |
||
33 | * |
||
34 | * @result void |
||
35 | * @throws Exception |
||
36 | */ |
||
37 | public function __construct($dsn, array $config = [], array $options = []) |
||
49 | |||
50 | /** |
||
51 | * Get driver type of current connection |
||
52 | * |
||
53 | * @access public |
||
54 | * @return string |
||
55 | */ |
||
56 | public function getDriverType() |
||
60 | |||
61 | /** |
||
62 | * Destructor for this class |
||
63 | * |
||
64 | * @access public |
||
65 | * @return void |
||
66 | */ |
||
67 | public function __destruct() |
||
71 | |||
72 | /** |
||
73 | * Table exists in db |
||
74 | * |
||
75 | * @access public |
||
76 | * |
||
77 | * @param string $table Table name |
||
78 | * |
||
79 | * @return bool |
||
80 | */ |
||
81 | public function tableExists($table) |
||
85 | |||
86 | /** |
||
87 | * Clear all data from table |
||
88 | * |
||
89 | * @access public |
||
90 | * |
||
91 | * @param string $name Table name |
||
92 | * |
||
93 | * @return int |
||
94 | */ |
||
95 | public function clearTable($name) |
||
99 | |||
100 | /** |
||
101 | * Field exists in table |
||
102 | * |
||
103 | * @access public |
||
104 | * |
||
105 | * @param string $field Field name |
||
106 | * @param string $table Table name |
||
107 | * |
||
108 | * @return boolean |
||
109 | */ |
||
110 | public function fieldExists($field, $table) |
||
120 | |||
121 | /** |
||
122 | * Send RAW query to DB |
||
123 | * |
||
124 | * @access public |
||
125 | * |
||
126 | * @param string $query Raw query to db |
||
127 | * @param array $params Params for query |
||
128 | * @param int $fetchType Fetching type |
||
129 | * @param string $fetchClass Fetching class |
||
130 | * |
||
131 | * @return \PDOStatement|array |
||
132 | * @throws Exception |
||
133 | */ |
||
134 | public function rawQuery($query = '', array $params = [], $fetchType = \PDO::FETCH_ASSOC, $fetchClass = 'Model') |
||
153 | } |