r10195 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10194‎ | r10195 | r10196 >
Date:07:32, 18 July 2005
Author:kateturner
Status:old
Tags:
Comment:
update url_touched
Modified paths:
  • /trunk/logwood/logwood.c (modified) (history)

Diff [purge]

Index: trunk/logwood/logwood.c
@@ -56,6 +56,8 @@
5757
5858 #define STMT_QUERY_URL "SELECT ur_id FROM url_id WHERE ur_site = ? AND ur_path = ?"
5959 #define STMT_INSERT_URL "INSERT IGNORE INTO url_id (ur_site, ur_path, ur_grouped) VALUES (?, ?, ?)"
 60+#define STMT_URL_TOUCHED_DEL "DELETE FROM url_touched WHERE ur_url_id = ?"
 61+#define STMT_URL_TOUCHED_INS "INSERT INTO url_touched (ur_url_id) VALUES (?)"
6062
6163 #define STMT_QUERY_REF "SELECT ref_id FROM ref_ids WHERE ref_site = ? AND ref_url = ?"
6264 #define STMT_INSERT_REF "INSERT IGNORE INTO ref_ids (ref_site, ref_url, ref_grouped) VALUES (?, ?, ?)"
@@ -256,6 +258,10 @@
257259 MYSQL_STMT *stmt_update_wday;
258260 MYSQL_BIND bind_update_wday[2];
259261
 262+MYSQL_STMT *stmt_url_touched_del;
 263+MYSQL_STMT *stmt_url_touched_ins;
 264+MYSQL_BIND bind_url_touched[1];
 265+
260266 #define BIND_LONG(bind, l) \
261267 do { \
262268 bzero(&bind, sizeof(bind)); \
@@ -280,6 +286,7 @@
281287 BIND_LONG(bind_insert_wday[0], bind_query_site_si_id);
282288 BIND_LONG(bind_insert_wday[1], bind_query_wday_day);
283289
 290+ BIND_LONG(bind_url_touched[0], bind_query_url_ur_id);
284291
285292 bzero(bind_update_wday, sizeof(bind_update_wday));
286293 bind_update_wday[0].buffer_type = MYSQL_TYPE_LONGLONG;
@@ -492,6 +499,14 @@
493500 mysql_stmt_prepare(stmt_update_wday, STMT_UPDATE_WDAY, strlen(STMT_UPDATE_WDAY));
494501 mysql_stmt_bind_param(stmt_update_wday, bind_update_wday);
495502
 503+ stmt_url_touched_ins = mysql_stmt_init(&connection);
 504+ mysql_stmt_prepare(stmt_url_touched_ins, STMT_URL_TOUCHED_INS, strlen(STMT_URL_TOUCHED_INS));
 505+ mysql_stmt_bind_param(stmt_url_touched_ins, bind_url_touched);
 506+
 507+ stmt_url_touched_del = mysql_stmt_init(&connection);
 508+ mysql_stmt_prepare(stmt_url_touched_del, STMT_URL_TOUCHED_DEL, strlen(STMT_URL_TOUCHED_DEL));
 509+ mysql_stmt_bind_param(stmt_url_touched_del, bind_url_touched);
 510+
496511 if ((in = fopen(name, "r")) == NULL) {
497512 perror(name);
498513 return;
@@ -713,6 +728,12 @@
714729 mysql_stmt_execute(stmt_incr_count);
715730
716731 /*
 732+ * Update last touched.
 733+ */
 734+ mysql_stmt_execute(stmt_url_touched_del);
 735+ mysql_stmt_execute(stmt_url_touched_ins);
 736+
 737+ /*
717738 * Insert the hour.
718739 */
719740 bind_query_hour_hr_hour = tm->tm_hour;

Status & tagging log