Difference between revisions of "Truxton url save"
Jump to navigation
Jump to search
(Created page with "This commits the information in the URL object to the <code><nowiki>[</nowiki>WebsiteVisit<nowiki>]</nowiki></code> table in the database. =Syntax= <s...") |
|||
| (2 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
=Syntax= | =Syntax= | ||
<source lang="C"> | <source lang="C"> | ||
| − | + | int truxton_url_save( uint64_t url_handle ); | |
</source> | </source> | ||
| Line 10: | Line 10: | ||
The URL object to write to the database. | The URL object to write to the database. | ||
This handle comes from calling <code>[[truxton_url_create]]()</code>, or <code>[[truxton_file_create_url]]()</code>. | This handle comes from calling <code>[[truxton_url_create]]()</code>, or <code>[[truxton_file_create_url]]()</code>. | ||
| + | |||
| + | =Return value= | ||
| + | A non-zero value on success, zero on failure. | ||
=Sample= | =Sample= | ||
| Line 36: | Line 39: | ||
// Commit the data to the database | // Commit the data to the database | ||
| − | truxton_url_save( url ); | + | if ( truxton_url_save( url ) == 0 ) |
| + | { | ||
| + | printf( "Cannot save URL to the database\n" ); | ||
| + | } | ||
| + | |||
truxton_url_destroy( url ); | truxton_url_destroy( url ); | ||
} | } | ||
</source> | </source> | ||
Latest revision as of 14:46, 25 May 2021
This commits the information in the URL object to the [WebsiteVisit] table in the database.
Syntax
int truxton_url_save( uint64_t url_handle );
Parameters
url_handle
The URL object to write to the database.
This handle comes from calling truxton_url_create(), or truxton_file_create_url().
Return value
A non-zero value on success, zero on failure.
Sample
void add_home_url( uint64_t truxton, uint64_t media, uint64_t child_file, char const * url_address, uint64_t when )
{
char media_id[ 65 ];
char file_id[ 65 ];
truxton_media_get_id( media, media_id, sizeof( media_id ) );
truxton_child_file_get_id( child_file, file_id, sizeof( file_id ) );
uint64_t url = truxton_url_create( truxton );
truxton_url_set_account( url, "admin" );
truxton_url_set_account_offset( url, -1 );
truxton_url_set_file_id( url, file_id );
truxton_url_set_media_id( url, media_id );
truxton_url_set_format( url, URL_FORMAT_ASCII );
truxton_url_set_local_filename( url, "document.htm" );
truxton_url_set_method( url, URL_METHOD_TYPE_USER_TYPED_IT_IN );
truxton_url_set_type( url, URL_TYPE_CHROME_HISTORY );
truxton_url_set_url( url, url_address );
truxton_url_set_url_offset( url, -1 );
truxton_url_set_when( when );
// Commit the data to the database
if ( truxton_url_save( url ) == 0 )
{
printf( "Cannot save URL to the database\n" );
}
truxton_url_destroy( url );
}