1
2
3
4
5
6
7
8
9gd_put_sarray_slice(3) GETDATA gd_put_sarray_slice(3)
10
11
12
14 gd_put_sarray, gd_put_sarray_slice — write STRING or SARRAY data to a
15 Dirfile database
16
17
19 #include <getdata.h>
20
21 int gd_put_sarray_slice(DIRFILE *dirfile, const char *field_code,
22 unsigned int start, size_t len, const char **data_in);
23
24 int gd_put_sarray(DIRFILE *dirfile, const char *field_code, const char
25 **data_in);
26
27
29 The gd_put_sarray_slice() function writes string data to a dirfile(5)
30 database specified by dirfile into the STRING or SARRAY scalar array
31 field_code. The location of the first element of the field into which
32 data is stored is given by start, and the number of elements stored is
33 given by len.
34
35 If field_code specifies a STRING field, it is treated as if it were a
36 SARRAY field of length one.
37
38 The gd_put_sarray() function behaves similarly, except the whole scalar
39 array is written, as if gd_put_sarray_slice() were called with start
40 equal zero and len equal to the value returned by gd_array_len(3).
41
42 The argument data_in must point to an array of pointers to character
43 strings, which are the values to store. The number of elements which
44 will be stored by gd_put_sarray() may be obtained by calling
45 gd_array_len(3). Unlike gd_putdata(3), writing data past the end of
46 the field is not permitted. To add data to a SARRAY, first increase
47 its length by calling gd_alter_sarray(3), or another equivalent func‐
48 tion.
49
50 The gd_put_string(3) function provides another way of writing data to a
51 STRING field.
52
53
55 On success, gd_put_sarray() and gd_put_sarray_slice() return zero. On
56 error, they return a negative-valued error code. Possible error codes
57 are:
58
59 GD_E_ACCMODE
60 The specified dirfile was opened read-only.
61
62 GD_E_ALLOC
63 The library was unable to allocate memory.
64
65 GD_E_BAD_CODE
66 The field specified by field_code was not found in the data‐
67 base.
68
69 GD_E_BAD_DIRFILE
70 An invalid dirfile was supplied.
71
72 GD_E_BAD_FIELD_TYPE
73 The supplied field_code was not a STRING nor a SARRAY.
74
75 GD_E_BOUNDS
76 A request for data beyond the end of the field was made.
77
78 GD_E_INTERNAL_ERROR
79 An internal error occurred in the library while trying to per‐
80 form the task. This indicates a bug in the library. Please
81 report the incident to the maintainer.
82
83 GD_E_PROTECTED
84 The fragment containing the constant was protected from change.
85
86 The error code is also stored in the DIRFILE object and may be re‐
87 trieved after this function returns by calling gd_error(3). A descrip‐
88 tive error string for the error may be obtained by calling
89 gd_error_string(3).
90
91
93 The gd_put_sarray() and gd_put_sarray_slice() functions appeared in
94 GetData-0.10.0.
95
96
98 dirfile(5), gd_array_len(3), gd_sarrays(3), gd_error(3),
99 gd_error_string(3), gd_get_sarray_slice(3), gd_open(3),
100 gd_put_string(3)
101
102
103
104Version 0.10.0 25 December 2016 gd_put_sarray_slice(3)