From ecf6e51ad4a3df0d54da53807ef3becfe2ccbe03 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 10 Jan 2008 16:25:38 +0000 Subject: [PATCH] refactor PassiveProfiling into using placeholders for speedup --- lib/WebGUI/PassiveProfiling.pm | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lib/WebGUI/PassiveProfiling.pm b/lib/WebGUI/PassiveProfiling.pm index b7a676ab6..85d1b6e47 100644 --- a/lib/WebGUI/PassiveProfiling.pm +++ b/lib/WebGUI/PassiveProfiling.pm @@ -54,17 +54,16 @@ The assetId to add. =cut sub add { - my $session = shift; - return unless ($session->setting->get("passiveProfilingEnabled")); - my $assetId = shift; - my $sql = "insert into passiveProfileLog (passiveProfileLogId, userId, sessionId, assetId, dateOfEntry) - values (".$session->db->quote($session->id->generate()).",". - $session->db->quote($session->user->userId).",". - $session->db->quote($session->var->get("sessionId")).",". - $session->db->quote($assetId).",". - $session->db->quote($session->datetime->time()).")"; - $session->db->write($sql); - return; + my $session = shift; + return unless ($session->setting->get("passiveProfilingEnabled")); + my $assetId = shift; + $session->db->write("insert into passiveProfileLog (passiveProfileLogId, userId, sessionId, assetId, dateOfEntry) values (?,?,?,?,?)", + [ + $session->id->generate(), $session->user->userId, + $session->var->get("sessionId"), $assetId, + $session->datetime->time(), + ]); + return; } #-------------------------------------------------------------------