Truxton artifact set file id

From truxwiki.com
Jump to navigation Jump to search

This sets the source file of the artifact.

Syntax

void truxton_artifact_set_file_id( uint64_t artifact_handle, char const * id );

Parameters

artifact_handle

The handle to an artifact created by the truxton_artifact_create call.

id

The string representation of a GUID. It corresponds to the [FileID] column of the [Entity] table.

Remarks

This identifier should be a value from the [ID] column of the [File] table in the database.

Sample

void create_artifact( char const * file_id )
{
   uint64_t truxton = truxton_create();

   uint64_t artifact= truxton_artifact_create( truxton );

   truxton_artifact_set_file_id( artifact, file_id );
   truxton_artifact_set_name( artifact, "Ducky Momo Server" );
   truxton_artifact_save( artifact );
   truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 );

   char id[ 65 ];

   truxton_artifact_get_id( artifact, id, sizeof( id ) );

   printf( "Artifact ID is %s\n", id );

   truxton_artifact_destroy( artifact );
   truxton_destroy( truxton );
}