Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
.. _dpiSodaCollFunctions:

ODPI-C SODA Collection Functions
--------------------------------

SODA collection handles are used to represent SODA collections in the database.
They are created by calling one of the functions
:func:`dpiSodaDb_createCollection()`, :func:`dpiSodaDb_openCollection()` or
:func:`dpiSodaCollCursor_getNext()` and are destroyed when the last reference
is released by calling the function :func:`dpiSodaColl_release()`.

See `this tracking issue <https://github.com/oracle/odpi/issues/110>`__ for
known issues with SODA.

.. function:: int dpiSodaColl_addRef(dpiSodaColl* coll)

    Adds a reference to the SODA collection. This is intended for situations
    where a reference to the collection needs to be maintained independently of
    the reference returned when the collection was created.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection to which a reference is to be added.
            If the reference is NULL or invalid, an error is returned.

.. function:: int dpiSodaColl_createIndex(dpiSodaColl* coll, \
        const char* indexSpec, uint32_t indexSpecLength, uint32_t flags)

    Create an index on the collection, which can improve the performance of
    SODA query-by-examples (QBE). An index is defined by a specification,
    which is a JSON-encoded string that specifies how particular QBE patterns
    are to be indexed for quicker matching. See
    `Overview of SODA indexing
    <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
    id=GUID-4848E6A0-58A7-44FD-8D6D-A033D0CCF9CB>`__.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection on which the index is to be created.
            If the reference is NULL or invalid, an error is returned.
        * - ``indexSpec``
          - IN
          - The JSON specification of the index as a byte string in the
            encoding used for CHAR data.
        * - ``indexSpecLength``
          - IN
          - The length of the specification of the index, in bytes.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.

.. function:: int dpiSodaColl_drop(dpiSodaColl* coll, uint32_t flags, \
        int* isDropped)

    Drops a SODA collection from the database.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection which is to be dropped. If the
            reference is NULL or invalid, an error is returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``isDropped``
          - OUT
          - A pointer to a boolean which indicates whether the collection was
            dropped (1) or not (0). If this information is not needed, NULL
            can also be passed.

.. function:: int dpiSodaColl_dropIndex(dpiSodaColl* coll, const char* name, \
        uint32_t nameLength, uint32_t flags, int* isDropped)

    Drop an index on the collection.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection on which the index is to be dropped.
            If the reference is NULL or invalid, an error is returned.
        * - ``name``
          - IN
          - The name of the index that is to be dropped as a byte string in
            the encoding used for CHAR data.
        * - ``indexSpecLength``
          - IN
          - The length of the index name, in bytes.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``isDropped``
          - OUT
          - A pointer to a boolean which indicates whether the specified index
            was dropped (1) or not (0). If this information is not needed,
            NULL can also be passed.

.. function:: int dpiSodaColl_find(dpiSodaColl* coll, \
        const dpiSodaOperOptions* options, uint32_t flags, \
        dpiSodaDocCursor** cursor)

    Finds all of the documents in the collection that match the specified
    options.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection which is to be searched. If the
            reference is NULL or invalid, an error is returned.
        * - ``options``
          - IN
          - A pointer to a structure of type
            :ref:`dpiSodaOperOptions<dpiSodaOperOptions>` which specifies
            options for restricting the number of documents returned. This
            value can also be NULL which will result in all documents in the
            collection being returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``cursor``
          - OUT
          - A pointer to a reference to the cursor that is populated if the
            function completes successfully. The reference that is returned
            should be released using :func:`dpiSodaDocCursor_release()` when
            it is no longer needed.

.. function:: int dpiSodaColl_findOne(dpiSodaColl* coll, \
        const dpiSodaOperOptions* options, uint32_t flags, dpiSodaDoc** doc)

    Finds a single document in the collection that matches the specified
    options.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection which is to be searched. If the
            reference is NULL or invalid, an error is returned.
        * - ``options``
          - IN
          - A pointer to a structure of type
            :ref:`dpiSodaOperOptions<dpiSodaOperOptions>` which specifies
            options for restricting the document that is returned. This
            value can also be NULL which will result in the first document in
            the collection being returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``doc``
          - OUT
          - A pointer to a reference to the document that is populated if
            the function completes successfully. The reference that is
            returned should be released using :func:`dpiSodaDoc_release()`
            when it is no longer needed. If no document matches the specified
            options, the value NULL is returned instead.

