src/Codeception/Lib/Driver/ExtendedMySql.php
public function insertOrUpdate($tableName, array $data)
    {
        $this->executeQuery("SET SESSION sql_mode='ALLOW_INVALID_DATES'", []);

        $columns = array_map(
            array($this, 'getQuotedName'),
            array_keys($data)
        );
        $updateAssignments = $this->getAssignmentsFor($data);
        return sprintf(
            "INSERT INTO %s (%s) VALUES (%s) ON DUPLICATE KEY UPDATE %s",
            $this->getQuotedName($tableName),
            implode(', ', $columns),
            implode(', ', array_fill(0, count($data), '?')),
            $updateAssignments
        );
    }
public function insertOrUpdate($tableName, array $data)
    {
        $this->executeQuery("SET SESSION sql_mode='ALLOW_INVALID_DATES'", []);

        $columns = array_map(
            array($this, 'getQuotedName'),
            array_keys($data)
        );
        $updateAssignments = $this->getAssignmentsFor($data);
        return sprintf(
            "INSERT INTO %s (%s) VALUES (%s) ON DUPLICATE KEY UPDATE %s",
            $this->getQuotedName($tableName),
            implode(', ', $columns),
            implode(', ', array_fill(0, count($data), '?')),
            $updateAssignments
        );
    }
public function insertOrUpdate ( $ tableName , array $ data ) { $ this -> executeQuery ( "SET SESSION sql_mode='ALLOW_INVALID_DATES'" , [ ] ) ; $ columns = array_map ( array ( $ this , 'getQuotedName' ) , array_keys ( $ data ) ) ; $ updateAssignments = $ this -> getAssignmentsFor ( $ data ) ; return sprintf ( "INSERT INTO %s (%s) VALUES (%s) ON DUPLICATE KEY UPDATE %s" , $ this -> getQuotedName ( $ tableName ) , implode ( ', ' , $ columns ) , implode ( ', ' , array_fill ( 0 , count ( $ data ) , '?' ) ) , $ updateAssignments ) ; }
Returns the statement to insert or update an entry in the database.

@param  string $tableName The table name to use
@param  array $data Key/value pairs of the data to insert/update.

@return string            The query string ready to be prepared.
Returns the statement to insert or update an entry in the database .