Truxton relation get relation

From truxwiki.com
Revision as of 08:16, 17 January 2021 by Sam (talk | contribs) (Created page with "This retrieves the type of relation between the two objects in Truxton. This corresponds to the <code>[RelationTypeID]</code> column of the <code><nowiki>[</nowiki>Relation...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This retrieves the type of relation between the two objects in Truxton. This corresponds to the [RelationTypeID] column of the [Relation] table.

Syntax

uint64_t truxton_relation_get_relation( uint64_t relation_handle );

Parameters

relation_handle

This handle comes from calling truxton_relation_create()

Return value

The type of the object as stored in the [RelationTypeID] column in the [Relation] table. It should also be one of the defined constant values and present in the [ID] column of the [RelationType] reference table in the database.

Sample

void dump_relation(uint64_t relation_handle)
{
   uint64_t value = 0;
   char guid_string[ 65 ];

   value = truxton_relation_get_a_type( relation_handle );
   truxton_relation_get_a_id( relation_handle, guid_string, sizeof( guid_string ) );
   printf( "A (%" PRIu64 ") %s is a ", value, guid_string );

   value = truxton_relation_get_relation( relation_handle );
   printf( "%" PRIu64 " of ", value );

   value = truxton_relation_get_b_type( relation_handle );
   truxton_relation_get_b_id( relation_handle, guid_string, sizeof( guid_string ) );
   printf( "B (%" PRIu64 ") %s is a ", value, guid_string );

   value = truxton_relation_get_source_type( relation_handle );
   truxton_relation_get_source_id( relation_handle, guid_string, sizeof( guid_string ) );

   printf( "Source (%" PRIu64 ") is %s\n", value, guid_string );   
}