.. function:: int dpiSodaColl_getDataGuide(dpiSodaColl* coll, \
        uint32_t flags, dpiSodaDoc** doc)

    Returns a document containing the data guide for the collection. See
    `JSON Data Guide <https://www.oracle.com/pls/topic/lookup?ctx=dblatest&
    id=GUID-219FC30E-89A7-4189-BC36-7B961A24067C>`__.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection from which the data guide is to be
            retrieved. If the reference is NULL or invalid, an error is
            returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``doc``
          - OUT
          - A pointer to a reference to the document that is populated if the
            function completes successfully. The document reference that is
            returned should be released using :func:`dpiSodaDoc_release()`
            when it is no longer needed. If no data guide is available
            because the collection contains no documents, then a NULL
            reference is returned.

.. function:: int dpiSodaColl_getDocCount(dpiSodaColl* coll, \
        const dpiSodaOperOptions* options, uint32_t flags, uint64_t* count)

    Returns the number of documents in the collection that match the specified
    options.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection which is to be searched. If the
            reference is NULL or invalid, an error is returned.
        * - ``options``
          - IN
          - A pointer to a structure of type
            :ref:`dpiSodaOperOptions<dpiSodaOperOptions>` which specifies
            options for restricting the number of documents found. This value
            can also be NULL which will result in all of the documents in the
            collection being counted.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``count``
          - OUT
          - A pointer to a count of the number of documents found that is
            populated if the function completes successfully.

.. function:: int dpiSodaColl_getMetadata(dpiSodaColl* coll, \
        const char** value, uint32_t* valueLength)

    Returns the metadata for the collection.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection from which the metadata is to be
            retrieved. If the reference is NULL or invalid, an error is
            returned.
        * - ``value``
          - IN
          - A pointer to the collection metadata, as a byte string in the
            encoding used for CHAR data, which will be populated upon
            successful completion of this function. The string returned will
            remain valid as long as a reference to the collection is held.
        * - ``valueLength``
          - OUT
          - A pointer to the length of the collection metadata, in bytes,
            which will be populated upon successful completion of this
            function.

.. function:: int dpiSodaColl_getName(dpiSodaColl* coll, \
        const char** value, uint32_t* valueLength)

    Returns the name of the collection.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection from which the name is to be
            retrieved. If the reference is NULL or invalid, an error is
            returned.
        * - ``value``
          - IN
          - A pointer to the collection name, as a byte string in the encoding
            used for CHAR data, which will be populated upon successful
            completion of this function. The string returned will remain valid
            as long as a reference to the collection is held.
        * - ``valueLength``
          - OUT
          - A pointer to the length of the collection name, in bytes, which
            will be populated upon successful completion of this function.

.. function:: int dpiSodaColl_insertMany(dpiSodaColl* coll, uint32_t numDocs, \
        dpiSodaDoc** docs, uint32_t flags, dpiSodaDoc** insertedDocs)

    Inserts multiple documents into the collection and optionally returns
    result documents containing information about the newly inserted documents.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.
    On failure the offset attribute in the :ref:`dpiErrorInfo<dpiErrorInfo>`
    structure will contain the index into the SODA document handles array where
    the error took place.

    NOTE: this function requires Oracle Client 18.5 or higher in addition to
    the usual SODA requirements and is currently available only as a preview.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection into which the documents are to be
            inserted. If the reference is NULL or invalid, an error is
            returned.
        * - ``numDocs``
          - IN
          - The length of the arrays passed for the docs and insertedDocs
            parameters.
        * - ``docs``
          - IN
          - An array of SODA document handles which will be inserted into the
            collection. The length of the array is determined by the numDocs
            parameter.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``insertedDocs``
          - OUT
          - A pointer to an array of document references that will be
            populated upon successful completion of this function. The length
            of the array is determined by the numDocs parameter. Call the
            function :func:`dpiSodaDoc_release()` for each of the elements of
            this array when the references contained in the array are no longer
            needed. This parameter can also be NULL if this information is not
            required.

