-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
DDC-2825: SQlite - Table names are not escaped when inserting data #3578
Comments
Comment created by michael.perrin: Sorry, it actually duplicates #DDC-2636 |
Issue was closed with resolution "Duplicate" |
Comment created by @Ocramius: [~michael.perrin] doctrine does not escape table names by default. You will need a custom naming and/or quoting strategy for that. |
Comment created by michael.perrin: @marco Pivetta That's right but that is a problem, isn't it? Here is an example. An database schema is created with this definition :
If I do this :
This will work for PostgreSQL for instance, but not SQlite, because Doctrine DBAL converted "myschema.mytable" to "myschema**mytable" when creating the database, but the ORM will still use "myschema.mytable". Did I miss something or is it an issue? |
Comment created by @Ocramius: No, it is indeed a problem. I'm wondering if the default naming strategy should handle this for SQLite... |
Comment created by michael.perrin: I started to explore the code and see how this could be solved, but unfortunately I don't have an enough broad knowledge of the whole Doctrine architecture and how new things should be solved the right way. |
Comment created by michael.perrin: @marco Pivetta I am wondering if the best solution to handle this would be to handle the "schema" attribute the right way. I mean: instead of defining a table with a name like "myschema.mytable", wouldn't it be better to define it with "name: mytable, schema: myschema" (either in YAML, or Annotation, ...). This would be used both in the ORM and DBAL. |
Comment created by @doctrinebot: |
Comment created by @doctrinebot: |
Jira issue originally created by user michael.perrin:
When a table name is defined with a dot (example: schemaname.tablename) in a Doctrine entity, it is created with a double underscode in SQlite (example : schemaname**tablename).
However, when a Doctrine entity is persisted (and saved with INSERT INTO), the dot is not converted to a double underscore, leading to "no such table: schemaname.tablename" exception.
The text was updated successfully, but these errors were encountered: