开发者

php sql synchronous wait

I'm relatively new to web programming. I hope this one is easy. I've got a server app running that's monitoring a SQL table. Whenever an integer field turns positive, the app reads the rest of the row and fills in a long 开发者_如何学Ctext field in the same record. I've now got a php script that sets the int field, and needs to wait until the app sets the field back to zero and then read the text field and echo it back to the remote user. I tried this (odbc):

$processed = 0;
while ( !$processed )
    {
    $rs = odbc_exec( $conn, $sql );
    odbc_fetch_row($rs);
    $processed = odbc_result( $rs, "Processed");
    $output = odbc_result( $rs,"OutputSpec");
    }

I takes about 5 sec. to finish. Too slow. I put a counter in and it takes ~10000 iterations for 'processed' to change. I know my server app changes the field instantaneously. Similar result in the SqlServer. There must be something delaying the commit or something?


you need to use the observer pattern

use a known action to trigger an update.

Here are some PHP implementation details

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