.. function:: int dpiSodaColl_insertManyWithOptions(dpiSodaColl* coll, \
        uint32_t numDocs, dpiSodaDoc** docs, dpiSodaOperOptions* options, \
        uint32_t flags, dpiSodaDoc** insertedDocs)

    Inserts multiple documents into the collection and optionally returns
    result documents containing information about the newly inserted documents.
    In addition, options can be supplied to modify how the documents are
    inserted or returned.

    This function requires Oracle Client 21.3 or higher to be used in addition
    to the normal SODA requirements (also available in Oracle Client 19 from
    19.11).

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.
    On failure the offset attribute in the :ref:`dpiErrorInfo<dpiErrorInfo>`
    structure will contain the index into the SODA document handles array where
    the error took place.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection into which the documents are to
            be inserted. If the reference is NULL or invalid, an error is
            returned.
        * - ``numDocs``
          - IN
          - The length of the arrays passed for the docs and insertedDocs
            parameters.
        * - ``docs``
          - IN
          - An array of SODA document handles which will be inserted into
            the collection. The length of the array is determined by the
            numDocs parameter.
        * - ``options``
          - IN
          - A pointer to a :ref:`dpiSodaOperOptions <dpiSodaOperOptions>`
            structure containing any desired options, or NULL. If the value
            is NULL, this function behaves identically to
            :func:`dpiSodaColl_insertMany()`. Options can only be specified
            with Oracle Client 21.3 or higher (also available in Oracle Client
            19 from 19.11).
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``insertedDocs``
          - OUT
          - A pointer to an array of document references that will be
            populated upon successful completion of this function. The length
            of the array is determined by the numDocs parameter. Call the
            function :func:`dpiSodaDoc_release()` for each of the elements of
            this array when the references contained in the array are no
            longer needed. This parameter can also be NULL if this information
            is not required.

.. function:: int dpiSodaColl_insertOne(dpiSodaColl* coll, dpiSodaDoc* doc, \
        uint32_t flags, dpiSodaDoc** insertedDoc)

    Inserts a document into the collection and optionally returns it.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection into which the document is to be
            inserted. If the reference is NULL or invalid, an error is
            returned.
        * - ``doc``
          - IN
          - A reference to the document which is to be inserted into the
            collection. If the reference is NULL or invalid, an error is
            returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``insertedDoc``
          - OUT
          - A pointer to a document reference that will be populated upon
            successful completion of this function. Call the function
            :func:`dpiSodaDoc_release()` when it is no longer needed. This
            parameter can also be NULL if this information is not required.

.. function:: int dpiSodaColl_insertOneWithOptions(dpiSodaColl* coll, \
        dpiSodaDoc* doc, dpiSodaOperOptions* options, uint32_t flags, \
        dpiSodaDoc** insertedDoc)

    Inserts a document into the collection and optionally returns it. In
    addition, options can be supplied to modify how the document is inserted or
    returned.

    This method requires Oracle Client 21.3 or higher to be used in addition to
    the normal SODA requirements (also available in Oracle Client 19 from
    19.11).

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection into which the document is to be
            inserted. If the reference is NULL or invalid, an error is
            returned.
        * - ``doc``
          - IN
          - A reference to the document which is to be inserted into the
            collection. If the reference is NULL or invalid, an error is
            returned.
        * - ``options``
          - IN
          - A pointer to a :ref:`dpiSodaOperOptions <dpiSodaOperOptions>`
            structure containing any desired options, or NULL. If the value is
            NULL, this function behaves identically to
            :func:`dpiSodaColl_insertOne()`. Options can only be specified
            with Oracle Client 21.3 or higher (also available in Oracle Client
            19 from 19.11).
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``insertedDoc``
          - OUT
          - A pointer to a document reference that will be populated upon
            successful completion of this function. Call the function
            :func:`dpiSodaDoc_release()` when it is no longer needed. This
            parameter can also be NULL if this information is not required.

.. function:: int dpiSodaColl_listIndexes(dpiSodaColl* coll, \
        uint32_t flags, dpiStringList* list)

    Returns a list of indexes associated with the collection.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection from which the list of indexes is to
            be retrieved. If the reference is NULL or invalid, an error is
            returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``list``
          - OUT
          - A pointer to a structure of type
            :ref:`dpiStringList<dpiStringList>` which is populated if the
            function completes successfully. The memory associated with this
            list should be freed by calling :func:`dpiContext_freeStringList()`
            when it is no longer needed.

.. function:: int dpiSodaColl_release(dpiSodaColl* coll)

    Releases a reference to the SODA collection. A count of the references to
    the collection is maintained and when this count reaches zero, the memory
    associated with the collection is freed.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection from which a reference is to be
            released. If the reference is NULL or invalid, an error is
            returned.

.. function:: int dpiSodaColl_remove(dpiSodaColl* coll, \
        const dpiSodaOperOptions* options, uint32_t flags, uint64_t* count)

    Removes all of the documents in the collection that match the specified
    options.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection from which documents are to be
            removed. If the reference is NULL or invalid, an error is
            returned.
        * - ``options``
          - IN
          - A pointer to a structure of type
            :ref:`dpiSodaOperOptions<dpiSodaOperOptions>` which specifies
            options for restricting the number of documents removed. This
            value can also be NULL which will result in all documents in the
            collection being removed.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``count``
          - OUT
          - A pointer to a count of the number of documents removed that is
            populated if the function completes successfully.

