Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Error on SQLSERVER related to Datediff #322

Merged
merged 1 commit into from
Mar 21, 2022

Conversation

PauloPeres
Copy link
Contributor

Error traceback:
`2022-03-21 18:00:07 Error: [PDOException] SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]The datediff function requires 3 argument(s). in D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Database\Statement\StatementDecorator.php on line 178
Stack Trace:

  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Database\Statement\StatementDecorator.php:178
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Database\Connection.php:337
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Core\Retry\CommandRetry.php:70
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Database\Connection.php:340
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Database\Query.php:250
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\ORM\Query.php:1148
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Datasource\QueryTrait.php:293
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\ORM\Query.php:1096
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Datasource\QueryTrait.php:500
  • D:\home\site\wwwroot\vendor\dereuromark\cakephp-queue\src\Model\Table\QueuedJobsTable.php:620
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Database\Connection.php:682
  • D:\home\site\wwwroot\vendor\dereuromark\cakephp-queue\src\Model\Table\QueuedJobsTable.php:635
  • D:\home\site\wwwroot\vendor\dereuromark\cakephp-queue\src\Queue\Processor.php:139
  • D:\home\site\wwwroot\vendor\dereuromark\cakephp-queue\src\Command\RunCommand.php:96
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Console\BaseCommand.php:179
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Console\CommandRunner.php:336
  • D:\home\site\wwwroot\vendor\cakephp\cakephp\src\Console\CommandRunner.php:172
  • D:\home\site\wwwroot\bin\cake.php:12`

The cakephp sqlserver drivcer was doing the SQL statement as DATEDIFF([s, '1970-01-01 00:00:00', GETDATE()])
adding the extra parentheses () fix the problem

@dereuromark dereuromark merged commit d46358e into dereuromark:master Mar 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants