/**
  * remove database table of current ListTable object
  * remove corresponding database table of ListTableNote object
  * remove corresponding ListTableDescription record
  * @return bool indicates if database table has been removed
  */
 function drop()
 {
     global $list_table_description;
     $this->_log->trace("drop ListTable (table_name=" . $this->table_name . ")");
     # remove ListTableDescription record
     if ($list_table_description->delete($this->list_title) == FALSE) {
         # copy error strings from _list_table_description
         $this->error_message_str = $list_table_description->get_error_message_str();
         $this->error_log_str = $list_table_description->get_error_log_str();
         $this->error_str = $list_table_description->get_error_str();
         return FALSE;
     }
     # drop table for notes only if a notes field exists
     $found_notes_field = FALSE;
     foreach ($this->fields as $field) {
         if ($field[1] == FIELD_TYPE_DEFINITION_NOTES_FIELD) {
             $found_notes_field = TRUE;
         }
     }
     if ($found_notes_field) {
         if ($this->_list_table_note->drop() == FALSE) {
             # copy error strings from _list_table_note
             $this->error_message_str = $this->_list_table_note->get_error_message_str();
             $this->error_log_str = $this->_list_table_note->get_error_log_str();
             $this->error_str = $this->_list_table_note->get_error_str();
             return FALSE;
         }
     }
     # call parent drop()
     if (parent::drop() == FALSE) {
         return FALSE;
     }
     $this->_log->trace("dropped ListTable (table_name=" . $this->table_name . ")");
     return TRUE;
 }
示例#2
0
/**
 * update list item
 */
function update_list_item()
{
    $list_table = new ListTable(REGRESSION_TEST_LIST_TITLE);
    $list_table_note = new ListTableNote(REGRESSION_TEST_LIST_TITLE);
    $results = $list_table->select_record("_id=10");
    # get second note of first notes column
    $note_field = $results[REGRESSION_TEST_LIST_NOTES1_FIELD][1];
    $note_array = array($note_field["_id"], $note_field["_note"]);
    if ($list_table_note->update($note_field["_id"], $note_field["_note"] . " [UPDATED BY REGRESSION TEST]") == TRUE) {
        return TRUE;
    }
    return FALSE;
}