Solution to problem in filter using "matches" expr

Support and queries relating to all previous versions of ZoneMinder
Locked
reaton
Posts: 6
Joined: Fri Sep 19, 2008 11:39 pm
Location: SE Kansas

Solution to problem in filter using "matches" expr

Post by reaton »

:D FYI.... I was having problems when I used the "matches" expression in filters. For example: I set PurgeWhenFull filter to only delete <Name><matches><Event> because if I renamed an event, I probably wanted to keep it. However, the matches clause would cause a sql error. I fixed the error by adding single quotes around the $value variable in filter.pl.

Changed from this:

Code: Select all

if ( $filter_terms{$op_name} eq '=~' )
                                {
                                        $filter_sql .= " regexp $value";
                                }
                                elsif ( $filter_terms{$op_name} eq '!~' )
                                {
                                        $filter_sql .= " not regexp $value";
Changed to this:

Code: Select all


if ( $filter_terms{$op_name} eq '=~' )
                                {
                                        $filter_sql .= " regexp '$value'";
                                }
                                elsif ( $filter_terms{$op_name} eq '!~' )
                                {
                                        $filter_sql .= " not regexp '$value'";
I thought that I could place single quotes around the <Event> text in the filter window but this would not work. I found that I had to place the quotes in the PERL script.
User avatar
kingofkya
Posts: 1110
Joined: Mon Mar 26, 2007 6:07 am
Location: Las Vegas, Nevada

Post by kingofkya »

you do realize there is an archive function that will save events until you delete with out your creative query

on top of event window there is a button called archive
reaton
Posts: 6
Joined: Fri Sep 19, 2008 11:39 pm
Location: SE Kansas

Post by reaton »

kingofkya wrote:you do realize there is an archive function that will save events until you delete with out your creative query on top of event window there is a button called archive...
Yes, I know this. In fact my PurgeWhenFull filter has a condition of 'NotArchived', however I set the 'creative query' condition because if I saw an event and changed the name but did not archive it, the event won't be deleted. Sort of a failsafe for not deleting important events.
Locked