.. function:: int dpiSodaColl_replaceOne(dpiSodaColl* coll, \
        const dpiSodaOperOptions* options, dpiSodaDoc* doc, uint32_t flags, \
        int* replaced, dpiSodaDoc** replacedDoc)

    Replaces the single document in the collection matching the given options
    with the new document.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection in which the document is to be
            replaced. If the reference is NULL or invalid, an error is
            returned.
        * - ``options``
          - IN
          - A pointer to a structure of type
            :ref:`dpiSodaOperOptions<dpiSodaOperOptions>` which identifies
            options for specifying the document which is to be replaced.
            Currently at least the :member:`dpiSodaOperOptions.key` member
            must be specified or the error "ORA-40734: key for the document to
            replace must be specified using the key attribute" will be raised.
        * - ``doc``
          - IN
          - A reference to the document which is to replace the document in
            the collection found using the provided options. If the reference
            is NULL or invalid, an error is returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``replaced``
          - OUT
          - A pointer to a boolean value indicating if the document was
            replaced (1) or not (0). This parameter may also be NULL if this
            information is not required.
        * - ``replacedDoc``
          - OUT
          - A pointer to a document reference which will be populated when
            this function returns successfully. Call the function
            :func:`dpiSodaDoc_release()` when the reference is no longer
            needed. This parameter can also be NULL if this information is not
            required.

.. function:: int dpiSodaColl_save(dpiSodaColl* coll, dpiSodaDoc* doc, \
        uint32_t flags, dpiSodaDoc** savedDoc)

    Saves a document into the collection. This method is equivalent to
    :func:`dpiSodaColl_insertOne()` except that if client-assigned keys are
    used, and the document with the specified key already exists in the
    collection, it will be replaced with the input document.

    This method requires Oracle Client 19.9 or higher to be used in addition to
    the normal SODA requirements.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection in which the document is to be
            saved. If the reference is NULL or invalid, an error is returned.
        * - ``doc``
          - IN
          - A reference to the document which is to be saved into the
            collection. If the reference is NULL or invalid, an error is
            returned.
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``savedDoc``
          - OUT
          - A pointer to a document reference which will be populated when
            this function returns successfully. Call the function
            :func:`dpiSodaDoc_release()` when the reference is no longer
            needed. This parameter can also be NULL if this information is not
            required.

.. function:: int dpiSodaColl_saveWithOptions(dpiSodaColl* coll, \
        dpiSodaDoc* doc, dpiSodaOperOptions* options, uint32_t flags, \
        dpiSodaDoc** savedDoc)

    Saves a document into the collection. This method is equivalent to
    :func:`dpiSodaColl_insertOneWithOptions()` except that if client-assigned
    keys are used, and the document with the specified key already exists in
    the collection, it will be replaced with the input document.

    This method requires Oracle Client 21.3 or higher to be used in addition to
    the normal SODA requirements (also available in Oracle Client 19 from
    19.11).

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection in which the document is to be saved.
            If the reference is NULL or invalid, an error is returned.
        * - ``doc``
          - IN
          - A reference to the document which is to be saved into the
            collection. If the reference is NULL or invalid, an error is
            returned.
        * - ``options``
          - IN
          - A pointer to a :ref:`dpiSodaOperOptions <dpiSodaOperOptions>`
            structure containing any desired options, or NULL. If the value is
            NULL, this function behaves identically to
            :func:`dpiSodaColl_save()`. Options can only be specified with
            Oracle Client 21.3 or higher (also available in Oracle Client 19
            from 19.11).
        * - ``flags``
          - IN
          - One or more of the values from the enumeration
            :ref:`dpiSodaFlags<dpiSodaFlags>`, OR'ed together.
        * - ``savedDoc``
          - OUT
          - A pointer to a document reference which will be populated when
            this function returns successfully. Call the function
            :func:`dpiSodaDoc_release()` when the reference is no longer
            needed. This parameter can also be NULL if this information is not
            required.

.. function:: int dpiSodaColl_truncate(dpiSodaColl* coll)

    Removes all of the documents in a SODA collection in a similar manner to
    a TRUNCATE TABLE statement.

    The function returns DPI_SUCCESS for success and DPI_FAILURE for failure.

    .. parameters-table::

        * - ``coll``
          - IN
          - A reference to the collection in which all of the documents are to
            be removed. If the reference is NULL or invalid, an error is
            returned.