-
Notifications
You must be signed in to change notification settings - Fork 11
Problem when 0 rows returned #9
Description
First off congrats on this great module. It's been fantastic.
The requirement is to transfer data from 4d to Firebase and your module makes it easy – mostly.
I found a problem yesterday that I haven't been able to resolve.
I had some code to fetch some related data.
Roughly my structure is something like
Projects -> Jobs -> items
To make things simpler I am importing for just one project at the moment.
So after importing the project, I go and fetch the jobs for that project. No problems so far.
Then for each job I need to import all the items for that job. This is where I ran into problems.
I was issuing an SQL request for each job in a forEach loop. I kept running into the error
Unknown status byte: 4
I spent a lot of time looking at the data stream to try to find out where this was going wrong. It turned out it only occurred when there were 0 items to fetch for the job.
Checking the data stream, everything seems OK except for the status 4.
In this case I can see Row-Count-Sent: 0 and can verify this is the correct result in 4D for that job.
There is a really simple solution here. Instead of issuing multiple SQL calls, just bundle it up as a single call to fetch all items for all jobs (ie use IN instead of WHERE). This works perfectly, but it would be interesting to know how we could modify the module so it would handle the situation above.