Page 1 of 1

Invalid usage of the option NEXT in the FETCH statement

Posted: Wed Apr 03, 2024 12:49 am
by servgas

Hi, please, i just created a project using one table. When I launch my url, I got the error below, what can be wrong?. I have no extra codes by myself. I did not write any sql sentence like the error shows.

thank you

E:\xampp\htdocs\ProductionPlanning\phpmaker\vendor\doctrine\dbal\src\Driver\API\SQLSrv\ExceptionConverter.php(33): An exception occurred while executing a query: SQLSTATE [42000, 102]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Incorrect syntax near 'OFFSET'. SQLSTATE [42000, 153]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Invalid usage of the option NEXT in the FETCH statement. SQLSTATE [42000, 8180]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Statement(s) could not be prepared.

on the debug I got

#0 E:\xampp\htdocs\ProductionPlanning\phpmaker\vendor\doctrine\dbal\src\Connection.php(1943): Doctrine\DBAL\Driver\API\SQLSrv\ExceptionConverter->convert(Object(Doctrine\DBAL\Driver\SQLSrv\Exception\Error), Object(Doctrine\DBAL\Query))
#1 E:\xampp\htdocs\ProductionPlanning\phpmaker\vendor\doctrine\dbal\src\Connection.php(1885): Doctrine\DBAL\Connection->handleDriverException(Object(Doctrine\DBAL\Driver\SQLSrv\Exception\Error), Object(Doctrine\DBAL\Query))
#2 E:\xampp\htdocs\ProductionPlanning\phpmaker\vendor\doctrine\dbal\src\Connection.php(1106): Doctrine\DBAL\Connection->convertExceptionDuringQuery(Object(Doctrine\DBAL\Driver\SQLSrv\Exception\Error), 'SELECT * FROM E...', Array, Array)
#3 E:\xampp\htdocs\ProductionPlanning\phpmaker\vendor\doctrine\dbal\src\Query\QueryBuilder.php(348): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM E...', Array, Array, NULL)
#4 E:\xampp\htdocs\ProductionPlanning\phpmaker\models\EcuHandHeldStarkistList.php(2223): Doctrine\DBAL\Query\QueryBuilder->executeQuery()
#5 E:\xampp\htdocs\ProductionPlanning\phpmaker\models\EcuHandHeldStarkistList.php(892): PHPMaker2024\project1\EcuHandHeldStarkistList->loadRecordset(0, 20)
#6 E:\xampp\htdocs\ProductionPlanning\phpmaker\controllers\ControllerBase.php(34): PHPMaker2024\project1\EcuHandHeldStarkistList->run()
#7 E:\xampp\htdocs\ProductionPlanning\phpmaker\controllers\EcuHandHeldStarkistController.php(22): PHPMaker2024\project1\ControllerBase->runPage(Object(Slim\Http\ServerRequest), Object(Slim\Http\Response), Array, 'EcuHandHeldStar...')
#8 E:\xampp\htdocs\ProductionPlanning\phpmaker\vendor\slim\slim\Slim\Handlers\Strategies\RequestResponse.php(38): PHPMaker2024\project1\EcuHandHeldStarkistController->list(Object(Slim\Http\ServerRequest), Object(Slim\Http\Response), Array)
#9 E:\xampp\htdocs\ProductionPlanning\phpmaker\vendor\slim\slim\Slim\Routing\Route.php(358): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Slim\Http\ServerRequest), Object(Slim\Http\Response), Array)
...

Re: ODBC Driver 18 - error

Posted: Wed Apr 03, 2024 9:24 am
by mobhar

It seems you are using MS SQL Server database that does not support to run NEXT in the FETCH statement. What SQL Server version are you using?


Re: Invalid usage of the option NEXT in the FETCH statement

Posted: Wed Apr 03, 2024 10:28 am
by arbei

SQL Server 2008 and older are not supported.


Re: Invalid usage of the option NEXT in the FETCH statement

Posted: Wed Apr 03, 2024 10:11 pm
by servgas

yes, you are right, I am running over a 2008 version.

thank you