Qore SqlUtil Module Reference 1.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
Variables
Upsert Strategy Codes

## Variables
const | SqlUtil::AbstractTable::UpsertAuto = 4
| Upsert option: if the target table is empty, use UpsertInsertFirst, otherwise use UpsertUpdateFirst. More...
const | SqlUtil::AbstractTable::UpsertInsertFirst = 1
| Upsert option: insert first, if the insert fails, then update. More...
const | SqlUtil::AbstractTable::UpsertSelectFirst = 3
| Upsert option: select first, if the row is unchanged, do nothing, if it doesn't exist, insert, otherwise update. More...
const | SqlUtil::AbstractTable::UpsertUpdateFirst = 2
| Upsert option: update first, if the update fails, then insert. More...

## Detailed Description

These options are used with:

- SqlUtil::AbstractTable::getUpsertClosure()
- SqlUtil::AbstractTable::getUpsertClosureWithValidation()
- SqlUtil::AbstractTable::upsert()
- SqlUtil::AbstractTable::upsertNoCommit()
- SqlUtil::AbstractTable::upsertFromIterator()
- SqlUtil::AbstractTable::upsertFromIteratorNoCommit()
- SqlUtil::AbstractTable::upsertFromSelect()
- SqlUtil::AbstractTable::upsertFromSelectNoCommit()

to specify the upsert strategy when synchronizing table data

## Variable Documentation

const SqlUtil::AbstractTable::UpsertAuto = 4

Upsert option: if the target table is empty, use UpsertInsertFirst, otherwise use UpsertUpdateFirst.

With this upsert strategy, the following row result codes are possible:

- UR_Inserted
- UR_Verified

const SqlUtil::AbstractTable::UpsertInsertFirst = 1

Upsert option: insert first, if the insert fails, then update.

with this option an insert is attempted, and if it fails due to a duplicate row, then an update is made unconditionally; with this upsert strategy, the following row result codes are possible:

- UR_Inserted
- UR_Verified

const SqlUtil::AbstractTable::UpsertSelectFirst = 3

Upsert option: select first, if the row is unchanged, do nothing, if it doesn't exist, insert, otherwise update.

with this option the row is selected, if it doesn't exist, an insert is made, and an update is made only if the values are different; with this upsert strategy, the following row result codes are possible:

- UR_Inserted
- UR_Updated
- UR_Unchanged

const SqlUtil::AbstractTable::UpsertUpdateFirst = 2

Upsert option: update first, if the update fails, then insert.

with this option an update is attempted, and if it fails due to a missing row, then an insert is performed; with this upsert strategy, the following row result codes are possible:

- UR_Inserted
- UR_Verified