Loads an array of entities from a given DBAL statement.

@param Statement $stmt

@return mixed[]
339447
private function loadArrayFromStatement(ToManyAssociationMetadata $association, $stmt)
    {
        $rsm = $this->currentPersisterContext->rsm;

        if ($association->getIndexedBy()) {
            $rsm = clone $this->currentPersisterContext->rsm; // this is necessary because the "default rsm" should be changed.
            $rsm->addIndexBy('r', $association->getIndexedBy());
        }

        $hydrator = $this->em->newHydrator(Query::HYDRATE_OBJECT);
        $hints    = [UnitOfWork::HINT_DEFEREAGERLOAD => true];

        return $hydrator->hydrateAll($stmt, $rsm, $hints);
    }
1061784
function load($key,$val) {
		if ($found=$this->find($key,$val)) {
			$this->id=$found[0]->id;
			return $this->item=$found[0]->item;
		}
		$this->reset();
		return [];
	}
254625
public function execute($stmt, $clearBindParams = true)
    {
        foreach ($this->bindParams as $key => $val) {
            is_int($val) ? $stmt->bindValue(':param' . $key, $val, \PDO::PARAM_INT) : $stmt->bindValue(':param' . $key, $val, \PDO::PARAM_STR);
        }

        //empty($param) && $param = $this->bindParams;
        $this->conf['log_slow_sql'] && $startQueryTimeStamp = microtime(true);
        if (!$stmt->execute()) {
            $error = $stmt->errorInfo();
            throw new \InvalidArgumentException('Pdo execute Sql error!,【Sql : ' . $this->buildDebugSql() . '】,【Error:' . $error[2] . '】');
        }

        $slow = 0;
        if ($this->conf['log_slow_sql']) {
            $queryTime = microtime(true) - $startQueryTimeStamp;
            if ($queryTime > $this->conf['log_slow_sql']) {
                if (Plugin::hook('cml.mysql_query_slow', ['sql' => $this->buildDebugSql(), 'query_time' => $queryTime]) !== false) {
                    Log::notice('slow_sql', ['sql' => $this->buildDebugSql(), 'query_time' => $queryTime]);
                }
                $slow = $queryTime;
            }
        }

        if (Cml::$debug) {
            $this->debugLogSql($slow > 0 ? Debug::SQL_TYPE_SLOW : Debug::SQL_TYPE_NORMAL, $slow);
        }

        $this->currentQueryIsMaster = true;
        $this->currentSql = '';
        $clearBindParams && $this->clearBindParams();
        return true;
    }
1303456
public function fetchFuns(callable $func, string $statement, array $bindings = []): array
    {
        $sth = $this->execute($statement, $bindings);
        $result = $sth->fetchAll(PDO::FETCH_FUNC, $func);

        $this->freeResource($sth);

        return $result;
    }
1055009
public function fetchAssocs(string $statement, array $bindings = [], $indexKey = null): array
    {
        $data = [];
        $sth = $this->execute($statement, $bindings);

        while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
            if ($indexKey) {
                $data[$row[$indexKey]] = $row;
            } else {
                $data[] = $row;
            }
            // $data[current($row)] = $row;
        }

        $this->freeResource($sth);

        return $data;
    }
575775
protected function _process( array $stmts )
	{
		$this->_msg( 'Removing locale constraints from supplier tables', 0 );
		$this->_status( '' );

		$schema = $this->_getSchema( 'db-supplier' );

		foreach( $stmts as $table => $list )
		{
			if( $schema->tableExists( $table ) === true )
			{
				foreach( $list as $constraint => $stmt )
				{
					$this->_msg( sprintf( 'Removing "%1$s" from "%2$s"', $constraint, $table ), 1 );

					if( $schema->constraintExists( $table, $constraint ) !== false )
					{
						$this->_execute( $stmt, 'db-supplier' );
						$this->_status( 'done' );
					} else {
						$this->_status( 'OK' );
					}
				}
			}
		}
	}
715666
private static function getPositionalPlaceholderPositions(string $statement) : array
    {
        return self::collectPlaceholders(
            $statement,
            '?',
            self::POSITIONAL_TOKEN,
            static function (string $_, int $placeholderPosition, int $fragmentPosition, array &$carry) : void {
                $carry[] = $placeholderPosition + $fragmentPosition;
            }
        );
    }
177864
public function getAll(string $table, int $page = 0): array
    {
        try {
            $this->db->beginTransaction();

            $sql = "SELECT * FROM $table";

            if ($page > 0) {
                $sql = $sql . " LIMIT " . self::LIMIT . " OFFSET " . self::LIMIT * ($page - 1);
            }
            /** @var PDOStatement $stmt */
            $stmt = $this->db->prepare($sql);
            $stmt->execute();

            $this->db->commit();

            $result = $stmt->fetchAll();

            return $result;
        } catch (PDOException $e) {
            $this->db->rollBack();
            throw new PDOException($e);
        }
    }
586005
def _list_stmt(self, stmt: Statement, sctx: SchemaContext) -> None:
        """"""
        self._handle_child(ListNode(), stmt, sctx)
