当前位置: 首页>>代码示例>>PHP>>正文


PHP Profiler::setDAOMethod方法代码示例

本文整理汇总了PHP中Profiler::setDAOMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Profiler::setDAOMethod方法的具体用法?PHP Profiler::setDAOMethod怎么用?PHP Profiler::setDAOMethod使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Profiler的用法示例。


在下文中一共展示了Profiler::setDAOMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gc

 public function gc($max)
 {
     $q = "DELETE FROM #prefix#sessions WHERE updated < DATE_SUB(NOW(), INTERVAL :max SECOND)";
     $vars = array(':max' => $max);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return true;
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:10,代码来源:class.SessionMySQLDAO.php

示例2: insertCompanyDetails

 public function insertCompanyDetails($branch_data)
 {
     $ret = $this->makeInsertQueryArray($branch_data);
     $q = "INSERT INTO #prefix#user SET " . $ret['q'];
     $q .= ", added_date=NOW();";
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $ret['vars']);
     return $this->getUpdateCount($ps);
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:11,代码来源:class.CompanyMySQLDAO.php

示例3: updateMapNotification

 public function updateMapNotification($id)
 {
     $q = "UPDATE #prefix#map_notify SET read_at=NOW(), seen=1 ";
     $q .= "WHERE id=:id;";
     $vars = array(':id' => $id);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     $result = $this->getUpdateCount($ps);
     return $result > 0;
 }
开发者ID:prabhatse,项目名称:olx_hack,代码行数:12,代码来源:class.NotifyMySQLDAO.php

示例4: getRecentClickStats

 public function getRecentClickStats(Instance $instance, $limit = 10)
 {
     $q = "SELECT p.post_text, l.expanded_url, ls.short_url, ls.click_count ";
     $q .= "FROM #prefix#links_short ls INNER JOIN #prefix#links l ";
     $q .= "ON l.id = ls.link_id INNER JOIN #prefix#posts p ON p.id = l.post_key ";
     $q .= "WHERE p.author_username=:author_username AND p.network=:network ";
     $q .= "AND ls.click_count > 0 AND p.in_retweet_of_post_id IS NULL ";
     $q .= "GROUP BY short_url ORDER BY p.pub_date DESC LIMIT :limit";
     $vars = array(':author_username' => $instance->network_username, ':network' => $instance->network, ':limit' => (int) $limit);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getDataRowsAsArrays($ps);
 }
开发者ID:randomecho,项目名称:ThinkUp,代码行数:15,代码来源:class.ShortLinkMySQLDAO.php

示例5: getLinkByUrl

 public function getLinkByUrl($url)
 {
     $q = "SELECT l.* ";
     $q .= "FROM #prefix#links AS l ";
     $q .= "WHERE l.url=:url ";
     $vars = array(':url' => $url);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getDataRowAsObject($ps, "Link");
 }
开发者ID:rmanalan,项目名称:ThinkUp,代码行数:12,代码来源:class.LinkMySQLDAO.php

示例6: setTimezone

 public function setTimezone($email, $timezone)
 {
     $q = "UPDATE #prefix#owners\n             SET timezone=:timezone\n             WHERE email=:email";
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $stmt = $this->execute($q, array(':timezone' => $timezone, ':email' => $email));
     return $this->getUpdateCount($stmt);
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:9,代码来源:class.OwnerMySQLDAO.php

示例7: updateUsername

 public function updateUsername($id, $network_username)
 {
     $q = "UPDATE " . $this->getTableName() . " SET network_username = :network_username WHERE id = :id LIMIT 1";
     $vars = array(':id' => $id, ':network_username' => $network_username);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getUpdateCount($ps);
 }
开发者ID:randomecho,项目名称:ThinkUp,代码行数:10,代码来源:class.InstanceMySQLDAO.php

示例8: getOAuthTokens

 public function getOAuthTokens($id)
 {
     $q = "SELECT\n            oauth_access_token, oauth_access_token_secret, auth_error\n            FROM\n            #prefix#owner_instances\n            WHERE\n            instance_id = :instance_id ORDER BY id ASC LIMIT 1";
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $stmt = $this->execute($q, array(':instance_id' => $id));
     $tokens = $this->getDataRowAsArray($stmt);
     return $tokens;
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:10,代码来源:class.OwnerInstanceMySQLDAO.php

示例9: getAllFavoritedPostsForUserID

 /**
  * Get all the favorited posts of a user.
  * @TODO Use $order_by parameter to customize sort order.
  * @param int $author_user_id
  * @param str $network
  * @param int $count
  * @param str $order_by
  * @param int $page
  * @param bool $iterator Whether or not to return an iterator
  * @returns array Post objects
  */
 private function getAllFavoritedPostsForUserID($author_user_id, $network, $count, $order_by = "pub_date", $page = 1, $iterator = false)
 {
     // $direction = $direction=="DESC" ? "DESC": "ASC";
     $start_on_record = ($page - 1) * $count;
     // order-by information currently hardwired; this will probably change
     // if ( !in_array($order_by, $this->REQUIRED_FIELDS) && !in_array($orderaa_by, $this->OPTIONAL_FIELDS  )) {
     //     $order_by="pub_date";
     // }
     $q = "SELECT p.*, pub_date - interval #gmt_offset# hour AS adj_pub_date, ";
     //TODO: Store favlike_count_cache during Twitter crawl so we don't do this dynamic GROUP BY fakeout
     $q .= "count(*) AS favlike_count_cache ";
     $q .= "FROM (#prefix#posts p INNER JOIN #prefix#favorites f on f.post_id = p.post_id) ";
     $q .= "WHERE p.author_user_id = :author_user_id AND p.network = :network ";
     $q .= "GROUP BY p.post_text ORDER BY YEARWEEK(p.pub_date) DESC, favlike_count_cache DESC, p.pub_date DESC ";
     $q .= "LIMIT :start_on_record, :limit";
     $vars = array(':author_user_id' => (string) $author_user_id, ':network' => $network, ':limit' => $count, ':start_on_record' => (int) $start_on_record);
     $ps = $this->execute($q, $vars);
     if ($iterator) {
         return new PostIterator($ps);
     }
     $all_post_rows = $this->getDataRowsAsArrays($ps);
     $posts = array();
     if ($all_post_rows) {
         $post_keys_array = array();
         foreach ($all_post_rows as $row) {
             $post_keys_array[] = $row['id'];
         }
         // Get links
         $q = "SELECT * FROM #prefix#links WHERE post_key in (" . implode(',', $post_keys_array) . ")";
         if ($this->profiler_enabled) {
             Profiler::setDAOMethod(__METHOD__);
         }
         $ps = $this->execute($q);
         $all_link_rows = $this->getDataRowsAsArrays($ps);
         // Combine posts and links
         $posts = array();
         foreach ($all_post_rows as $post_row) {
             $post = new Post($post_row);
             foreach ($all_link_rows as $link_row) {
                 if ($link_row['post_key'] == $post->id) {
                     $post->addLink(new Link($link_row));
                 }
             }
             $posts[] = $post;
         }
     }
     return $posts;
 }
开发者ID:rmanalan,项目名称:ThinkUp,代码行数:59,代码来源:class.FavoritePostMySQLDAO.php

示例10: searchFollowers

 public function searchFollowers(array $keywords, $network, $user_id, $page_number = 1, $page_count = 20)
 {
     //parse advanced operators
     $name_keywords = array();
     $description_keywords = array();
     foreach ($keywords as $keyword) {
         if (substr($keyword, 0, strlen('name:')) == 'name:') {
             $name_keywords[] = substr($keyword, strlen('name:'), strlen($keyword));
         } else {
             $description_keywords[] = $keyword;
         }
     }
     $vars = array(':user_id' => (string) $user_id, ':network' => $network);
     $q = "SELECT u.*, " . $this->getAverageTweetCount() . " ";
     $q .= "FROM #prefix#users u ";
     $q .= "INNER JOIN #prefix#follows f ON f.follower_id = u.user_id AND f.network = u.network ";
     $q .= "WHERE f.user_id=:user_id AND u.network=:network AND (";
     if (count($name_keywords) > 0 && count($description_keywords) > 0) {
         $q .= "(";
         $counter = 0;
         foreach ($description_keywords as $keyword) {
             $q .= " u.description LIKE :keyword_d" . $counter . " ";
             if ($keyword != end($description_keywords)) {
                 $q .= "AND";
             }
             $counter++;
         }
         $q .= ") AND ( ";
         $counter = 0;
         foreach ($name_keywords as $keyword) {
             $q .= " u.full_name LIKE :keyword_n" . $counter . " ";
             if ($keyword != end($name_keywords)) {
                 $q .= "AND";
             }
             $counter++;
         }
         $q .= ")) ";
         $counter = 0;
         foreach ($description_keywords as $keyword) {
             $vars[':keyword_d' . $counter] = '%' . $keyword . '%';
             $counter++;
         }
         $counter = 0;
         foreach ($name_keywords as $keyword) {
             $vars[':keyword_n' . $counter] = '%' . $keyword . '%';
             $counter++;
         }
     } elseif (count($name_keywords) > 0) {
         $counter = 0;
         foreach ($name_keywords as $keyword) {
             $q .= " u.full_name LIKE :keyword_n" . $counter . " ";
             if ($keyword != end($name_keywords)) {
                 $q .= "AND";
             }
             $counter++;
         }
         $q .= ") ";
         $counter = 0;
         foreach ($name_keywords as $keyword) {
             $vars[':keyword_n' . $counter] = '%' . $keyword . '%';
             $counter++;
         }
     } elseif (count($description_keywords) > 0) {
         $counter = 0;
         foreach ($description_keywords as $keyword) {
             $q .= " u.description LIKE :keyword_d" . $counter . " ";
             if ($keyword != end($description_keywords)) {
                 $q .= "AND";
             }
             $counter++;
         }
         $q .= ") ";
         $counter = 0;
         foreach ($description_keywords as $keyword) {
             $vars[':keyword_d' . $counter] = '%' . $keyword . '%';
             $counter++;
         }
     }
     $q .= "ORDER BY first_seen DESC ";
     if ($page_count > 0) {
         $q .= "LIMIT :start_on_record, :limit;";
     } else {
         $q .= ';';
     }
     if ($page_count > 0) {
         $vars[':limit'] = (int) $page_count;
         $vars[':start_on_record'] = (int) $start_on_record;
     }
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getDataRowsAsObjects($ps, 'User');
 }
开发者ID:kuthulas,项目名称:ProjectX,代码行数:94,代码来源:class.FollowMySQLDAO.php

示例11: getHistory

 public function getHistory($network_user_id, $network, $units, $limit = 10, $before_date = null)
 {
     if ($before_date == date('Y-m-d')) {
         $before_date = null;
     }
     if ($units != "DAY" && $units != 'WEEK' && $units != 'MONTH') {
         $units = 'DAY';
     }
     if ($units == 'DAY') {
         $group_by = 'fc.date';
         $date_format = "DATE_FORMAT(date, '%m/%d/%Y')";
     } else {
         if ($units == 'WEEK') {
             $group_by = 'YEAR(fc.date), WEEK(fc.date)';
             $date_format = "DATE_FORMAT(date, '%m/%e')";
         } else {
             if ($units == 'MONTH') {
                 $group_by = 'YEAR(fc.date), MONTH(fc.date)';
                 $date_format = "DATE_FORMAT(date,'%m/01/%Y')";
             }
         }
     }
     $vars = array(':network_user_id' => (string) $network_user_id, ':network' => $network, ':limit' => (int) $limit);
     $q = "SELECT network_user_id, network, count, date, full_date FROM ";
     $q .= "(SELECT network_user_id, network, count, " . $date_format . " as date, date as full_date ";
     $q .= "FROM #prefix#follower_count AS fc ";
     $q .= "WHERE fc.network_user_id = :network_user_id AND fc.network=:network ";
     if ($before_date != null) {
         $q .= "AND date <= :before_date ";
         $vars[':before_date'] = $before_date;
     }
     $q .= "GROUP BY " . $group_by . " ORDER BY full_date DESC LIMIT :limit ) as history_counts ";
     $q .= "ORDER BY history_counts.full_date ASC";
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     $history_rows = $this->getDataRowsAsArrays($ps);
     $resultset = array();
     switch ($network) {
         case 'facebook':
             $follower_description = 'Friends';
             break;
         case 'facebook page':
             $follower_description = 'Fans';
             break;
         case 'twitter':
         default:
             $follower_description = 'Followers';
             break;
     }
     foreach ($history_rows as $row) {
         $timestamp = strtotime($row['full_date']);
         $resultset[] = array('c' => array(array('v' => sprintf('new Date(%d,%d,%d)', date('Y', $timestamp), date('n', $timestamp) - 1, date('j', $timestamp)), 'f' => $row['date']), array('v' => intval($row['count']))));
     }
     $metadata = array(array('type' => 'date', 'label' => 'Date'), array('type' => 'number', 'label' => $follower_description));
     $vis_data = json_encode(array('rows' => $resultset, 'cols' => $metadata));
     // Google Chart docs say that a string of the form "Date(Y,m,d)" should
     // work, but chrome throws an error if we don't use an actual Date
     // object.
     $vis_data = preg_replace('/"(new Date[^"]+)"/', '$1', $vis_data);
     if (sizeof($history_rows) > 1) {
         //break down rows into a simpler date=>count assoc array
         $simplified_history = array();
         foreach ($history_rows as $history_row) {
             $simplified_history[$history_row["date"]] = $history_row["count"];
         }
         $trend = false;
         if (sizeof($history_rows) == $limit) {
             //we have a complete data set
             //calculate the trend
             $first_follower_count = reset($simplified_history);
             $last_follower_count = end($simplified_history);
             $trend = ($last_follower_count - $first_follower_count) / sizeof($simplified_history);
             $trend = intval(round($trend));
             //complete data set
             $history = $simplified_history;
         } else {
             //there are dates with missing data
             //set up an array of all the dates to show in the chart
             $dates_to_display = array();
             $format = 'n/j';
             $date = date($format);
             $i = $limit;
             while ($i > 0) {
                 if ($units == "DAY") {
                     $format = 'm/d/Y';
                     $date_ago = date($format, strtotime('-' . $i . ' ' . $units . $date));
                 } else {
                     if ($units == "WEEK") {
                         if ($i == $limit) {
                             $last_saturday = Utils::getLastSaturday();
                         }
                         $date_ago = date($format, strtotime('-' . $i . ' ' . $units . $last_saturday));
                     } else {
                         $first_day_of_this_month = date('n/1');
                         $format = 'm/d/Y';
                         $date_ago = date($format, strtotime('-' . $i . ' ' . $units . $first_day_of_this_month));
                     }
                 }
//.........这里部分代码省略.........
开发者ID:kuthulas,项目名称:ProjectX,代码行数:101,代码来源:class.FollowerCountMySQLDAO.php

示例12: resetID

 public function resetID()
 {
     /**
      * Modified this ALTER to TRUNCATE due to not being able to reset auto_increment to 1. As per:
      * http://dev.mysql.com/doc/refman/5.6/en/alter-table.html
      * "You cannot reset the counter to a value less than or equal to to the value that is currently in use. For both
      * InnoDB and MyISAM, if the value is less than or equal to the maximum value currently in the AUTO_INCREMENT
      * column, the value is reset to the current maximum AUTO_INCREMENT column value plus one."
      */
     //$q = "ALTER TABLE #prefix#stream_data auto_increment = 1";
     $q = "TRUNCATE TABLE #prefix#stream_data";
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q);
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:16,代码来源:class.StreamDataMySQLDAO.php

示例13: deleteUsersByHashtagId

 public function deleteUsersByHashtagId($hashtag_id)
 {
     $q = "DELETE u.* ";
     $q .= "FROM #prefix#users u INNER JOIN #prefix#posts t ON u.user_id=t.author_user_id ";
     $q .= "INNER JOIN #prefix#hashtags_posts hp ON t.post_id = hp.post_id ";
     $q .= "WHERE hp.hashtag_id= :hashtag_id;";
     $vars = array(':hashtag_id' => $hashtag_id);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getDeleteCount($ps);
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:13,代码来源:class.UserMySQLDAO.php

示例14: updateTitle

 public function updateTitle($id, $title)
 {
     $q = "UPDATE #prefix#links SET title=:title WHERE id=:id;";
     $vars = array(':title' => $title, ':id' => $id);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     return $this->getUpdateCount($ps);
 }
开发者ID:JWFoxJr,项目名称:ThinkUp,代码行数:10,代码来源:class.LinkMySQLDAO.php

示例15: getAllOwnerInstanceInsightsSince

 public function getAllOwnerInstanceInsightsSince($owner_id, $since)
 {
     $q = "SELECT i.*, i.id as insight_key, su.*, u.avatar FROM #prefix#insights i ";
     $q .= "INNER JOIN #prefix#instances su ON i.instance_id = su.id ";
     $q .= "INNER JOIN #prefix#owner_instances oi ON su.id = oi.instance_id ";
     $q .= "LEFT JOIN #prefix#users u ON (su.network_user_id = u.user_id AND su.network = u.network) ";
     $q .= "WHERE su.is_active = 1 AND oi.owner_id = :owner_id AND time_generated > :since ";
     $q .= "AND i.filename != 'dashboard' ORDER BY date DESC, emphasis DESC, i.id;";
     $vars = array(":owner_id" => (int) $owner_id, ':since' => $since);
     if ($this->profiler_enabled) {
         Profiler::setDAOMethod(__METHOD__);
     }
     $ps = $this->execute($q, $vars);
     $rows = $this->getDataRowsAsArrays($ps);
     $insights = array();
     foreach ($rows as $row) {
         $insight = new Insight($row);
         $insight->instance = new Instance($row);
         $insight->instance->avatar = $row['avatar'];
         $insights[] = $insight;
     }
     return $insights;
 }
开发者ID:dgw,项目名称:ThinkUp,代码行数:23,代码来源:class.InsightMySQLDAO.php


注:本文中的Profiler::setDAOMethod方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。