У меня еще вопрос (прежде всего к dikens3-как автору конфига autowhite_list). Что если вставлять записи в таблицу mylist одним запросом (с IGNORE и ON DUPLICATE KEY UPDATE)? Например вот так
Код: Выделить всё
INSERT IGNORE INTO mylist(src_email,dst_email,record_expires) VALUES ('$sender_address','$acl_m11@$acl_m12',DATE_ADD(now(), INTERVAL 30 DAY)) ON DUPLICATE KEY UPDATE record_expires=DATE_ADD(now(), INTERVAL 30 DAY))
Вот описания опций
#
If you use the IGNORE keyword, errors that occur while executing the INSERT statement are treated as warnings instead. For example, without IGNORE, a row that duplicates an existing UNIQUE index or PRIMARY KEY value in the table causes a duplicate-key error and the statement is aborted. With IGNORE, the row still is not inserted, but no error is issued. Data conversions that would trigger errors abort the statement if IGNORE is not specified. With IGNORE, invalid values are adjusted to the closest values and inserted; warnings are produced but the statement does not abort. You can determine with the mysql_info() C API function how many rows were actually inserted into the table.
#
If you specify ON DUPLICATE KEY UPDATE, and a row is inserted that would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an UPDATE of the old row is performed. The affected-rows value per row is 1 if the row is inserted as a new row and 2 if an existing row is updated. See Section 12.2.5.3, “INSERT ... ON DUPLICATE KEY UPDATE Syntax”.
Вроде тогда контроль за пересечением первичного ключа отдается mysql и можно не волноваться что что-то не отработает. Или я не прав?