MCPcopy Create free account
hub / github.com/dwyl/learn-postgresql / select_next_page

Function select_next_page

server/db.js:297–316  ·  view source on GitHub ↗

* select_next_page get the next url (page) to crawl

(callback)

Source from the content-addressed store, hash-verified

295 * select_next_page get the next url (page) to crawl
296 */
297function select_next_page (callback) {
298 connect( function () {
299 const query = `SELECT next_page, COUNT (next_page) AS c
300 FROM logs
301 WHERE next_page IS NOT null
302 AND next_page NOT IN (
303 SELECT url
304 FROM logs
305 WHERE url IS NOT NULL
306 )
307 GROUP BY next_page
308 ORDER BY c ASC
309 LIMIT 1;`;
310 // console.log('L82: query:', query);
311 PG_CLIENT.query(query, function(error, data) {
312 utils.log_error(error, data, new Error().stack);
313 return utils.exec_cb(callback, error, data);
314 });
315 });
316}
317
318module.exports = {
319 connect: connect,

Callers

nothing calls this directly

Calls 1

connectFunction · 0.85

Tested by

no test coverage detected