1
2
3
4
5
6
7
8
9gd_delete(3)                        GETDATA                       gd_delete(3)
10
11
12

NAME

14       gd_delete — remove an entry from a Dirfile
15
16

SYNOPSIS

18       #include <getdata.h>
19
20       int gd_delete(DIRFILE *dirfile, const char *field_code, unsigned int
21              flags);
22
23

DESCRIPTION

25       The gd_delete() function attempts to delete the field or  alias  speci‐
26       fied  by  field_code  from  the  dirfile  specified  by  dirfile.   The
27       field_code should not contain a representation suffix.
28
29       The flags argument influences how the deletion attempt occurs.  It  may
30       be  zero, for the default behaviour, or else one or more of the follow‐
31       ing flags, bitwise or'd together:
32
33       GD_DEL_DATA
34               If the field to be deleted is a RAW field, also delete the  bi‐
35               nary  data  file associated with it.  If field_code specified a
36               RAW field and this flag is not specified, the field will  still
37               be deleted but the binary file will be left untouched.
38
39       GD_DEL_DEREF
40               If  the field to be deleted is a CONST or CARRAY field which is
41               used as a parameter in the specification of other  fields,  re‐
42               solve  these  other  fields' dependence on the deleted field by
43               replacing instances of field_code in their field specifications
44               with the value of the scalar field.
45
46       GD_DEL_FORCE
47               Delete  the indicated entry, even if it is used in the specifi‐
48               cation of other fields, either as a input for a derived  vector
49               field  or as a scalar parameter in a field specification, or if
50               it has aliases pointing to it.
51
52       GD_DEL_META
53               If the field to be deleted has metafields attached to  it,  at‐
54               tempt  to  delete  those, too.  If the field has metafields and
55               this flag is  not  specified,  the  call  will  fail  with  the
56               GD_E_DELETE error.
57
58

RETURN VALUE

60       On  successful deletion, zero is returned.  On error, a negative-valued
61       error code is returned.  Possible error codes are:
62
63       GD_E_ACCMODE
64               The specified dirfile was opened read-only.
65
66       GD_E_ALLOC
67               The library was unable to allocate memory.
68
69       GD_E_BAD_CODE
70               The field specified by field_code was not found  in  the  data‐
71               base.
72
73       GD_E_BAD_DIRFILE
74               The supplied dirfile was invalid.
75
76       GD_E_DELETE
77               The  attempt  to delete the field failed.  Either it is used in
78               the  specification  of  other  fields   and   GD_DEL_FORCE   or
79               GD_DEL_DEREF  was  not  specified,  or  it  has  metafields and
80               GD_DEL_META was not specified.
81
82       GD_E_INTERNAL_ERROR
83               An internal error occurred in the library while trying to  per‐
84               form  the  task.   This indicates a bug in the library.  Please
85               report the incident to the GetData developers.
86
87       GD_E_IO An error occurred while trying to close or  delete  the  binary
88               file associated with a RAW field.
89
90       GD_E_PROTECTED
91               The metadata of the fragment containing the field was protected
92               from change.  Or, the deletion of the binary data file  associ‐
93               ated  with  a RAW field was attempted and the data of the frag‐
94               ment was protected.
95
96       GD_E_UNKNOWN_ENCODING
97               The GD_DEL_DATA flag was given but the encoding scheme  of  the
98               indicated format specification fragment is not known to the li‐
99               brary.  As a result, the library was unable to delete the bina‐
100               ry file associated with a RAW field.
101
102       GD_E_UNSUPPORTED
103               The  GD_DEL_DATA  flag was given but the encoding scheme of the
104               indicated format specification fragment does not support delet‐
105               ing the binary file associated with a RAW field.
106
107       The  error  code  is  also  stored in the DIRFILE object and may be re‐
108       trieved after this function returns by calling gd_error(3).  A descrip‐
109       tive   error   string   for  the  error  may  be  obtained  by  calling
110       gd_error_string(3).
111
112

HISTORY

114       The function dirfile_delete() appeared in GetData-0.5.0.
115
116       In GetData-0.7.0, this function was renamed to gd_delete().
117
118       In all GetData-0.8.x releases, passing an alias name to  this  function
119       would  delete  the  target  of the alias.  To delete an alias itself, a
120       separate function, gd_delete_alias() was available.
121
122       In GetData-0.9.0, gd_delete_alias() was removed.
123
124       In GetData-0.10.0, the error return from this function changed from  -1
125       to a negative-valued error code.
126
127

SEE ALSO

129       gd_close(3),    gd_error(3),    gd_error_string(3),    gd_metaflush(3),
130       gd_open(3)
131
132
133
134Version 0.10.0                 25 December 2016                   gd_delete(3)
Impressum