When setting "pre event image count" to a high-ish value (200), the SQL query constructed in zm_event.cpp Event::AddFrames can exceed the length allowed by ZM_SQL_LGE_BUFSIZ.
10/26/13 17:21:55.391681 zma_m3[5151].DB1-zm_event.cpp/525 [Adding 200/200 frames to DB]
10/26/13 17:21:55.392908 zma_m3[5151].ERR-zm_event.cpp/529 [Can't insert frames: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1]
Consider batching these INSERTs with reasonable batch sizes, and/or use std::string concatenation (or std::stringstream) to build up these strings instead of all of this low-level pointer arithmetic with fixed buffer sizes.