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

[Bug]: Error in SQL Syntax on GET /activities with modifiedSinceTimestamp parameter #496

Closed
webdev-dp opened this issue Sep 5, 2023 · 1 comment · Fixed by #498
Closed
Labels
Milestone

Comments

@webdev-dp
Copy link
Contributor

Expected behavior

When making a GET request to the /activities endpoint with the modifiedSinceTimestamp parameter, the API should return the relevant activities that have been modified since the provided timestamp. The SQL query should execute without any syntax errors, and the response should be accurate based on the specified timestamp.

Actual behavior

Currently, when making a GET request to the /activities endpoint with the modifiedSinceTimestamp parameter, the API returns a syntax error related to SQL execution. The error message displayed is as follows:

Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?) AND (1676560666)) dbal_count_tbl' at line 1

Steps to reproduce

To reproduce the issue, follow these steps:

  • Make a GET request to the /activities endpoint.
  • Include the modifiedSinceTimestamp parameter in the request.
  • Set the value of the modifiedSinceTimestamp parameter to a specific timestamp (e.g., 1676560666).
  • Observe the error message in the API response, indicating a syntax error in the SQL query execution.

Proposed Solution:
The issue arises from incorrect parameter binding in the SQL query. To fix this issue, the suggested solution is as follows:

Update the code implementation from:

if ($ts = $params->getModifiedSinceTimestamp()) {
    $select->where('modificationDate >= ?', $ts);
}

TO:

if ($ts = $params->getModifiedSinceTimestamp()) {
      $select->where('modificationDate >= ?');
      $select->setParameters([$ts]);
}

By implementing the correct parameter binding, the SQL query will execute properly, and the error message will be resolved.

@aryaantony92
Copy link
Contributor

Fixed by #498

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants