[Dehs-devel] r166 - trunk
atomo64-guest at alioth.debian.org
atomo64-guest at alioth.debian.org
Sun Dec 7 18:42:27 UTC 2008
Author: atomo64-guest
Date: 2008-12-07 18:42:26 +0000 (Sun, 07 Dec 2008)
New Revision: 166
Modified:
trunk/events.class.php
Log:
Do not use LIKE when searching for already recorded events by default, doesn't work well with backslashes
Modified: trunk/events.class.php
===================================================================
--- trunk/events.class.php 2008-11-29 19:26:56 UTC (rev 165)
+++ trunk/events.class.php 2008-12-07 18:42:26 UTC (rev 166)
@@ -120,7 +120,7 @@
pg_exec($db, "INSERT INTO events (name,type,dist,content,stamp) VALUES ('$packageName','$eventType','$distribution','$content',now())") OR die_status("Failed to record event: $packageName|$eventType|$distribution|$content");
}
- function _searchEvent($eventType, $packageName, $contentSearch, $distribution = '')
+ function _searchEvent($eventType, $packageName, $contentSearch, $distribution = '', $strict = true)
{
$db = events::DB();
@@ -128,7 +128,7 @@
$packageName = pg_escape_string($packageName);
$contentSearch = pg_escape_string($contentSearch);
- $result = pg_exec($db, "SELECT id FROM events WHERE name='$packageName' and type='$eventType' ".($distribution? "and dist='$distribution'":'')." and content LIKE '$contentSearch'") or die_status(pg_last_error($db)."\nFailed to SELECT id FROM events...\n");
+ $result = pg_exec($db, "SELECT id FROM events WHERE name='$packageName' and type='$eventType' ".($distribution? "and dist='$distribution'":'')." and content ".($strict? '=' : 'LIKE')."'$contentSearch'") or die_status(pg_last_error($db)."\nFailed to SELECT id FROM events...\n");
return pg_fetch_all($result);
}
More information about the Dehs-devel
mailing list