我是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;
} );
});
答案 0 :(得分:3)
*注意:此处没有“WHERE”子句,因此,表中的所有行都将更新。