Open topic with navigation

TIBCO® Patterns 6.1.2

# Deleting Records From a Database (lkt_dbrecdelete)

The following command deletes one or more records from a database. Statistics are returned for the modified database.

    dvkerr_t lkt_dbrecdelete(lpar_t host, lpar_t dbname, lpar_t reckeylist,
                              lpar_t params, lpar_t *dbstats );
    dvkerr_t lkt_dbrecdeleteT(lpar_t host, lpar_t dbname, lpar_t tran,
                              lpar_t reckeylist, lpar_t params,
                              lpar_t *dbstats );

## Input

## host (optional)

This is used to identify the server. For more information, see Communicating with TIBCO Patterns Servers.

## dbname (required)

is the name of the database (LPAR_STR_DBDESCRIPTOR) from which records are deleted.

## reckeylist (required)

A record key list has the following possible formats:

| • | Standard: For a standard table or parent table a record list consists of a generic list (LPAR_LST_GENERIC) containing zero or more LPAR_STR_RECKEY lpars. The key values in the list must be unique and exist in the data base (see the DOMAXWORK flag).

| • | Specific Child: To specify specific records in a child table a generic list (LPAR_LST_GENERIC) containing two sub-lists is passed. The first sub-list must be LPAR_LST_PARENT_KEYS. It must contain a list of LPAR_STR_RECKEY values, each containing the parent key value of a child record. The second sub-list must be LPAR_LST_CHILD_KEYS. It must contain a list of LPAR_STR_RECKEY values, each containing the key value of a child record. Both lists must be the same length, the keys must be in the same order (the nth item must contain the key for the nth record in both lists). The parent key list can contain a null entry, or an entry with a zero length key value, to specify a child record that does not have a parent key. For every parent key, pair of child record must exist in the data base with that parent key and record key (see the DOMAXWORK flag).

| • | All Children: To specify all child records for a particular parent key a generic list (LPAR_LST_GENERIC) containing a single sub-list must be passed. The sub-list must be LPAR_LST_PARENT_KEYS. It must contain a list of LPAR_STR_RECKEY values. The values must be unique. There must be at least one child record in the database with the given parent key (see the DOMAXWORK flag). All child records with the given parent keys are processed (as modified by any orphan status flags).

## params (optional)

is a list of updating parameters:

| • | LPAR_BOOL_DOMAXWORK: If this parameter is false, any error (including the error DVK_ERR_RECNOTFOUND) causes the complete failure of the command (i.e., no records are deleted from database dbname).

If this parameter is true, maximum work is done even if some record keys in reckeylist are not found (error DVK_ERR_RECNOTFOUND) provided that this is the only error that occurs. In such a case the command returns DVK_OK and all of the records that were found are deleted.

Default value: false

| • | LPAR_INT_LOCKKEY allows this update to go through on a database containing a keyed lock if the key value matches the lock value.

Default value: N/A

| • | LPAR_BOOL_NO_ORPHANS if this flag is given and is set to true, orphan child records are not allowed. For the "All Children" record key list format orphan child records with the given parent key are quietly ignored. For the "Specific Child" record key list format orphan child records are considered to be a non-existing record, and triggers a record not found error unless the DOMAXWORK flag is set. It is an error if both this value is true and LPAR_BOOL_ORPHANS_ONLY is given and set true.

| • | LPAR_BOOL_ORPHANS_ONLY if this flag is given and is set to true, only orphan child records are allowed. For the "All Children" record key list format non-orphan child records with the given parent key are quietly ignored. For the "Specific Child" record key list format non-orphan child records are considered to be a non-existing record, and triggers a record not found error unless the DOMAXWORK flag is set. It is an error if both this value is true, and LPAR_BOOL_NO_ORPHANS is given and set to true.

## tran (optional)

identifies the user transaction (LPAR_LONG_TRAN_ID) under which the delete records operation is to be performed.

## Output

## dbstats (optional)

is a list of lpars that give statistics on the modified database similar to those returned by `lkt_dbload`.

If you do not care to have these statistics, just pass lkt_dbrecdelete a pointer value of NULL for dbstats.

Error codes and items returned by lkt_dbrecdelete

ARRAYLEN | (none) returned if too many child records for given parent keys
DBNOTFOUND | database name
DUPRECKEYS | list containing duplicate keys
EXPECTDBDESC | item that should have been a database name
EXPECTLIST | item that should have been a list lpar
EXPECTRECKEY | item that should have been a record key
INTERNAL | item being processed when error occurred
NODBDESC | (none)
NORECKEY | key with zero-length string, or (none)
NOSYSINIT | (none)
PARAMCONFLICT | conflicting parameter
PARAMTYPE | lpar that has invalid id
PARAMVAL | Invalid key list
RECNOTFOUND | list of record keys in same format as reckeylist
TBLNOTCHILD | name of table that should be a child table
TRAN_IN_USE | lpar that contains the transaction id
TRAN_UNKNOWN |
TRANCONFLICT | list that contains LPAR_LONGINT_TRAN_ID and LPAR_STR_ERRORDETAILS
UPDPARAM | lpar that should have been an update parameter

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO® Patterns

Copyright © 2010-2025. Cloud Software Group, Inc. All Rights Reserved.