Storm\Drivers\Base\Relational\PrimaryKeys\PostIndividualInsertKeyGenerator::FillPrimaryKey PHP Метод

FillPrimaryKey() абстрактный публичный Метод

abstract public FillPrimaryKey ( Storm\Drivers\Base\Relational\Queries\IConnection $Connection, Row $UnkeyedRow )
$Connection Storm\Drivers\Base\Relational\Queries\IConnection
$UnkeyedRow Storm\Core\Relational\Row
    public abstract function FillPrimaryKey(IConnection $Connection, Row $UnkeyedRow);

Usage Example

Пример #1
0
 protected final function SaveRows(IConnection $Connection, Table $Table, array $RowsWithoutPrimaryKey, array $RowsWithPrimaryKeys, ReturningDataKeyGenerator $ReturningDataKeyGenerator = null, PostIndividualInsertKeyGenerator $PostIndividualInsertKeyGenerator = null)
 {
     if (count($RowsWithPrimaryKeys) === 0 && count($RowsWithoutPrimaryKey) === 0) {
         return;
     }
     $RowsToUpsert = null;
     if ($PostIndividualInsertKeyGenerator !== null) {
         $this->InsertRowsIndividually($Connection, $Table, $RowsWithoutPrimaryKey, function (Relational\Row $Row) use(&$Connection, &$PostIndividualInsertKeyGenerator) {
             $PostIndividualInsertKeyGenerator->FillPrimaryKey($Connection, $Row);
         });
         $RowsToUpsert = $RowsWithPrimaryKeys;
     } else {
         $RowsToUpsert = array_merge($RowsWithoutPrimaryKey, $RowsWithPrimaryKeys);
     }
     if (count($RowsToUpsert) > 0) {
         $ShouldReturnKeyData = $ReturningDataKeyGenerator !== null;
         $ReturnedKeyData = $this->UpsertRows($Connection, $Table, $RowsToUpsert, $ShouldReturnKeyData);
         if ($ShouldReturnKeyData) {
             $ReturningDataKeyGenerator->FillPrimaryKeys($Connection, $RowsWithoutPrimaryKey, $ReturnedKeyData);
         }
     }
 }
PostIndividualInsertKeyGenerator