Closed chriswep closed 4 years ago
Confirmed I have this issue as well with other operators.
EDIT: The operators work fine for when you are using getRepository() on its own, however they result in the above issue when using connection.getRepository() or manager.getRepository.
good to know @alexdavislws - i already wondered why not more people reported this @pleerock what do you think?
@chriswep because we are looking for problems in our code. I reviewed all the projects PRs and came to the conclusion that perhaps the problem is in TypeOrm.
const result = await repository.find( { where: whereClause });
doesn't work now
{ Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
_value= 'xxxxxxxxxxxxxxxxxxxxx' at line 1
@chriswep Thanks for opening this! Hope it will be solved soon.
UPDATE: works fine on 0.2.20
@matvi3nko @alexdavislws did you figure something out in the meantime? Maybe you can upvote the issue since it doesn't seem to get attention.
@chriswep my team and I ended up going with the select QueryBuilder. We just use the operators in generic SQL WHERE clause string (with :params) and pass it to the .where() methods.
ex:
const data = getRepository('some_table')
.createQueryBuilder('some_alias')
.select('some_alias')
.where('some_alias.col1 > :param1', { param1: 0 })
.getMany();
@matvi3nko @alexdavislws i tried updating to 0.2.24 and i can't reproduce the bug there. however i'm not sure if this is due to some other changes in my code and/or other dependencies - this issue doesn't seem to be addressed somewhere in the typeorm changelog. Can you confirm the issue is gone in the current version? If yes, we could close this issue.
@chriswep Hi, not work for In operator. Try to check - find({ where: { field: In(array) } }) It also drops find operator MySQL only, I think this is the same bug
the issue is most likely the same as in https://github.com/typeorm/typeorm/issues/6144 - having multiple typeorm versions in the same project.
Issue type:
[ ] question [X] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ]
cordova
[ ]mongodb
[ ]mssql
[X]mysql
/mariadb
[ ]oracle
[ ]postgres
[ ]cockroachdb
[ ]sqlite
[ ]sqljs
[ ]react-native
[ ]expo
TypeORM version:
[X]
latest
[ ]@next
[ ]0.x.x
(or put your version here)Steps to reproduce or a small repository showing the problem:
the query log shows:
and the error:
so apparently it just drops the find operator object into the sql query (since 0.2.21 - 0.2.20 works fine; only tested with
MoreThan
)