MySQL的SQLDependency等效项 [英] SQLDependency equivalent for MySQL

查看:207
本文介绍了MySQL的SQLDependency等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的ASP.net项目上实现实时更新,因此我尝试实现长轮询机制和Comet.

I want to implement a real time update on my ASP.net project, so i tried to implement the long poling mechanism and Comet.

var isPolling = 0;
function longPolling()
{
    isPolling++;
    $.ajax({
     type: "GET",
     url: "CometAsyncHandler.ashx?waitTime=60", // one minute

     //async: true, 
     cache: false,
     //timeout:12000,

     success: function(data){ 
        isPolling--;
        if(data == "NEWDATAISAVAILABLE")
            RefreshData(); // this function is generated by using RegisterFunctionToPostBack()
        else if( data == "TOOLONG-DOITAGAIN" )
            setTimeout("longPolling()", 0 );
        else
            addLongPollingError("error", "Error on server side. Received data: \"" + data + "\"");
    },
    error: function(XMLHttpRequest, textStatus, errorThrown){
        isPolling--;
        addLongPollingError("error", textStatus + " (" + errorThrown + ")");
    }
});

}

$(document).ready(function(){
  longPolling(); // Start the initial request 
});

我已经成功使用MSSQL数据库的SqlDependency类做到了这一点,并且可以正常工作,但是如何使用MySQL DB做到这一点.

I have successfully done that using SqlDependency class for MS SQL Database and it works but how to do this using MySQL DB.

推荐答案

您必须进行轮询.从理论上讲,您可以利用二进制日志,不知道有任何项目试图实现这一目标.

You have to poll. While in theory you could leverage the binary log, I am not aware of any project that tries to achieve this.

例如,参见 MySqlDependency

See for example MySqlDependency

这篇关于MySQL的SQLDependency等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