Daylight v4.9
Release Date: 1 February 2008


dt_thor_str2tdt - convert a string into a TDT

Generic Prototype

dt_thor_str2tdt(dt_Handle, dt_String, dt_Boolean) => dt_Handle

C Prototype

#include "dt_thor.h"

dt_Handle dt_thor_str2tdt(dt_Handle database, dt_Integer strlen, dt_String string, dt_Boolean merge)

FORTRAN Prototype

include ''

integer*4 dt_f_thor_str2tdt(database, string, merge)

integer*4 database
character*() string
logical merge


Converts 'string', the lexical (string) representation of a TDT, into a TDT object associated with the database 'database'.

If parameter 'merge' is FALSE, a TDT object representing only the data from 'string' will be created; the new TDT will have no timestamp, which is effectively the same as one of "eons ago", a date guaranteed to be older than any data in the database. Note that timestamp data in the string 'string' is ignored by this function. Note also that without the merge, it is possible to create a TDT object which conflicts with data in the database (eg. a TDT with the same identifier/datatype but different data).

If parameter 'merge' is TRUE, this function begins by extracting the root identifier and datatype from 'string', and uses these to read a TDT from the database (exactly like dt_thor_tdtget(3), with 'writable' = FALSE). If this operation yields a TDT, the data from 'string' are merged with this TDT. If no such TDT is found in the database, a new one is created using the data from 'string'. Its timestamp will be "eons ago" and it will be marked as "writable".

Note that if 'merge' is TRUE and a read-only TDT with the desired identifier/datatype exists or if the database is opened read-only, this function will fail since it is not possible to merge the 'string' data with the TDT.

This function does not expanded indirect data fields back into their indirect-data form. If a string contains data that is to be replaced by an indirect reference, that must be done prior to calling this function.

Return Value

Returns a TDT object or the NULL_OB if an error is detected.

Related Topics

dt_thor_tdt2str(3) dt_thor_tdtget(3) dt_thor_tdtmerge(3) dt_thor_tdtput(3) dt_thor_tdtputforced(3) dt_thor_tdtputraw(3) dt_thor_tdtrevise(3) dt_thor_xrefget(3)