1dirfile_delete(3) GETDATA dirfile_delete(3)
2
3
4
6 dirfile_delete — remove a field from a dirfile
7
9 #include <getdata.h>
10
11 int dirfile_delete(DIRFILE *dirfile, const char *field_code, int
12 flags);
13
15 The dirfile_delete() function attempts to delete the field specified by
16 field_code in the dirfile specified by dirfile. The field_code should
17 not contain a representation suffix.
18
19 The flags argument influences how the deletion attempt occurs. It may
20 be zero, for the default behaviour, or else one or more of the follow‐
21 ing flags, bitwise or'd together:
22
23 GD_DEL_DATA
24 If the field to be deleted is a RAW field, also delete the bi‐
25 nary data file associated with it. If field_code specified a
26 RAW field and this flag is not specified, the field will still
27 be deleted but the binary file will be left untouched.
28
29 GD_DEL_DEREF
30 If the field to be deleted is a CONST field which is used as a
31 parameter in the specification of other fields, resolve these
32 other fields dependence on field_code by replacing instances of
33 field_code in their field specifications with the value of the
34 CONST field.
35
36 GD_DEL_FORCE
37 Delete the specified field even if it is used in the specifica‐
38 tion of other fields, either as a input for a derived vector
39 field or as a CONST parameter in a field specification.
40
41 GD_DEL_META
42 If the field to be deleted has metafields attached to it, at‐
43 tempt to delete those, too. If the field has metafields and
44 this flag is not specified, the call will fail with the
45 GD_E_DELETE error.
46
48 On successful deletion, zero is returned. On error, -1 is returned and
49 the dirfile error is set to a non-zero error value. Possible error
50 values are:
51
52 GD_E_ACCMODE
53 The specified dirfile was opened read-only.
54
55 GD_E_ALLOC
56 The library was unable to allocate memory.
57
58 GD_E_BAD_CODE
59 The field specified by field_code was not found in the data‐
60 base.
61
62 GD_E_BAD_DIRFILE
63 The supplied dirfile was invalid.
64
65 GD_E_DELETE
66 The attempt to delete the field failed. Either the specified
67 field is used in the specification of other fields and
68 GD_DEL_FORCE or GD_DEL_DEREF was not specified, or it has
69 metafields and GD_DEL_META was not specified.
70
71 GD_E_INTERNAL_ERROR
72 An internal error occurred in the library while trying to per‐
73 form the task. This indicates a bug in the library. Please
74 report the incident to the GetData developers.
75
76 GD_E_PROTECTED
77 The metadata of the fragment containing the field was protected
78 from change. Or, the deletion of the binary data file associ‐
79 ated with a RAW field was attempted and the data of the frag‐
80 ment was protected.
81
82 GD_E_RAW_IO
83 An error occurred while trying to close or delete the binary
84 file associated with a RAW field.
85
86 GD_E_UNKNOWN_ENCODING
87 The GD_DEL_DATA flag was specified but the encoding scheme of
88 the specified format file fragment is not known to the library.
89 As a result, the library was unable to delete the binary file
90 associated with a RAW field.
91
92 GD_E_UNSUPPORTED
93 The GD_DEL_DATA flag was specified but the encoding scheme of
94 the specified format file fragment does not support deleting
95 the binary file associated with a RAW field.
96
97 The dirfile error may be retrieved by calling get_error(3). A descrip‐
98 tive error string for the last error encountered can be obtained from a
99 call to get_error_string(3).
100
102 dirfile_open(3), dirfile_close(3), dirfile_metaflush(3), get_error(3),
103 get_error_string(3)
104
105
106
107Version 0.6.0 19 October 2009 dirfile_delete(3)