Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Enable profiling in Stream DAOs
  • Loading branch information
ginatrapani committed Jul 6, 2012
1 parent a0935c2 commit f42e35a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions webapp/_lib/model/class.StreamDataMySQLDAO.php
Expand Up @@ -35,6 +35,7 @@ public function insertStreamData($content, $network = 'twitter') {
':data' =>$content,
':network' =>$network
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$res = $this->getUpdateCount($ps);
if (!$res) {
Expand All @@ -52,6 +53,7 @@ public function retrieveNextItem($network = 'twitter') {
$vars = array(
':network' =>$network
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$row = $this->getDataRowAsArray($ps);
if ($row) {
Expand All @@ -71,6 +73,7 @@ private function deleteItem($id) {
$vars = array(
':id' => $id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$res = $this->getUpdateCount($ps);
if (!$res) {
Expand All @@ -80,6 +83,7 @@ private function deleteItem($id) {

public function resetID() {
$q = "ALTER TABLE #prefix#stream_data auto_increment = 1";
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q);
}
}
9 changes: 9 additions & 0 deletions webapp/_lib/model/class.StreamProcMySQLDAO.php
Expand Up @@ -37,6 +37,7 @@ public function insertProcessInfo($process_id, $email, $instance_id) {
':email' => $email,
':instance_id' => $instance_id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$res = $this->getUpdateCount($ps);
if (!$res) {
Expand All @@ -51,6 +52,7 @@ public function getProcessInfo($process_id) {
$vars = array(
':process_id'=>$process_id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$row = $this->getDataRowAsArray($ps);
if (!$row) {
Expand All @@ -66,6 +68,7 @@ public function getProcessInfoForOwner($email, $instance_id) {
':email' => $email,
':instance_id' => $instance_id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$row = $this->getDataRowAsArray($ps);
if (!$row) {
Expand All @@ -81,6 +84,7 @@ public function getProcessInfoForInstance($instance_id) {
$vars = array(
':instance_id' => $instance_id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$row = $this->getDataRowAsArray($ps);
if (!$row) {
Expand All @@ -96,6 +100,7 @@ public function reportProcessActive($process_id) {
$vars = array(
':process_id' => $process_id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$res = $this->getUpdateCount($ps);
if (!$res) {
Expand All @@ -111,6 +116,7 @@ public function reportOwnerProcessActive($email, $instance_id) {
':email' => $email,
':instance_id' => $instance_id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$res = $this->getUpdateCount($ps);
if (!$res) {
Expand All @@ -121,13 +127,15 @@ public function reportOwnerProcessActive($email, $instance_id) {

private function getAllStreamProcessesNotIndexed() {
$q = "SELECT * FROM #prefix#stream_procs ";
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q);
$rows = $this->getDataRowsAsArrays($ps);
return $rows;
}

public function getAllStreamProcessIDs() {
$q = "SELECT process_id FROM #prefix#stream_procs ";
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q);
$rows = $this->getDataRowsAsArrays($ps);
return $rows;
Expand All @@ -151,6 +159,7 @@ public function deleteProcess($process_id) {
$vars = array(
':process_id' => $process_id
);
if ($this->profiler_enabled) Profiler::setDAOMethod(__METHOD__);
$ps = $this->execute($q, $vars);
$res = $this->getUpdateCount($ps);
if (!$res) {
Expand Down

0 comments on commit f42e35a

Please sign in to comment.