1 | <?php |
||
6 | abstract class Wpinv_DB { |
||
7 | |||
8 | /** |
||
9 | * The name of our database table |
||
10 | * |
||
11 | * @access public |
||
12 | * @since 1.0.0 |
||
13 | */ |
||
14 | public $table_name; |
||
15 | |||
16 | /** |
||
17 | * The version of our database table |
||
18 | * |
||
19 | * @access public |
||
20 | * @since 1.0.0 |
||
21 | */ |
||
22 | public $version; |
||
23 | |||
24 | /** |
||
25 | * The name of the primary column |
||
26 | * |
||
27 | * @access public |
||
28 | * @since 1.0.0 |
||
29 | */ |
||
30 | public $primary_key; |
||
31 | |||
32 | /** |
||
33 | * Get things started |
||
34 | * |
||
35 | * @access public |
||
36 | * @since 1.0.0 |
||
37 | */ |
||
38 | public function __construct() {} |
||
39 | |||
40 | /** |
||
41 | * Whitelist of columns |
||
42 | * |
||
43 | * @access public |
||
44 | * @since 1.0.0 |
||
45 | * @return array |
||
46 | */ |
||
47 | public function get_columns() { |
||
50 | |||
51 | /** |
||
52 | * Default column values |
||
53 | * |
||
54 | * @access public |
||
55 | * @since 1.0.0 |
||
56 | * @return array |
||
57 | */ |
||
58 | public function get_column_defaults() { |
||
61 | |||
62 | /** |
||
63 | * Retrieve a row by the primary key |
||
64 | * |
||
65 | * @access public |
||
66 | * @since 1.0.0 |
||
67 | * @return object |
||
68 | */ |
||
69 | public function get( $row_id ) { |
||
73 | |||
74 | /** |
||
75 | * Retrieve a row by a specific column / value |
||
76 | * |
||
77 | * @access public |
||
78 | * @since 1.0.0 |
||
79 | * @return object |
||
80 | */ |
||
81 | public function get_by( $column, $row_id ) { |
||
86 | |||
87 | /** |
||
88 | * Retrieve a specific column's value by the primary key |
||
89 | * |
||
90 | * @access public |
||
91 | * @since 1.0.0 |
||
92 | * @return string |
||
93 | */ |
||
94 | public function get_column( $column, $row_id ) { |
||
99 | |||
100 | /** |
||
101 | * Retrieve a specific column's value by the the specified column / value |
||
102 | * |
||
103 | * @access public |
||
104 | * @since 1.0.0 |
||
105 | * @return string |
||
106 | */ |
||
107 | public function get_column_by( $column, $column_where, $column_value ) { |
||
113 | |||
114 | /** |
||
115 | * Insert a new row |
||
116 | * |
||
117 | * @access public |
||
118 | * @since 1.0.0 |
||
119 | * @return int |
||
120 | */ |
||
121 | public function insert( $data, $type = '' ) { |
||
149 | |||
150 | /** |
||
151 | * Update a row |
||
152 | * |
||
153 | * @access public |
||
154 | * @since 1.0.0 |
||
155 | * @return bool |
||
156 | */ |
||
157 | public function update( $row_id, $data = array(), $where = '' ) { |
||
191 | |||
192 | /** |
||
193 | * Delete a row identified by the primary key |
||
194 | * |
||
195 | * @access public |
||
196 | * @since 1.0.0 |
||
197 | * @return bool |
||
198 | */ |
||
199 | public function delete( $row_id = 0 ) { |
||
216 | |||
217 | /** |
||
218 | * Check if the given table exists |
||
219 | * |
||
220 | * @since 2.4 |
||
221 | * @param string $table The table name |
||
222 | * @return bool If the table name exists |
||
223 | */ |
||
224 | public function table_exists( $table ) { |
||
230 | |||
231 | /** |
||
232 | * Check if the table was ever installed |
||
233 | * |
||
234 | * @since 2.4 |
||
235 | * @return bool Returns if the customers table was installed and upgrade routine run |
||
236 | */ |
||
237 | public function installed() { |
||
240 | |||
241 | } |
||
242 |