Truxton investigation event save

From truxwiki.com
Jump to navigation Jump to search

This writes an investigation event to the the [InvestigationEvent] table in the database.

Syntax

uint64_t truxton_investigation_event_save( uint64_t event_handle );

Parameters

event_handle

This handle comes from calling truxton_investigation_event_create().

Return value

A non-zero value on success, zero on failure.

Sample

void create_event( void )
{
   uint64_t truxton = truxton_create();

   uint64_t event = truxton_investigation_event_create( truxton );

   truxton_investigation_event_set_id(event , "C229B12A-BDBC-4526-BC91-574FDCE0D650"); 
   truxton_investigation_event_set_investigation_id(event , "01da7796-a010-3685-0000-018902cb3b22");
   truxton_investigation_event_set_color(event , 0xFF9E1B18);
   truxton_investigation_event_set_text(event , "Case Opened");
   truxton_investigation_event_set_status(event , INVESTIGATION_STATUS_OPEN);
   truxton_investigation_event_set_type(event , INVESTIGATION_EVENT_TYPE_STATUS_CHANGE);
   truxton_investigation_event_set_when(event , truxton_time_now());

   if ( truxton_investigation_event_save( event ) == 0 )
   {
      printf( "Cannot save investigation event to the database.\n" );
   }

   truxton_investigation_event_destroy(event);
   truxton_destroy( truxton );
}