-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[NFR] Escaping system to generated SQL according to database system #104
Comments
Maybe this could work: class User extends Model {
public function getSource(){
return '"user"';
}
} |
Looks like your source name is double-quoted. |
@phalcon PhalconException: Table ""user"" doesn't exist on database when dumping meta-data for User |
Try backticks... since "user" is reserved word in MySQL I believe. HTH class User extends Model {
public function getSource() {
return '`user`';
}
} |
@nesbert: http://www.petefreitag.com/tools/sql_reserved_words_checker/?word=user |
@bungcip "postgresql" my bad missed that in the title... thanks for the link btw :) |
we need to implement a full scaping system for columns and tables in Phalcon to fix this, that will take a couple of weeks. |
Yes, we have the exact same problem with all the keywords when using Pdo\Mysql |
I have the same error. When i create object use model and try to select data use static methods than i catch an error. Example: But if i dont create Users instance all work good. My decision for Postgres: Very nasty bug |
From 0.7.0 a full escaping system for columns/tables/schemas is implemented in the ORM: For example, the following PHQL statement: SELECT name, type FROM Robots ORDER BY name is transformed to: SELECT `robots`.`name` AS `name`, `robots`.`type` AS `type`
FROM `phalcon_test`.`robots` ORDER BY `robots`.`name` |
phalcon cannot save model when using table named "user" in postgresql.
causing error:
PhalconException: ERROR: column "username" does not exist LINE 1: SELECT COUNT() AS rowcount FROM user WHERE username = 'foo' ^ when executing SELECT COUNT() AS rowcount FROM user WHERE username = 'foo'
This is because phalcon generated sql not using quoted version. The right query is
sql script:
User.php
The text was updated successfully, but these errors were encountered: