1 | <?php |
||
17 | class TableAnalysis extends \EE_Base { |
||
18 | |||
19 | /** |
||
20 | * The maximum number of characters that can be indexed on a column using utf8mb4 collation, |
||
21 | * see https://events.codebasehq.com/redirect?https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/ |
||
22 | */ |
||
23 | const INDEX_COLUMN_SIZE = 191; |
||
24 | /** |
||
25 | * Returns the table name which will definitely have the wpdb prefix on the front, |
||
26 | * except if it currently has the wpdb->base_prefix on the front, in which case |
||
27 | * it will have the wpdb->base_prefix on it |
||
28 | * |
||
29 | * @global \wpdb $wpdb |
||
30 | * @param string $table_name |
||
31 | * @return string $tableName, having ensured it has the wpdb prefix on the front |
||
32 | */ |
||
33 | public function ensureTableNameHasPrefix( $table_name ) |
||
38 | |||
39 | |||
40 | |||
41 | /** |
||
42 | * Indicates whether or not the table has any entries. $table_name can |
||
43 | * optionally start with $wpdb->prefix or not |
||
44 | * @global \wpdb $wpdb |
||
45 | * @param string $table_name |
||
46 | * @return bool |
||
47 | */ |
||
48 | public function tableIsEmpty( $table_name ) |
||
58 | |||
59 | |||
60 | |||
61 | /** |
||
62 | * Indicates whether or not the table exists. $table_name can optionally |
||
63 | * have the $wpdb->prefix on the beginning, or not. |
||
64 | * @global \wpdb $wpdb |
||
65 | * @global array EZSQL_Error |
||
66 | * @param $table_name |
||
67 | * @return bool |
||
68 | */ |
||
69 | public function tableExists( $table_name ) |
||
111 | |||
112 | |||
113 | |||
114 | /** |
||
115 | * @param $table_name |
||
116 | * @param $index_name |
||
117 | * @return array of columns used on that index, Each entry is an object with the following properties { |
||
118 | * @type string Table |
||
119 | * @type string Non_unique "0" or "1" |
||
120 | * @type string Key_name |
||
121 | * @type string Seq_in_index |
||
122 | * @type string Column_name |
||
123 | * @type string Collation |
||
124 | * @type string Cardinality |
||
125 | * @type string Sub_part on a column, usually this is just the number of characters from this column to use in indexing |
||
126 | * @type string|null Packed |
||
127 | * @type string Null |
||
128 | * @type string Index_type |
||
129 | * @type string Comment |
||
130 | * @type string Index_comment |
||
131 | * } |
||
132 | */ |
||
133 | public function showIndexes($table_name, $index_name){ |
||
139 | } |
||
140 |