441596
protected function getResultsStrictTyped(\PDOStatement $stmt, int $fetchStyle = \PDO::FETCH_ASSOC)
    {
        /**
         * @var array|object|bool $results
         */
        $results = $stmt->fetchAll($fetchStyle);
        if (\is_array($results)) {
            return $results;
        } elseif (\is_object($results)) {
            return $results;
        }
        throw new \TypeError('Unexpected return type: ' . $this->getValueType($results));
    }
832539
public function packSchema(): array
    {
        $result = [];
        foreach ($this->schemas as $class => $schema) {
            $item = [
                //Instantiator class
                ODMInterface::D_INSTANTIATOR  => $schema->getInstantiator(),

                //Primary collection class
                ODMInterface::D_PRIMARY_CLASS => $schema->resolvePrimary($this),

                //Instantiator and entity specific schema
                ODMInterface::D_SCHEMA        => $schema->packSchema($this),
            ];

            if (!$schema->isEmbedded()) {
                $item[ODMInterface::D_SOURCE_CLASS] = $this->getSource($class);
                $item[ODMInterface::D_DATABASE] = $schema->getDatabase();
                $item[ODMInterface::D_COLLECTION] = $schema->getCollection();
            }

            $result[$class] = $item;
        }

        return $result;
    }
681480
public function query(string $statement) : array
    {
        try {
            return $this->getConnection()->query($statement)->fetchAll(\PDO::FETCH_ASSOC);
        } catch (\PDOException $e) {
            throw new ParserRuntimeException('Statement could not be executed.', 0, $e);
        }
    }
1185986
protected function process( array $stmts )
	{
		$this->msg( 'Removing locale constraints from customer tables', 0 );
		$this->status( '' );

		$schema = $this->getSchema( 'db-customer' );

		foreach( $stmts as $table => $list )
		{
			if( $schema->tableExists( $table ) === true )
			{
				foreach( $list as $constraint => $stmt )
				{
					$this->msg( sprintf( 'Removing "%1$s" from "%2$s"', $constraint, $table ), 1 );

					if( $schema->constraintExists( $table, $constraint ) !== false )
					{
						$this->execute( $stmt, 'db-customer' );
						$this->status( 'done' );
					} else {
						$this->status( 'OK' );
					}
				}
			}
		}
	}
936127
public static function getTables($statement)
    {
        $expressions = [];

        if (($statement instanceof InsertStatement)
            || ($statement instanceof ReplaceStatement)
        ) {
            $expressions = [$statement->into->dest];
        } elseif ($statement instanceof UpdateStatement) {
            $expressions = $statement->tables;
        } elseif (($statement instanceof SelectStatement)
            || ($statement instanceof DeleteStatement)
        ) {
            $expressions = $statement->from;
        } elseif (($statement instanceof AlterStatement)
            || ($statement instanceof TruncateStatement)
        ) {
            $expressions = [$statement->table];
        } elseif ($statement instanceof DropStatement) {
            if (! $statement->options->has('TABLE')) {
                // No tables are dropped.
                return [];
            }
            $expressions = $statement->fields;
        } elseif ($statement instanceof RenameStatement) {
            foreach ($statement->renames as $rename) {
                $expressions[] = $rename->old;
            }
        }

        $ret = [];
        foreach ($expressions as $expr) {
            if (! empty($expr->table)) {
                $expr->expr = null; // Force rebuild.
                $expr->alias = null; // Aliases are not required.
                $ret[] = Expression::build($expr);
            }
        }

        return $ret;
    }
357920
private function executeStatement($stmt) {

		if(true !== $stmt -> execute()) {

			if($this -> getLastErrno() > 0) {
				return trigger_error(sprintf('A database error occured with error number "%s" and message: "%s"', $this -> getLastErrno(), $this -> getLastError()), E_USER_ERROR);
			}

			return false;
		}

		$stmt -> store_result();

		return $stmt;
	}
1175222
public static function getForeignKeys($statement)
    {
        if (empty($statement->fields)
            || (! is_array($statement->fields))
            || (! $statement->options->has('TABLE'))
        ) {
            return [];
        }

        $ret = [];

        foreach ($statement->fields as $field) {
            if (empty($field->key) || ($field->key->type !== 'FOREIGN KEY')) {
                continue;
            }

            $columns = [];
            foreach ($field->key->columns as $column) {
                $columns[] = $column['name'];
            }

            $tmp = [
                'constraint' => $field->name,
                'index_list' => $columns,
            ];

            if (! empty($field->references)) {
                $tmp['ref_db_name'] = $field->references->table->database;
                $tmp['ref_table_name'] = $field->references->table->table;
                $tmp['ref_index_list'] = $field->references->columns;

                if ($opt = $field->references->options->has('ON UPDATE')) {
                    $tmp['on_update'] = str_replace(' ', '_', $opt);
                }

                if ($opt = $field->references->options->has('ON DELETE')) {
                    $tmp['on_delete'] = str_replace(' ', '_', $opt);
                }

                // if (($opt = $field->references->options->has('MATCH'))) {
                //     $tmp['match'] = str_replace(' ', '_', $opt);
                // }
            }

            $ret[] = $tmp;
        }

        return $ret;
    }
788745
@SuppressWarnings("unchecked")
	public static List<String> firstStringRow(PreparedStatement stmt) throws SQLException {
		return (List<String>) firstRow(stmt, String.class);
	}