コード例 #1
0
 public function update()
 {
     global $wpdb;
     $query_string = "UPDATE " . $this->table_name;
     $query_string .= " SET ";
     $properties = EZP_CS_Utility::get_public_properties($this);
     foreach ($properties as $prop_name => $prop_value) {
         $type_format = EZP_CS_Utility::get_db_type_format($prop_value);
         $query_string .= "{$prop_name} = {$type_format},";
     }
     if (count($properties) > 0) {
         $query_string = substr($query_string, 0, -1);
     }
     $query_string .= " WHERE id = " . $this->id;
     $prepared_query = $wpdb->prepare($query_string, $properties);
     $wpdb->query($prepared_query);
     $this->dirty = false;
     return true;
 }