Skip to content

Reserved words cannot be used as column name #1

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

Open
djschilling opened this issue Apr 6, 2018 · 1 comment
Open

Reserved words cannot be used as column name #1

djschilling opened this issue Apr 6, 2018 · 1 comment

Comments

@djschilling
Copy link

djschilling commented Apr 6, 2018

Using the function SPDO::insert reserved words cannot be used as column names.

Example:

SPDO::insert('report', ['rows' => 'Projekt,Hauptkonto'] );

This does not work because rows is a reserved word in new mariadb installations.

SPDO::insert('report', ['`rows`' => 'Projekt,Hauptkonto'] );

This works, cause the column name is in backticks.

A general fix would be to put all column names in backticks.

@milux
Copy link
Owner

milux commented Apr 10, 2018

This problem is known, but using backticks for all column names is not a valid solution, because this is MySQL-/MariaDB-specific. (For instance, PostgreSQL uses quotes...)
Instead, I have to implement a method in the connection class that can be adapted for each specific database implementation.

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

No branches or pull requests

2 participants