getConnection()->insert($sql, $values); $result = $query->getConnection()->selectOne( 'SELECT IDENTITY_VAL_LOCAL() AS ID FROM SYSIBM.SYSDUMMY1', [], false ); if ($result === null) { throw new \RuntimeException( 'Db2 did not return a generated identity value.' ); } $id = $result->ID ?? $result->id ?? null; if ($id === null) { throw new \RuntimeException( 'Db2 identity value was NULL.' ); } return is_numeric($id) ? (int) $id : $id; } }