#include "dbinc.h" /***************************************************************************** * * * COMMON OCEANOGRAPHIC DATA ACCESS SYSTEM (CODAS) * * * * WRITTEN BY: RAMON CABRERA, ERIC FIRING, and JULIE RANADA * * JOINT INSTITUTE FOR MARINE AND ATMOSPHERIC RESEARCH * * 1000 POPE ROAD MSB 404 * * HONOLULU, HI 96822 * * * * VERSION: 3.00 * * * * DATE: APRIL 1989 * * * *****************************************************************************/ /* FILE: dbdelete.c FUNCTIONS FOR DELETING BLOCKS/PROFILES FROM AN EXISTING DATABASE */ /*----------------------------------------------------------------------------- FUNCTION: DBDELBLK It deletes the current block from the database. PARAMETER: ierr = pointer to error code RETURNS: VOID */ void DBDELBLK(int *ierr) { *ierr = 0; if ((!(db_ptr)) || first_database_call) { *ierr = DB_IS_NOT_OPEN; return; } if (!(db_ptr->block_is_open)) { *ierr = NO_BLOCK_IS_OPEN; return; } if (db_ptr->new_block_is_open) { *ierr = NEW_BLOCK_IS_OPEN; return; } if (db_ptr->block_dir_entry_ptr->file_id > 0) db_ptr->block_dir_entry_ptr->file_id = -db_ptr->block_dir_entry_ptr->file_id; if (write_block_dir_entry()) { report_db_error("DBDELBLK"); *ierr = db_ptr->error_code * 1000 - db_ptr->error_data; } db_ptr->block_dir_modified = 1; } /*----------------------------------------------------------------------------- FUNCTION: DBDELPRF It deletes the current profile from the database. PARAMETERS: ierr = pointer to error code RETURNS: VOID */ void DBDELPRF(int *ierr) { *ierr = 0; if ((!(db_ptr)) || first_database_call) { *ierr = DB_IS_NOT_OPEN; return; } if (!(db_ptr->block_is_open)) { *ierr = NO_BLOCK_IS_OPEN; return; } if (db_ptr->new_block_is_open) { *ierr = NEW_BLOCK_IS_OPEN; return; } if (!(db_ptr->profile_is_open)) { *ierr = NO_PROFILE_IS_OPEN; return; } if (db_ptr->profile_dir_entry_ptr->ofs > 0) db_ptr->profile_dir_entry_ptr->ofs = -db_ptr->profile_dir_entry_ptr->ofs; if (write_profile_dir_entry()) { report_db_error("DBDELPRF"); *ierr = db_ptr->error_code * 1000 - db_ptr->error_data; } db_ptr->block_modified = 1; }