Difference between revisions of "Truxton media save"

From truxwiki.com
Jump to navigation Jump to search
 
Line 1: Line 1:
 
This will commit the data in the media object to the database.
 
This will commit the data in the media object to the database.
It will write a record to the <code>[Media]</code> table.
+
It will write a record to the <code><nowiki>[</nowiki>[[Media Table|Media]]<nowiki>]</nowiki></code> table.
  
 
=Syntax=
 
=Syntax=

Latest revision as of 07:36, 3 February 2024

This will commit the data in the media object to the database. It will write a record to the [Media] table.

Syntax

int truxton_media_save( uint64_t media_handle );

Parameters

media_handle

The handle created by the truxton_media_open_id or truxton_media_create call.

Return value

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

Sample

void add_media( uint64_t truxton )
{
   uint64_t media = truxton_media_create( truxton );

   truxton_media_set_type( media, MEDIA_TYPE_PHONE );
   truxton_media_set_name( media, "Sam's Phone" );
   truxton_media_set_description( media, "Found in booth 4 of the Grog Grotto" );
   truxton_media_set_originator( media, "M. Mouse" );
   truxton_media_set_case_number( media, "WDW-20200726-420-MM" );
   truxton_media_set_latitude( media, 28.40589107430242 );
   truxton_media_set_longitude( media, -81.58544840872418 );
   truxton_media_set_status( media, MEDIA_STATUS_READY_FOR_LOADING );

   if ( truxton_media_save( media ) == 0 )
   {
      printf( "Failed to add child to Truxton\n" );
   }

   truxton_media_destroy( media );
}