这个简单的SQL语句的含义是什么?

时间:2017-02-22 20:48:28

标签: sql-server tsql

我是T-SQL的新手。以下陈述的含义是什么?

// Firebase config
firebase.initializeApp(config);
var database = firebase.database();
var dbCounter = database.ref('/counter');

var access_token = 'ACCESS_TOKEN', // PASTE HERE YOUR FACEBOOK ACCESS TOKEN
    pageID = 'PAGE_ID', //Paste your Facebook Page ID here
    postID = 'POST_ID', // PASTE HERE YOUR POST ID
    postID = pageID+'_'+postID,
    refreshTime = 5, // Refresh time in seconds
    counter = {
        love : 0,
        wow : 0
    },
    cachedCounter = counter;

var reactions = ['LOVE', 'WOW'].map(function (e) {
        var code = 'reactions_' + e.toLowerCase();
        return 'reactions.type(' + e + ').limit(0).summary(total_count).as(' + code + ')'
    }).join(',');

var refreshCounts = function() {
    var url = 'https://graph.facebook.com/v2.8/' + postID + '?fields=' + reactions + '&access_token=' + access_token;
    $.getJSON(url, function(res){
        counter.love = res.reactions_love.summary.total_count;
        counter.wow = res.reactions_wow.summary.total_count;
        $('.reaction.love .count').text(counter.love);
        $('.reaction.wow .count').text(counter.wow);
    });
}

$(document).ready(function(){
    // Update the value of cachedCounter every time the database is updated
    dbCounter.on('value', function(res){
        // res.val() starts with the same value as the default counter
        cachedCounter = res.val();
    });

    // Only runs once
    dbCounter.once('value').then(function(res){
        setInterval(refreshCounts, refreshTime * 1000);
        refreshCounts();
    });

    // Reset counters while keeping count of reactions for new poll
    $('button.reset-count').click( function() {
        // Save current counter in database
        dbCounter.set(counter);
        // Set counters to 0
        $('.reaction .count').text(0);
        return false;
    } );
});

1 个答案:

答案 0 :(得分:3)

  • 开始,结束:不需要开始和结束。它识别代码 阻止,如果多一个语句就有用。
  • UPDATE table_name:更新表“table_name”中的数据。
  • SET:关键字,启动以逗号分隔的列 - 值对列表 更新
  • a =:a是列mame,右边的值是=是什么 值将被使用
  • ISNULL(@ f_flag,0):要分配的值。在这种情况下,IsNull检查@f_flag变量的值,如果为null,则使用0。

*注意:此处没有“WHERE”子句,因此,表中的所有行都将更新。