only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/ConditionResolver.php +++ /dev/null @@ -1,94 +0,0 @@ -conditions(); - $and = $conditions['#conjunction'] == 'AND'; - unset($conditions['#conjunction']); - $match = TRUE; - foreach ($conditions as $condition) { - $match = $condition['field'] instanceof Condition ? static::matchGroup($row, $condition['field']) : static::matchSingle($row, $condition); - // For AND, finish matching on the first fail. For OR, finish on first - // success. - if ($and != $match) { - break; - } - } - return $match; - } - - /** - * Match a single row and its condition. - * - * @param \Drupal\migrate\tests\DatabaseRowInterface $row - * The row to match. - * - * @param array $condition - * An array representing a single condition. - * - * @return bool - * TRUE if the condition matches. - * - * @throws \Exception - */ - protected static function matchSingle(DatabaseRowInterface $row, array $condition) { - $row_value = $row->getValue($condition['field']); - switch ($condition['operator']) { - case '=': - return $row_value == $condition['value']; - - case '<=': - return $row_value <= $condition['value']; - - case '>=': - return $row_value >= $condition['value']; - - case '!=': - return $row_value != $condition['value']; - - case '<>': - return $row_value != $condition['value']; - - case '<': - return $row_value < $condition['value']; - - case '>': - return $row_value > $condition['value']; - - case 'IN': - return in_array($row_value, $condition['value']); - - case 'IS NULL': - return !isset($row_value); - - case 'IS NOT NULL': - return isset($row_value); - - default: - throw new \Exception(sprintf('operator %s is not supported', $condition['operator'])); - } - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/DatabaseRow.php +++ /dev/null @@ -1,29 +0,0 @@ -row = $row; - } - - /** - * {@inheritdoc} - */ - public function getValue($field) { - return $this->row[$field]; - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/DatabaseRowInterface.php +++ /dev/null @@ -1,22 +0,0 @@ -fieldsWithTable = $fields_with_table; - $this->fields = $fields; - parent::__construct($row); - } - - /** - * {@inheritdoc} - */ - public function getValue($field) { - $field_info = isset($this->fieldsWithTable[$field]) ? $this->fieldsWithTable[$field] : $this->fields[$field]; - if (array_key_exists($field_info['field'], $this->row[$field_info['table']]['result'])) { - $index = 'result'; - } - else { - $index = 'all'; - } - return $this->row[$field_info['table']][$index][$field_info['field']]; - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeConnection.php +++ /dev/null @@ -1,167 +0,0 @@ -databaseContents = $database_contents; - $this->connectionOptions = $connection_options; - $this->tablePrefix = $prefix; - } - - /** - * {@inheritdoc} - */ - public function getConnectionOptions() { - return $this->connectionOptions; - } - - /** - * {@inheritdoc} - */ - public function tablePrefix($table = 'default') { - return $this->tablePrefix; - } - - /** - * {@inheritdoc} - */ - public function select($table, $alias = NULL, array $options = array()) { - return new FakeSelect($this->databaseContents, $table, $alias); - } - - /** - * {@inheritdoc} - */ - public function insert($table, array $options = array()) { - return new FakeInsert($this->databaseContents, $table); - } - - /** - * {@inheritdoc} - */ - public function merge($table, array $options = array()) { - return new FakeMerge($this->databaseContents, $table); - } - - /** - * {@inheritdoc} - */ - public function update($table, array $options = array()) { - return new FakeUpdate($this->databaseContents, $table); - } - - /** - * {@inheritdoc} - */ - public function delete($table, array $options = array()) { - return new FakeDelete($this->databaseContents, $table); - } - - /** - * {@inheritdoc} - */ - public function truncate($table, array $options = array()) { - return new FakeTruncate($this->databaseContents, $table); - } - - /** - * {@inheritdoc} - */ - public function schema() { - return new FakeDatabaseSchema($this->databaseContents); - } - - /** - * {@inheritdoc} - */ - public function query($query, array $args = array(), $options = array()) { - throw new \Exception('Method not supported'); - } - - /** - * {@inheritdoc} - */ - public function queryRange($query, $from, $count, array $args = array(), array $options = array()) { - throw new \Exception('Method not supported'); - } - - /** - * {@inheritdoc} - */ - public function queryTemporary($query, array $args = array(), array $options = array()) { - throw new \Exception('Method not supported'); - } - - /** - * {@inheritdoc} - */ - public function driver() { - throw new \Exception('Method not supported'); - } - - /** - * {@inheritdoc} - */ - public function databaseType() { - throw new \Exception('Method not supported'); - } - - /** - * {@inheritdoc} - */ - public function createDatabase($database) { - // There is nothing to do. - } - - /** - * {@inheritdoc} - */ - public function mapConditionOperator($operator) { - throw new \Exception('Method not supported'); - } - - /** - * {@inheritdoc} - */ - public function nextId($existing_id = 0) { - throw new \Exception('Method not supported'); - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeDatabaseSchema.php +++ /dev/null @@ -1,230 +0,0 @@ -uniqueIdentifier = uniqid('', TRUE); - - // @todo Maybe we can generate an internal representation. - $this->databaseContents = &$database_contents; - } - - /** - * {@inheritdoc} - */ - public function tableExists($table) { - return in_array($table, array_keys($this->databaseContents)); - } - - /** - * {@inheritdoc} - */ - public function prefixNonTable($table) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - protected function buildTableNameCondition($table_name, $operator = '=', $add_prefix = TRUE) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - protected function getPrefixInfo($table = 'default', $add_prefix = TRUE) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function addField($table, $field, $spec, $keys_new = array()) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function addIndex($table, $name, $fields) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function addPrimaryKey($table, $fields) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function addUniqueKey($table, $name, $fields) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function changeField($table, $field, $field_new, $spec, $keys_new = array()) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * PHP magic __clone() method. - */ - public function __clone() { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function createTable($name, $table) { - #throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function dropField($table, $field) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function dropIndex($table, $name) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function dropPrimaryKey($table) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function dropTable($table) { - unset($this->databaseContents[$table]); - } - - /** - * {@inheritdoc} - */ - public function dropUniqueKey($table, $name) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function fieldExists($table, $column) { - if (!empty($this->databaseContents[$table])) { - $row = reset($this->databaseContents[$table]); - return isset($row[$column]); - } - else { - throw new \Exception("Can't determine whether field exists with an empty / nonexistent table."); - } - } - - /** - * {@inheritdoc} - */ - public function fieldNames($fields) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function fieldSetDefault($table, $field, $default) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function fieldSetNoDefault($table, $field) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function findTables($table_expression) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function getFieldTypeMap() { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function indexExists($table, $name) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function nextPlaceholder() { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function prepareComment($comment, $length = NULL) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function renameTable($table, $new_name) { - throw new \Exception(sprintf('Unsupported method "%s"', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function uniqueIdentifier() { - return $this->uniqueIdentifier; - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeDelete.php +++ /dev/null @@ -1,79 +0,0 @@ -databaseContents = &$database_contents; - $this->table = $table; - $this->condition = new Condition('AND'); - } - - /** - * {@inheritdoc} - */ - public function execute() { - $affected = 0; - if (isset($this->databaseContents[$this->table])) { - $original_row_count = count($this->databaseContents[$this->table]); - $condition = $this->condition; - $this->databaseContents[$this->table] = array_filter($this->databaseContents[$this->table], function ($row_array) use ($condition) { - $row = new DatabaseRow($row_array); - return !ConditionResolver::matchGroup($row, $condition); - }); - $affected = $original_row_count - count($this->databaseContents[$this->table]); - } - return $affected; - } - - /** - * {@inheritdoc} - */ - public function exists(SelectInterface $select) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function where($snippet, $args = array()) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeInsert.php +++ /dev/null @@ -1,71 +0,0 @@ -databaseContents = &$database_contents; - $this->table = $table; - } - - /** - * {@inheritdoc} - */ - public function useDefaults(array $fields) { - throw new \Exception('This method is not supported'); - } - - /** - * {@inheritdoc} - */ - public function from(SelectInterface $query) { - throw new \Exception('This method is not supported'); - } - - /** - * {@inheritdoc} - */ - public function execute() { - foreach ($this->insertValues as $values) { - $this->databaseContents[$this->table][] = array_combine($this->insertFields, $values); - } - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeMerge.php +++ /dev/null @@ -1,61 +0,0 @@ -databaseContents = &$database_contents; - $this->table = $table; - $this->conditionTable = $table; - $this->condition = new Condition('AND'); - } - - /** - * {@inheritdoc} - */ - public function execute() { - if (!count($this->condition)) { - throw new InvalidMergeQueryException(t('Invalid merge query: no conditions')); - } - $select = new FakeSelect($this->databaseContents, $this->conditionTable, 'c'); - $count = $select - ->condition($this->condition) - ->countQuery() - ->execute() - ->fetchField(); - if ($count) { - $update = new FakeUpdate($this->databaseContents, $this->table); - $update - ->fields($this->updateFields) - ->condition($this->condition) - ->execute(); - return self::STATUS_UPDATE; - } - $insert = new FakeInsert($this->databaseContents, $this->table); - $insert->fields($this->insertFields)->execute(); - return self::STATUS_INSERT; - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeSelect.php +++ /dev/null @@ -1,529 +0,0 @@ - array( - * array( - * 'uid' => 1, - * 'name' => 'admin', - * ), - * array( - * 'uid' => 2, - * 'name' => 'alice', - * ), - * ), - * 'node' => array( - * array( - * 'nid' => 1, - * ) - * ) - * ) - * @endcode - * - * @var array - */ - protected $databaseContents; - - protected $countQuery = FALSE; - protected $fieldsWithTable = array(); - - /** - * Constructs a new FakeSelect. - * - * @param array $database_contents - * An array of mocked database content. - * @param string $table - * The base table name used within fake select. - * @param string $alias - * The base table alias used within fake select. - * @param string $conjunction - * The operator to use to combine conditions: 'AND' or 'OR'. - */ - public function __construct(array $database_contents, $table, $alias, $conjunction = 'AND') { - $this->databaseContents = $database_contents; - $this->addJoin(NULL, $table, $alias); - $this->where = new Condition($conjunction); - $this->having = new Condition($conjunction); - } - - /** - * {@inheritdoc} - */ - public function leftJoin($table, $alias = NULL, $condition = NULL, $arguments = array()) { - return $this->addJoin('LEFT', $table, $alias, $condition, $arguments); - } - - /** - * {@inheritdoc} - */ - public function addJoin($type, $table, $alias = NULL, $condition = NULL, $arguments = array()) { - if ($table instanceof SelectInterface) { - // @todo implement this. - throw new \Exception('Subqueries are not supported at this moment.'); - } - $alias = parent::addJoin($type, $table, $alias, $condition, $arguments); - if (isset($type)) { - if ($type != 'INNER' && $type != 'LEFT') { - throw new \Exception(sprintf('%s type not supported, only INNER and LEFT.', $type)); - } - if (!preg_match('/^(\w+\.)?(\w+)\s*=\s*(\w+)\.(\w+)$/', $condition, $matches)) { - throw new \Exception('Only x.field1 = y.field2 conditions are supported.' . $condition); - } - if (!$matches[1] && count($this->tables) == 2) { - $aliases = array_keys($this->tables); - $matches[1] = $aliases[0]; - } - else { - $matches[1] = substr($matches[1], 0, -1); - } - if (!$matches[1]) { - throw new \Exception('Only x.field1 = y.field2 conditions are supported.' . $condition); - } - if ($matches[1] == $alias) { - $this->tables[$alias] += array( - 'added_field' => $matches[2], - 'original_table_alias' => $matches[3], - 'original_field' => $matches[4], - ); - } - elseif ($matches[3] == $alias) { - $this->tables[$alias] += array( - 'added_field' => $matches[4], - 'original_table_alias' => $matches[1], - 'original_field' => $matches[2], - ); - } - else { - throw new \Exception('The JOIN condition does not contain the alias of the joined table.'); - } - } - return $alias; - } - - /** - * {@inheritdoc} - */ - public function execute() { - // @todo: Implement distinct() handling. - - // Single table count queries often do not contain fields which this class - // does not support otherwise, so add a shortcut. - if (count($this->tables) == 1 && $this->countQuery) { - $table_info = reset($this->tables); - $where = $this->where; - if (!empty($this->databaseContents[$table_info['table']])) { - $results = array_filter($this->databaseContents[$table_info['table']], function ($row_array) use ($where) { - return ConditionResolver::matchGroup(new DatabaseRow($row_array), $where); - }); - } - else { - $results = array(); - } - } - else { - $all_rows = $this->executeJoins(); - $all_rows = $this->resolveConditions($this->where, $all_rows); - if (!empty($this->order)) { - usort($all_rows, array($this, 'sortCallback')); - } - // Now flatten the rows so that each row becomes a field alias => value - // array. - $results = array(); - foreach ($all_rows as $table_rows) { - $result_row = array(); - foreach ($table_rows as $row) { - $result_row += $row['result']; - } - $results[] = $result_row; - } - } - if (!empty($this->range)) { - $results = array_slice($results, $this->range['start'], $this->range['length']); - } - if ($this->countQuery) { - $results = array(array(count($results))); - } - return new FakeStatement($results); - } - - /** - * Create an initial result set by executing the joins and picking fields. - * - * @return array - * A multidimensional array, the first key are table aliases, the second - * are field aliases, the values are the database contents or NULL in case - * of JOINs. - */ - protected function executeJoins() { - $fields = array(); - foreach ($this->fields as $field_info) { - $this->fieldsWithTable[$field_info['table'] . '.' . $field_info['field']] = $field_info; - $fields[$field_info['table']][$field_info['field']] = $field_info['alias']; - } - foreach ($this->tables as $alias => $table_info) { - if ($table = reset($this->databaseContents[$table_info['table']])) { - foreach (array_keys($table) as $field) { - if (!isset($this->fields[$field])) { - $this->fieldsWithTable[$field] = array( - 'table' => $alias, - 'field' => $field, - ); - $this->fieldsWithTable["$alias.$field"] = array( - 'table' => $alias, - 'field' => $field, - ); - } - } - } - } - // This will contain a multiple dimensional array. The first key will be a - // table alias, the second either result or all, the third will be a field - // alias. all contains every field in the table with the original field - // names while result contains only the fields requested. This allows for - // filtering on fields that were not added via addField(). - $results = array(); - foreach ($this->tables as $table_alias => $table_info) { - // The base table for this query. - if (empty($table_info['join type'])) { - foreach ($this->databaseContents[$table_info['table']] as $candidate_row) { - $results[] = $this->getNewRow($table_alias, $fields, $candidate_row); - } - } - else { - $new_rows = array(); - - // Dynamically build a set of joined rows. Check existing rows and see - // if they can be joined with incoming rows. - foreach ($results as $row) { - $joined = FALSE; - foreach ($this->databaseContents[$table_info['table']] as $candidate_row) { - if ($row[$table_info['original_table_alias']]['result'][$table_info['original_field']] == $candidate_row[$table_info['added_field']]) { - $joined = TRUE; - $new_rows[] = $this->getNewRow($table_alias, $fields, $candidate_row, $row); - } - } - if (!$joined && $table_info['join type'] == 'LEFT') { - // Because PHP doesn't scope their foreach statements, - // $candidate_row may contain the last value assigned to it from the - // previous statement. - // @TODO: empty tables? Those are a problem. - $keys = array_keys($candidate_row); - $values = array_fill(0, count($keys), NULL); - $new_row = array( - 'result' => $fields[$table_alias], - 'all' => array_combine($keys, $values), - ); - $new_rows[] = array($table_alias => $new_row) + $row; - } - } - $results = $new_rows; - } - } - return $results; - } - - /** - * Retrieves a new row. - * - * @param string $table_alias - * @param array $fields - * @param array $candidate_row - * @param array $row - * - * @return array - */ - protected function getNewRow($table_alias, $fields, $candidate_row, $row = array()) { - $new_row[$table_alias]['all'] = $candidate_row; - foreach ($fields[$table_alias] as $field => $alias) { - $new_row[$table_alias]['result'][$alias] = $candidate_row[$field]; - } - return $new_row + $row; - } - - /** - * {@inheritdoc} - */ - public function countQuery() { - $query = clone $this; - return $query->setCountQuery(); - } - - /** - * Set this query to be a count query. - */ - protected function setCountQuery() { - $this->countQuery = TRUE; - return $this; - } - - /** - * usort callback to order the results. - */ - protected function sortCallback($a, $b) { - $a_row = new DatabaseRowSelect($a, $this->fieldsWithTable, $this->fields); - $b_row = new DatabaseRowSelect($b, $this->fieldsWithTable, $this->fields); - foreach ($this->order as $field => $direction) { - $a_value = $a_row->getValue($field); - $b_value = $b_row->getValue($field); - if ($a_value != $b_value) { - return (($a_value < $b_value) == ($direction == 'ASC')) ? -1 : 1; - } - } - return 0; - } - - /** - * Resolves conditions by removing non-matching rows. - * - * @param \Drupal\Core\Database\Query\Condition $condition_group - * The condition group to check. - * @param array $rows - * An array of rows excluding non-matching rows. - * - * @return \Drupal\Core\Database\Driver\fake\ConditionResolver - * The condition resolver object. - */ - protected function resolveConditions(Condition $condition_group, array &$rows) { - $fields_with_table = $this->fieldsWithTable; - $fields = $this->fields; - return array_filter($rows, function ($row_array) use ($condition_group, $fields_with_table, $fields) { - $row = new DatabaseRowSelect($row_array, $fields_with_table, $fields); - return ConditionResolver::matchGroup($row, $condition_group); - }); - } - - /** - * {@inheritdoc} - */ - public function orderBy($field, $direction = 'ASC') { - $this->order[$field] = strtoupper($direction); - return $this; - } - - // ================== we could support these. - /** - * {@inheritdoc} - */ - public function groupBy($field) { - // @todo: Implement groupBy() method. - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function havingCondition($field, $value = NULL, $operator = NULL) { - // @todo: Implement havingCondition() method. - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function uniqueIdentifier() { - // TODO: Implement uniqueIdentifier() method. - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - // ================== the rest won't be supported, ever. - /** - * {@inheritdoc} - */ - public function nextPlaceholder() { - // TODO: Implement nextPlaceholder() method. - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function isPrepared() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function preExecute(SelectInterface $query = NULL) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function where($snippet, $args = array()) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function extend($extender_name) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function &getExpressions() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function &getGroupBy() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function &getUnion() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function forUpdate($set = TRUE) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function rightJoin($table, $alias = NULL, $condition = NULL, $arguments = array()) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function &conditions() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function orderRandom() { - // We could implement this but why bother. - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function union(SelectInterface $query, $type = '') { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function addExpression($expression, $alias = NULL, $arguments = array()) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function &getTables() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function getArguments(PlaceholderInterface $query_place_holder = NULL) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function &getOrderBy() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function &getFields() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function exists(SelectInterface $select) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function notExists(SelectInterface $select) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function arguments() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function compile(Connection $connection, PlaceholderInterface $query_place_holder) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function compiled() { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function fields($table_alias, array $fields = array()) { - if (!$fields) { - $table = $this->tables[$table_alias]['table']; - if (!empty($this->databaseContents[$table])) { - $fields = array_keys(reset($this->databaseContents[$table])); - } - else { - throw new \Exception(SafeMarkup::format('All fields on empty table @table is not supported.', array('@table' => $table))); - } - } - return parent::fields($table_alias, $fields); - } -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeStatement.php +++ /dev/null @@ -1,104 +0,0 @@ -current()); - $return = $row[$index]; - $this->next(); - return $return; - } - - /** - * {@inheritdoc} - */ - public function fetchAssoc() { - $return = FALSE; - if ($this->valid()) { - $return = $this->current(); - $this->next(); - } - return $return; - } - - /** - * {@inheritdoc} - */ - public function fetchCol($index = 0) { - $return = array(); - foreach ($this as $row) { - $row = array_values($row); - $return[] = $row[$index]; - } - return $return; - } - - /** - * {@inheritdoc} - */ - public function fetchAllKeyed($key_index = 0, $value_index = 1) { - $return = array(); - foreach ($this as $row) { - $row = array_values($row); - $return[$row[$key_index]] = $row[$value_index]; - } - return $return; - } - - /** - * {@inheritdoc} - */ - public function fetchAllAssoc($key, $fetch = NULL) { - $return = array(); - foreach ($this as $row) { - $return[$row[$key]] = $row; - } - return $return; - } - - /** - * {@inheritdoc} - */ - public function fetchObject() { - $return = $this->fetchAssoc(); - return $return === FALSE ? FALSE : (object) $return; - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeTruncate.php +++ /dev/null @@ -1,36 +0,0 @@ -databaseContents = &$database_contents; - $this->table = $table; - } - - /** - * Executes the TRUNCATE query. - */ - public function execute() { - $this->databaseContents[$this->table] = array(); - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/FakeUpdate.php +++ /dev/null @@ -1,88 +0,0 @@ -databaseContents = &$database_contents; - $this->table = $table; - $this->condition = new Condition('AND'); - } - - /** - * {@inheritdoc} - */ - public function execute() { - $affected = 0; - if (isset($this->databaseContents[$this->table])) { - $fields = $this->fields; - $condition = $this->condition; - array_walk($this->databaseContents[$this->table], function (&$row_array) use ($fields, $condition, &$affected) { - $row = new DatabaseRow($row_array); - if (ConditionResolver::matchGroup($row, $condition)) { - $row_array = $fields + $row_array; - $affected++; - } - }); - } - return $affected; - } - - /** - * {@inheritdoc} - */ - public function exists(SelectInterface $select) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function where($snippet, $args = array()) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - - /** - * {@inheritdoc} - */ - public function expression($field, $expression, array $arguments = NULL) { - throw new \Exception(sprintf('Method "%s" is not supported', __METHOD__)); - } - -} only in patch2: unchanged: --- a/core/lib/Drupal/Core/Database/Driver/fake/Install/Tasks.php +++ /dev/null @@ -1,35 +0,0 @@ -