有没有办法在typo3版本10中执行纯SQL?我怎样才能做到这一点?
// in previous versions you could do the following
$sql = 'SELECT * FROM tt_content;';
$GLOBALS['TYPO3_DB']->sql_query($sql);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
// ...
}
编辑
简单的脚本SELECT * FROM tt_content
只是一个占位符。我想对我的统计页面进行一些特殊的迁移或一些特殊的请求。
最佳答案
$connection = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tt_content');
$resultSet = $connection->query('SELECT * FROM tt_content')->execute();
关于typo3 - 如何在typo3版本10中执行纯SQL($GLOBALS ['TYPO3_DB']->sql_query())?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61733711/