Qore SqlUtil Module Reference  1.6
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::UpsertInsertOnly = 5
 Upsert option: insert if the row does not exist, otherwise ignore. 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::UpsertStrategyDescriptionMap
 hash mapping upsert strategy descriptions to upsert strategy codes More...
 
const SqlUtil::AbstractTable::UpsertStrategyMap
 hash mapping upsert strategy codes to a text description More...
 
const SqlUtil::AbstractTable::UpsertUpdateFirst = 2
 Upsert option: update first, if the update fails, then insert. More...
 
const SqlUtil::AbstractTable::UpsertUpdateOnly = 6
 Upsert option: update if the row exists, otherwise ignore. More...
 

Detailed Description

These options are used with:

to specify the upsert strategy when synchronizing table data

Variable Documentation

◆ UpsertAuto

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:

◆ UpsertInsertFirst

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:

◆ UpsertInsertOnly

const SqlUtil::AbstractTable::UpsertInsertOnly = 5

Upsert option: insert if the row does not exist, otherwise ignore.

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

◆ UpsertSelectFirst

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:

◆ UpsertStrategyDescriptionMap

const SqlUtil::AbstractTable::UpsertStrategyDescriptionMap
Initial value:
= {
"UpsertInsertFirst": UpsertInsertFirst,
"UpsertUpdateFirst": UpsertUpdateFirst,
"UpsertSelectFirst": UpsertSelectFirst,
"UpsertAuto": UpsertAuto,
"UpsertInsertOnly": UpsertInsertOnly,
"UpsertUpdateOnly": UpsertUpdateOnly,
}

hash mapping upsert strategy descriptions to upsert strategy codes

See also
UpsertStrategyMap for a reverse mapping

◆ UpsertStrategyMap

const SqlUtil::AbstractTable::UpsertStrategyMap
Initial value:
= {
UpsertInsertFirst: "UpsertInsertFirst",
UpsertUpdateFirst: "UpsertUpdateFirst",
UpsertSelectFirst: "UpsertSelectFirst",
UpsertAuto: "UpsertAuto",
UpsertInsertOnly: "UpsertInsertOnly",
UpsertUpdateOnly: "UpsertUpdateOnly",
}

hash mapping upsert strategy codes to a text description

See also
UpsertStrategyDescriptionMap for a reverse mapping

◆ UpsertUpdateFirst

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:

◆ UpsertUpdateOnly

const SqlUtil::AbstractTable::UpsertUpdateOnly = 6

Upsert option: update if the row exists, otherwise ignore.

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