S
S
sasha_pe2019-12-19 18:28:27
MODX
sasha_pe, 2019-12-19 18:28:27

How to find sql error from MODX log?

Constantly there is an error about SQL syntax. I can't figure out where to look for it. Can you tell me how to catch her?
I tried to search by clicking on the links on the site and doing actions in the admin panel. So I didn't find it. The error appears on the production, but on the copy it is impossible to repeat.


[2019-12-19 18:22:06] (ERROR @ /home/site.ru/core/xpdo/om/xpdoobject.class.php : 240) Error 42000 executing statement:
Array
(
[0] => 42000
[ 1] => 1064
[2] => 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 ') DESC' at line 1
)

upd. Whoever encounters such a situation, you can correct this line in xpdoobject.class.php and add the output of the full sql query.
$xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Error ' . $criteria->stmt->errorCode() . " executing statement: \n" . print_r($errorInfo, true) . 'SQL' . $criteria-> toSQL());

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey c0re, 2019-12-19
@sasha_pe

Open the file /home/site.ru/core/xpdo/om/xpdoobject.class.php line 240
and see what kind of request is there that gives an error.
although this is a fake PDO class? hmm ... well, at least look at what object / method is called there
and look for a call to this place in the code.
PS: copy the base from the production! then it might be possible to do it again.

L
Lazy @BojackHorseman, 2019-12-19
SQL

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 ') DESC' at line 1
it is.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question