Jaguar-dart / jaguar_orm

Source-generated ORM with relations (one-to-one, one-to-many, many-to-many), preloading, cascading, polymorphic relations, etc
https://jaguar-dart.github.io
BSD 3-Clause "New" or "Revised" License
217 stars 52 forks source link

Single quote ' text not escaped on insert #56

Closed juliusspencer closed 6 years ago

juliusspencer commented 6 years ago

Hi,

I'm using Flutter and have generated my class using: flutter packages pub run build_runner build

I'm getting rows inserted into the database. 😀 However I'm having trouble with some items not being added because they contain a single quote in their text. 😕(eg. "MTHEM8101'CP")

flutter: DatabaseException(Error Domain=FMDatabase Code=1 "near "CP": syntax error" UserInfo={NSLocalizedDescription=near "CP": syntax error}) sql 'INSERT INTO product(sku, name, category_id) VALUES ('MTHEM8101'CP', 'Echo Minimalist Basin Mixer Chrome', 1117629706)' args []}

Is this something I should be doing when creating assigning my object parameters? 🤔 I thought that the generated class would handle.

Thanks for any help.

tejainece commented 6 years ago

Will fix this.

juliusspencer commented 6 years ago

Thank you Ravi!

By the way, where is there a suitable place to ask questions?

jaumard commented 6 years ago

@juliusspencer I'll say the jaguar Gitter channel is the better place for this :)

tejainece commented 6 years ago

This is fixed in latest version of jaguar_query_sqflite. Please test it and close the issue if it is fixed.

Thanks.