Invalid Query Syntax errors

133 views
Skip to first unread message

Andrew Johnston

unread,
Oct 14, 2015, 1:44:52 PM10/14/15
to PHRETS
For the past week or so I have been getting seemingly random errors on my RETS queries.

This script runs every morning at the same time and has been running without issue for almost 2 months. Now all of the sudden, I am getting errors like the one below. The trace is always pointing to a different line number, but it is always during the Session->Search.

[14-Oct-2015 11:57:00 US/Central] PHP Fatal error:  Uncaught exception 'PHRETS\Exceptions\RETSException' with message 'Invalid Query Syntax' in C:\Scheduled_Tasks\report_manager\vendor\troydavisson\phrets\src\Session.php:378
Stack trace:
#0 C:\Scheduled_Tasks\report_manager\vendor\troydavisson\phrets\src\Session.php(296): PHRETS\Session->request('Search', Array)
#1 C:\Scheduled_Tasks\report_manager\mtsir.php(9): PHRETS\Session->Search('PROPERTY', 'LND', '(OFFICELIST=TRN...', Array)
#2 C:\Scheduled_Tasks\report_manager\index.php(25): include('C:\Scheduled_Ta...')
#3 {main}
  thrown
in C:\Scheduled_Tasks\report_manager\vendor\troydavisson\phrets\src\Session.php on line 378



Here is an example query that is receiving the error.

$rets->Search('PROPERTY', 'RES' ,'(OFFICELIST=TRNR*),(LISTSTATUS=|ACT)',['Select' => 'LISTPRICE,DAYSONMARKETCUMULATIVE','Format' => 'COMPACT-DECODED']);

I'll add that the RETS service I am using has also been returning random 502 Bad Gateway errors and timing up due to throughput issues.

Gennadiy Kofman

unread,
Oct 14, 2015, 3:30:18 PM10/14/15
to PHRETS
Your search code example is for the RES class.  Your error seem to happen for the LND class.

Perhaps there was a metadata update that changed either the fields you use to search or the fields you select.

Andrew Johnston

unread,
Oct 14, 2015, 4:57:51 PM10/14/15
to PHRETS
Yes. The error is different every time the script runs. I have a separate search running for each class. Sometimes the error returns on the first search and sometimes it runs a through the first couple and returns the error on one of the others.

The fields I am searching with an requesting are currently available in the metadata.

I have been made aware of a systematic problem with our RETS service, so maybe this issue is related.

Gennadiy Kofman

unread,
Oct 14, 2015, 5:16:29 PM10/14/15
to PHRETS
If it randomly happens, then yeah, it's probably not the metadata.

If the issue is with the Rets, then the best thing you can do is to catch that error and retry the query again.  You would have to catch that error specifically to avoid ignoring some other error.

You should still have some exit point to prevent an infinite loop.  Say try the query up to n times, no luck then exit.
Reply all
Reply to author
Forward
0 new messages