Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /** Repository */
- $query = $this->createQuery();
- $sqlParts = $this->queryParser->parseQuery($query);
- $query->statement($sqlParts, array());
- return $query->execute();
- ?>
- Execute at some points end up being in the core function:
- <?php
- /**
- * Returns the object data using a custom statement
- *
- * @param Statement $statement
- * @return array
- */
- protected function getObjectDataByRawQuery(Statement $statement) {
- $realStatement = $statement->getStatement();
- $parameters = $statement->getBoundVariables();
- if ($realStatement instanceof \TYPO3\CMS\Core\Database\PreparedStatement) {
- $realStatement->execute($parameters);
- $rows = $realStatement->fetchAll();
- $realStatement->free();
- } else {
- /**
- This is the part where the query is executed. The only problem is, that $realStatement->getStatement() returns an array.
- This is then used to call $this->databaseHandle->sql_query, which expects a SQL string.
- Obviously the $result is gonna be NULL, as sql_query cannot handle the given array.
- In the end the core will fail at the following function:
- Fatal error: Call to a member function fetch_assoc() on a non-object in /~/typo3_src/typo3/sysext/core/Classes/Database/DatabaseConnection.php on line 1044
- */
- /**
- * @deprecated since 6.2, this block will be removed in two versions
- * the deprecation log is in Qom\Statement
- */
- if (!empty($parameters)) {
- $this->replacePlaceholders($realStatement, $parameters);
- }
- $result = $this->databaseHandle->sql_query($realStatement);
- $this->checkSqlErrors();
- $rows = array();
- while ($row = $this->databaseHandle->sql_fetch_assoc($result)) {
- if (is_array($row)) {
- $rows[] = $row;
- }
- }
- $this->databaseHandle->sql_free_result($result);
- }
- return $rows;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement