Index: trunk/logwood/logwood.c |
— | — | @@ -56,6 +56,8 @@ |
57 | 57 | |
58 | 58 | #define STMT_QUERY_URL "SELECT ur_id FROM url_id WHERE ur_site = ? AND ur_path = ?" |
59 | 59 | #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 (?)" |
60 | 62 | |
61 | 63 | #define STMT_QUERY_REF "SELECT ref_id FROM ref_ids WHERE ref_site = ? AND ref_url = ?" |
62 | 64 | #define STMT_INSERT_REF "INSERT IGNORE INTO ref_ids (ref_site, ref_url, ref_grouped) VALUES (?, ?, ?)" |
— | — | @@ -256,6 +258,10 @@ |
257 | 259 | MYSQL_STMT *stmt_update_wday; |
258 | 260 | MYSQL_BIND bind_update_wday[2]; |
259 | 261 | |
| 262 | +MYSQL_STMT *stmt_url_touched_del; |
| 263 | +MYSQL_STMT *stmt_url_touched_ins; |
| 264 | +MYSQL_BIND bind_url_touched[1]; |
| 265 | + |
260 | 266 | #define BIND_LONG(bind, l) \ |
261 | 267 | do { \ |
262 | 268 | bzero(&bind, sizeof(bind)); \ |
— | — | @@ -280,6 +286,7 @@ |
281 | 287 | BIND_LONG(bind_insert_wday[0], bind_query_site_si_id); |
282 | 288 | BIND_LONG(bind_insert_wday[1], bind_query_wday_day); |
283 | 289 | |
| 290 | + BIND_LONG(bind_url_touched[0], bind_query_url_ur_id); |
284 | 291 | |
285 | 292 | bzero(bind_update_wday, sizeof(bind_update_wday)); |
286 | 293 | bind_update_wday[0].buffer_type = MYSQL_TYPE_LONGLONG; |
— | — | @@ -492,6 +499,14 @@ |
493 | 500 | mysql_stmt_prepare(stmt_update_wday, STMT_UPDATE_WDAY, strlen(STMT_UPDATE_WDAY)); |
494 | 501 | mysql_stmt_bind_param(stmt_update_wday, bind_update_wday); |
495 | 502 | |
| 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 | + |
496 | 511 | if ((in = fopen(name, "r")) == NULL) { |
497 | 512 | perror(name); |
498 | 513 | return; |
— | — | @@ -713,6 +728,12 @@ |
714 | 729 | mysql_stmt_execute(stmt_incr_count); |
715 | 730 | |
716 | 731 | /* |
| 732 | + * Update last touched. |
| 733 | + */ |
| 734 | + mysql_stmt_execute(stmt_url_touched_del); |
| 735 | + mysql_stmt_execute(stmt_url_touched_ins); |
| 736 | + |
| 737 | + /* |
717 | 738 | * Insert the hour. |
718 | 739 | */ |
719 | 740 | bind_query_hour_hr_hour = tm->tm_hour; |