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

fix backticks breaking query #293

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

greenbea
Copy link

@greenbea greenbea commented Jun 2, 2024

No description provided.

@greenbea
Copy link
Author

greenbea commented Jun 2, 2024

The backtick works fine for mysql but breaks for postgres. Mysql supports double quotes too for identifiers .https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_ansi_quotes.

Copy link
Member

@liviuchircu liviuchircu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @greenbea! Just left a quick improvement suggestion for you to evaluate before we merge.

web/common/cfg_comm.php Show resolved Hide resolved
@greenbea
Copy link
Author

You have to set the sql_mode. Try

 new PDO($dsn, "opensips", "opensipsrw", array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET sql_mode="ANSI_QUOTES"'));

liviuchircu added a commit that referenced this pull request Jun 18, 2024
Credits to @greenbea for reporting the issue and helping with the fix!

Related to #293
@liviuchircu
Copy link
Member

Hi @greenbea! I just pushed a new branch for working on this issue (bugfix/fix-dashboard-postgres), with a preliminary fix, inspired by the discussion so far. Could you please check that commit / approach and see if it fixes the dashboard on your Postgres setup?

In short, there are lots of PDO objects being created from various db.inc.php files, and I've tried to only create the "dashboard" connection with ANSI_QUOTES SQL mode, so we don't break other code by "fixing" things here.

liviuchircu added a commit that referenced this pull request Jun 18, 2024
Credits to @greenbea for reporting the issue and helping with the fix!

Related to #293
liviuchircu added a commit that referenced this pull request Jun 18, 2024
Credits to @greenbea for reporting the issue and helping with the fix!

Related to #293
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.

3 participants