문제

I am having a wee problem, and I am sure there is a more convenient/simpler way to achieve the solution, but all searches are throw in up a blanks at the moment !

I have a mysql db that is regularly updated by php page [ via a cron job ] this adds or deletes entries as appropriate.

My issue is that I also need to check if any details [ie the phone number or similar] for the entry have changed, but doing this at every call is not possible [ not only does is seem to me to be overkill, but I am restricted by a 3rd party api call limit] Plus this is not critical info.

So I was thinking it might be best to just check one entry per page call, and iterate through the rows/entires with each successive page call.

What would be the best way of doing this, ie keeping track of which entry/row in the table that the should be checked next?

I have 2 ideas of how to implement this:

1 ) The id of current row could be save to a file on the server [ surely not the best way]

2) an extra boolean field [check] is add to the table, set to True on the first entry and false to all other. Then on each page call it; finds 'where check = TRUE' runs the update check on this row, 'set check = FALSE' 'set [the next row] check = TRUE'

Si this the best way to do this, or does anyone have any better sugestion ?

thanks in advance !

.k

PS sorry about the title

올바른 솔루션이 없습니다

다른 팁

순차 워크 플로우

순차 워크 플로는 일련의 단계를 나타냅니다. 단계는 마지막 활동이 완료 될 때까지 다른 단계로 수행됩니다. 순차적 워크 플로는 항상 실행시 항상 엄격하게 순차적입니다. 외부 이벤트를 받고 병렬 로직 흐름을 포함 할 수 있기 때문에 정확한 실행 순서가 다를 수 있습니다. 다음 그림은 순차 워크 플로우의 예를 보여줍니다.

여기에 이미지 설명을 입력하십시오

순차 프로세스는 다음과 같습니다. 여기에 이미지 설명

상태 기계 워크 플로

상태 머신 워크 플로는 일련의 상태, 전환 및 작업을 나타냅니다. 상태 시스템 워크 플로의 단계는 비동기 적으로 실행됩니다. 즉, 반드시 반드시 수행 할 필요는 없지만 대신 액션 및 상태에 의해 트리거됩니다. 하나의 상태가 시작 상태로 할당 된 다음 이벤트를 기반으로 다른 상태가 전환됩니다. 상태 시스템은 워크 플로의 끝을 결정하는 최종 상태를 가질 수 있습니다. 다음 다이어그램은 상태 시스템 워크 플로우의 예를 보여줍니다.

여기에 이미지 설명

상태 시스템 프로세스는 다음과 같습니다. 여기에 이미지 설명

참조 링크

MSDN 링크

https://www.nothingbutsharepoint.com/sites/eusp/pages/sharepoint-state-machine-or-squential-workflows-what-the-future-of-business-processes. ASPX

You can store the timestamp that a row is updated implicitly using ON UPDATE CURRENT_TIMESTAMP [http://dev.mysql.com/doc/refman/5.0/en/timestamp.html] or explicitly in your update SQL. Then all you need to do is select the row(s) with the lowest timestamp (using ORDER BY and LIMIT) and you have the next row to process. So long as you ensure that the timestamp is updated each time.

e.g. Say you used the field last_polled_on TIMESTAMP to store the time you polled a row. Your insert looks like:

INSERT INTO table (..., last_polled_on) VALUES (..., NOW());

Your update looks like:

UPDATE table SET ..., last_polled_on = NOW() WHERE ...;

And your select for the next row to poll looks like:

SELECT ... FROM table ORDER BY last_polled_on LIMIT 1;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top