MergeQuery

class MergeQuery

General class for an abstracted MERGE query operation.

An ANSI SQL:2003 compatible database would run the following query:

MERGE INTO table_name_1 USING table_name_2 ON (condition)
  WHEN MATCHED THEN
  UPDATE SET column1 = value1 [, column2 = value2 ...]
  WHEN NOT MATCHED THEN
  INSERT (column1 [, column2 ...]) VALUES (value1 [, value2 ...

Other databases (most notably MySQL, PostgreSQL and SQLite) will emulate this statement by running a SELECT and then INSERT or UPDATE.

By default, the two table names are identical and they are passed into the the constructor. table_name_2 can be specified by the MergeQuery::conditionTable() method. It can be either a string or a subquery.

The con