@@ 89-105 (lines=17) @@ | ||
86 | * |
|
87 | * @return bool |
|
88 | */ |
|
89 | public function delete_row( $log_id = 0 ) { |
|
90 | /* @var WPDB $wpdb */ |
|
91 | global $wpdb; |
|
92 | ||
93 | // Row ID must be positive integer |
|
94 | $log_id = absint( $log_id ); |
|
95 | ||
96 | if ( empty( $log_id ) ) { |
|
97 | return false; |
|
98 | } |
|
99 | ||
100 | if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE log_id = %d", $log_id ) ) ) { |
|
101 | return false; |
|
102 | } |
|
103 | ||
104 | return true; |
|
105 | } |
|
106 | ||
107 | /** |
|
108 | * Check if current id is valid |
@@ 354-370 (lines=17) @@ | ||
351 | * |
|
352 | * @return bool |
|
353 | */ |
|
354 | public function delete( $row_id = 0 ) { |
|
355 | /* @var WPDB $wpdb */ |
|
356 | global $wpdb; |
|
357 | ||
358 | // Row ID must be positive integer |
|
359 | $row_id = absint( $row_id ); |
|
360 | ||
361 | if ( empty( $row_id ) ) { |
|
362 | return false; |
|
363 | } |
|
364 | ||
365 | if ( false === $wpdb->query( $wpdb->prepare( "DELETE FROM $this->table_name WHERE $this->primary_key = %d", $row_id ) ) ) { |
|
366 | return false; |
|
367 | } |
|
368 | ||
369 | return true; |
|
370 | } |
|
371 | ||
372 | /** |
|
373 | * Check if the given table exists |