Open topic with navigation

TIBCO® Patterns 6.1.2

# Replacing Records in a Database (lkt_dbrecreplace)

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

    dvkerr_t lkt_dbrecreplace(lpar_t host, lpar_t dbname, lpar_t reclist,
                               lpar_t params, lpar_t *dbstats );
    dvkerr_t lkt_dbrecreplaceT(lpar_t host, lpar_t dbname, lpar_t tran,
                               lpar_t reclist, 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) in which records are replaced.

## reclist (required)

is a list of records to be replaced. Each record in reclist replaces, in its totality, the record in dbname having the same record key.

To put it another way, the replace operation is exactly equivalent to a lkt_dbrecdelete followed by a lkt_dbrecadd using the same record key. The record keys of the records in reclist must already exist in database dbname.

If some, but not all, of the record keys do not exist in database dbname (error DVK_ERR_RECNOTFOUND), failure of the whole command can be prevented by setting the parameter LPAR_BOOL_DOMAXWORK (see next item).

Like the `lkt_dbload` command, a file specification might be used in place of an explicitly constructed record list. When using files which do not contain record keys, it is important to set the initial key in the file to a value sufficiently large to not conflict with records already in the database.

## params (optional)

is a list of updating parameters:

| • | LPAR_BOOL_DOMAXWORK: If this parameter is false, any error causes the complete failure of the command (For example, no records are replaced in database dbname).

If this parameter is true, maximum work is done. Records in reclist that can't be loaded due to errors such as record not found or character conversion errors, are quietly ignored and all other records are loaded.

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_INT_DBNUMRECORDS gives an estimate of the number of records in the record list. It is not necessary that this value be exact or even close. This is used by the TIBCO Patterns server to determine the most efficient means of loading records.

Default value: 0 (It assumes a small batch of records). The exception is if loading using an LPAR_LST_REMOTEFILE file specification, the assumption is that it is a large batch of records.

## tran (optional)

identifies the user transaction (LPAR_LONG_TRAN_ID) under which the replace 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_dbrecreplace` a pointer value of NULL for dbstats.

Error codes and items returned by lkt_dbrecreplace

CHARCONV | record that contains improperly encoded characters
DBNOTFOUND | name of nonexistent database
EXPECTDBDESC | item that should have been a database name
EXPECTLIST | item that should have been a list lpar
EXPECTRECORD | item that should have been a record
INTERNAL | item that was being processed at time of error
NODBDESC | (none)
NOMEM | record being processed when memory cap was hit
NORECKEY | record that lacks a record key
NOSRCHTXT | record that lacks searchable text
NOSYSINIT | (none)
NUMFIELDS | record that contains the wrong number of fields
PARAMTYPE | lpar that has invalid ID
RECNOTFOUND | first record not in the database
TRAN_UNKNOWN | lpar that contains the unknown transaction id
TRAN_IN_USE | lpar that contains the transaction id
TRANCONFLICT | list that contains LPAR_LONGINT_TRAN_ID and LPAR_STR_ERRORDETAILS
UPDPARAM | item 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.