Changeset 12712 for sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications-sqlite-driver.php
- Timestamp:
- 07/05/2023 05:04:40 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications-sqlite-driver.php
r12711 r12712 51 51 } 52 52 53 /** 54 * Delete row(s) from a table. 55 * 56 * @return bool If the query ran. 57 */ 53 58 public function delete( $table, $where ) { 54 59 $fields = 'AND ' . implode( ' = %s AND ', array_keys( $where ) ) . ' = %s'; … … 57 62 array_values( $where ) 58 63 ); 59 $this->db->query( $query );64 return (bool) $this->db->query( $query ); 60 65 } 61 66 67 /** 68 * Insert a row into a table. 69 * 70 * @return bool If the query ran. 71 */ 62 72 public function insert( $table, $args ) { 63 73 $fields = "'" . implode( "', '", array_keys( $args ) ) . "'"; … … 70 80 } 71 81 82 /** 83 * Update a row in a table. 84 * 85 * @return bool If the query executed and modified rows. 86 */ 72 87 public function update( $table, $data, $wheres ) { 73 $values = [];74 $sql_sets = [];75 $sql_wheres = [];88 $values = array(); 89 $sql_sets = array(); 90 $sql_wheres = array(); 76 91 77 92 foreach ( $data as $field => $value ) { … … 81 96 $sql_sets = implode( ', ', $sql_sets ); 82 97 83 foreach ( $wheres as $field => $ where ) {98 foreach ( $wheres as $field => $value ) { 84 99 $sql_wheres[] = "$field = %s"; 85 100 $values[] = $value; … … 87 102 $sql_wheres = implode( ' AND ', $sql_wheres ); 88 103 89 if ( ! $values ) {104 if ( ! $values || ! $sql_wheres ) { 90 105 return false; 91 106 } … … 96 111 ); 97 112 98 return (bool) $this->db->query( $query ); 113 $result = $this->db->query( $query ); 114 115 return $result && $result->rowCount() > 0; 99 116 } 100 117 }
Note: See TracChangeset
for help on using the changeset viewer.