Path

ez projects / sqliimport / forum / general / dealing with offset

Attention please: Due to restructuring legacy services, the eZ Projects service is going to be discontinued. All the current repositories will be migrated to a new platform. More details will be announced soon.

Dealing with offset

You need to be logged in to post messages in the forums. New users may register here.

Matthieu Sévère

Member since:
11 October 2012

Posts: 34

Friday 10 September 2010 1:20:55 pm

Hi Jérome,

I'm currently investigating sqliimport to see if I can use it to replace a good old synchronisation script.

This script synchronize around 50 000 objects in eZ Publish and fetch the objects by calling a webservice several times and each time with a new offset (so that I don't fetch to 50 000 objects in one time).

The problem with your source handler is that you need to fetch all the objects in the initialize() method and process them one by one using getNextRow().

Is there is solution to avoid fetch all the objects in the initialize() method ?

Thanks for your advises
Matthieu

--
eZ certified developer: http://ez.no/certification/verify/346216

Up

Jérôme Vieilledent

Member since:
09 January 2008

Posts: 98

Friday 10 September 2010 3:58:00 pm

Hi Matthieu

Actually you can do whatever you want ! :)
The main thing is to return the right row in getNextRow().

What you could do is to make your WS calls in getNextRow(). I guess that you need to fetch your objects by packets don't you ? Well in that case, you'll just need to handle an internal counter to decrement for example. When it comes to 0, you recall your WS with an updated offset, and so on.
When you don't have any more objects returned by your WS, just return false as expected.

The only remaining point is the row count. Maybe you can have that count with another WS call ?

Hope this helps :)
Up

Matthieu Sévère

Member since:
11 October 2012

Posts: 34

Friday 10 September 2010 5:08:22 pm

Ok, I see.

Thank you :)

--
eZ certified developer: http://ez.no/certification/verify/346216

Up

You need to be logged in to post messages in the forums. New users may register here.