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


PHP object::execute方法代码示例

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


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

示例1: query

 /**
  * 执行sql查询
  *
  * @param string sql语句
  * @param array 参数数组
  * @param string 返回结果绑定到的对象
  * @param boolean 是否输出调试语句
  * @return void
  */
 public function query($sql, $params = array(), $class = 'stdClass', $debug = FALSE)
 {
     // 预处理绑定语句
     try {
         $this->stmt = $this->db->prepare($sql);
         if (!$this->stmt) {
             \core\Handler::appException('pdo prepare error with:' . $sql);
             throw new \Exception("system error", '49903');
         }
         // 参数绑定
         !$params or $this->bindValue($params);
         // 输出调试
         !$debug or $this->debug($sql, $params);
         // 执行一条sql语句
         if ($this->stmt->execute()) {
             // 设置解析模式
             $this->stmt->setFetchMode(\PDO::FETCH_CLASS, $class);
         } else {
             throw new \Exception('system error', '49904');
             // 获取数据库错误信息
             \core\Handler::appException($this->stmt->errorInfo()[2]);
         }
     } catch (\Exception $e) {
         \core\Handler::appException($e->getMessage());
         throw new \Exception('system error', '49902');
     }
 }
开发者ID:nicklos17,项目名称:eapi,代码行数:36,代码来源:ModelBase.php

示例2: execute

 public function execute($parameters = [])
 {
     if ($parameters) {
         return $this->statement->execute($parameters);
     } else {
         return $this->statement->execute();
     }
 }
开发者ID:mwyatt,项目名称:core,代码行数:8,代码来源:Pdo.php

示例3: instance

 /**
  * Create instance.
  *
  * @return object
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new self();
         self::$instance->setup_constants();
         self::$instance->includes();
         self::$instance->add_hooks();
         self::$instance->execute();
     }
     return self::$instance;
 }
开发者ID:gizburdt,项目名称:asq,代码行数:16,代码来源:asq.php

示例4: execute

 /**
  * Prepares a statement and executes the statement using the given query and parameters
  * @param string $sql A string of the sql query
  * @param array $params An array of the parameter
  * @todo Add proper exception handling
  * @since version 2.0
  * @static
  */
 public static function execute($sql, $params = array())
 {
     /* clear stmt */
     self::$stmt = "";
     try {
         self::$stmt = self::DBi()->prepare($sql);
         return self::$stmt->execute($params) ? true : false;
     } catch (PDOException $e) {
         return self::pdoException($e);
     }
 }
开发者ID:abrie,项目名称:go-nam-taxi,代码行数:19,代码来源:DB.php

示例5: executeRedirectTask

 public function executeRedirectTask()
 {
     // Joomla 2.5 Backward Compatibility
     if (version_compare(JVERSION, '3.0', '<')) {
         $task = JRequest::getCmd('task');
     } else {
         $app = Factory::getApplication();
         $task = $app->input->getCmd('task');
     }
     $this->controller->execute($task);
     $this->controller->redirect();
 }
开发者ID:lepca,项目名称:AllediaFramework,代码行数:12,代码来源:AbstractComponent.php

示例6: __construct

 /**
  * Set the statement object and the pages information
  *
  * @param PDOStatement object
  * @param $pages
  * @return void
  */
 public function __construct($statement, $pages = '')
 {
     if (get_class($statement) != 'PDOStatement') {
         throw new Exception('PDOStatement expected from this query: ' . Load::factory('Db')->last_sql, 1);
     }
     if (in_array('URI', Tk::$lib)) {
         self::$URI = Load::factory('URI');
     }
     $this->statement = $statement;
     unset($statement);
     $this->statement->execute();
     $this->pages = $pages;
 }
开发者ID:rogerluiz,项目名称:Toolkitty,代码行数:20,代码来源:Get_result.php

示例7: insertBuoyData

 /**
  * SQL query method used to insert buoy data.
  *
  * @access private
  * @param string $buoy_id Station ID number
  * @param integer $wind_dir Wind direction reading
  * @param float $wind_spd Wind speed reading
  * @param float $wave_height Wave height reading
  * @param float $water_temp Water temperature reading
  * @param integer $time Time of reading
  * @return boolean Successful insert query
  */
 function insertBuoyData($buoy_id, $wind_dir, $wind_spd, $wave_height, $water_temp, $time)
 {
     $sql = "INSERT INTO\n\t\t\t\t\t" . $this->_tbl . " (\n\t\t\t\t\t\tbuoy_id,\n\t\t\t\t\t\twind_dir,\n\t\t\t\t\t\twind_spd,\n\t\t\t\t\t\twave_height,\n\t\t\t\t\t\twater_temp,\n\t\t\t\t\t\treading_time,\n\t\t\t\t\t\tinsert_stamp\n\t\t\t\t\t) VALUES (\n\t\t\t\t\t\t?, ?, ?, ?, ?, ?, ?\n\t\t\t\t\t)";
     $sth = $this->_db->prepare($sql);
     if (DB::isError($sth)) {
         exit($sth->getMessage() . ": " . __FILE__ . ": " . __LINE__);
     }
     $data = array($buoy_id, $wind_dir, $wind_spd, $wave_height, $water_temp, $time, time());
     $res = $this->_db->execute($sth, $data);
     if (DB::isError($res)) {
         exit($res->getDebugInfo() . ": " . __FILE__ . ": " . __LINE__);
     }
     return true;
 }
开发者ID:quantegy,项目名称:buoy-data,代码行数:26,代码来源:class.buoy_data_db.php

示例8: saveDevice

 /**
  * Save a device (add or edit) to the backend.
  *
  * @param string $account  The account in which this device is valid
  * @param string $devid    Device ID to save
  * @param array $details      Array of device details
  */
 public function saveDevice($account, $devid, &$details)
 {
     // Check permissions and possibly update the authentication tokens
     parent::saveDevice($account, $devid, $details);
     // See getDevices() for an explanation of these conversions
     $details['alias'] = $details['name'];
     $details['name'] = $details['devid'];
     unset($details['devid']);
     $details['mailbox'] .= '@' . $account;
     // Prepare the SQL query and arguments
     $args = array($details['name'], $account, $details['callerid'], $details['mailbox'], $details['password'], $account, $details['alias']);
     if (!empty($devid)) {
         // This is an edit
         $details['name'] = $details['devid'];
         $sql = 'UPDATE %s SET name = ?, accountcode = ?, callerid = ?, ' . 'mailbox = ?, secret = ?, context = ?, alias = ?, ' . 'canreinvite = "no", nat = "yes", type = "peer", ' . 'host = "dynamic" WHERE name = ?';
         $args[] = $devid;
     } else {
         // This is an add.  Generate a new unique ID and secret
         $sql = 'INSERT INTO %s (name, accountcode, callerid, mailbox, ' . 'secret, context, alias, canreinvite, nat, type, host) ' . 'VALUES (?, ?, ?, ?, ?, ?, ?, "no", "yes", "peer", ' . '"dynamic")';
     }
     $sql = sprintf($sql, $this->_params['table']);
     $msg = 'SQL query in Shout_Driver_Sql#saveDevice(): ' . $sql;
     Horde::log($msg, 'DEBUG');
     $sth = $this->_write_db->prepare($sql);
     $result = $this->_write_db->execute($sth, $args);
     if ($result instanceof PEAR_Error) {
         $msg = $result->getMessage() . ': ' . $result->getDebugInfo();
         Horde::log($msg, 'ERR');
         throw new Shout_Exception(_("Internal database error.  Details have been logged for the administrator."));
     }
     return true;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:39,代码来源:Sql.php

示例9: updateEntity

 /**
  * adds attributres values to an before created table antry
  *
  * @return void
  * @access private
  */
 private function updateEntity($columns, $values)
 {
     $where_clause = "id = " . $this->entity_id;
     $handler = $this->db->autoPrepare($this->current_entity, $columns, DB_AUTOQUERY_UPDATE, $where_clause);
     $res = $this->db->execute($handler, $values);
     $this->handleDbError($res);
 }
开发者ID:BackupTheBerlios,项目名称:medialib-svn,代码行数:13,代码来源:HgkMediaLib_MetaDataFeed.php

示例10: _exectue

 /**
  * 执行SQL
  *
  * @param string $sSQL
  * @param array $aParam
  * @param boolean $bStrictMaster
  * @param boolean $bIsADU
  * @return unknown
  */
 protected function _exectue($sSQL, $aParam, $bStrictMaster, $bIsADU = false)
 {
     $iStartTime = microtime(true);
     ++self::$_iQueryCnt;
     self::$_aSQLs[] = $this->_sLastSQL = $sSQL;
     $db = $bStrictMaster ? $this->_getMasterDB() : $this->_getSlaveDB();
     $this->_oSth = $db->prepare($sSQL);
     if (!empty($aParam)) {
         $this->_bindParams($aParam);
     }
     $bRet = $this->_oSth->execute();
     if (false === $bRet) {
         $sMsg = 'SQL Error: ' . $this->_formatSQL($sSQL, $aParam) . "\n";
         $sMsg .= join("\n", $this->_oSth->errorInfo());
         throw new Exception($sMsg);
         return 0;
     }
     $iUseTime = round((microtime(true) - $iStartTime) * 1000, 2);
     self::$_iUseTime += $iUseTime;
     $iAffectedRows = $this->_oSth->rowCount();
     if ($this->_oDebug) {
         $this->_oDebug->debug('[DB->' . $this->_sDbName . ']: ' . $this->_formatSQL($sSQL, $aParam) . ' AffectedRows:' . $iAffectedRows . ' Use Time:' . $iUseTime . '毫秒');
     }
     // 记录增删改日志
     if ($bIsADU) {
         self::_addADUSQL('[DB->' . $this->_sDbName . ']: ' . $this->_formatSQL($sSQL, $aParam) . ' AffectedRows:' . $iAffectedRows . ' Use Time:' . $iUseTime . '毫秒');
     }
     if ($iAffectedRows > 0 && $bIsADU) {
         $this->clearWhereCache();
     }
     return $iAffectedRows;
 }
开发者ID:pancke,项目名称:yyaf,代码行数:41,代码来源:Orm.php

示例11: execute

 /**
  * execute(void)
  *
  * Continues the execution of the query after binding params
  *
  * @access  public
  * @return  void
  */
 public function execute()
 {
     $this->pdos->execute();
     $this->resultset = $this->pdos;
     /*
      * Get the total results with FOUND_ROWS()
      */
     $pdos_fr = $this->options['db_handle']->prepare("SELECT FOUND_ROWS();");
     $pdos_fr->execute();
     $pdos_fr_result = $pdos_fr->fetch(PDO::FETCH_ASSOC);
     $this->total_results = $pdos_fr_result['FOUND_ROWS()'];
     /*
      * Calculate the total number of pages
      */
     $this->calculate_number_of_pages();
     /*
      * Work out the total number of pages before an ellipses is shown
      */
     $this->calculate_max_pages_before_ellipses();
     /*
      * Build the HTML to output
      */
     $this->build_links();
     /*
      * Set success to true
      */
     $this->success = true;
 }
开发者ID:blusol,项目名称:flanelasys,代码行数:36,代码来源:pagination.php

示例12: modifierUtilisateur

 /**
  * @brief Méthode qui modifie le contenu d'un utilisateur
  * @param integer $idUtilisateur
  * @param string $nomUsager
  * @param string $motPasse
  * @param string $prenom
  * @param string $nom
  * @param string $courriel
  * @param string $descriptionProfil
  * @param string $photoProfil
  * @param string $administrateur
  * @access public
  * @return void
  */
 public function modifierUtilisateur($motPasse, $prenom, $nom, $descriptionProfil, $idUtilisateur)
 {
     $msgErreurs = $this->validerFormUtilisateur($prenom, $nom, $descriptionProfil);
     //Validation des champs obligatoires.
     if ($msgErreurs === null) {
         return $msgErreurs;
         //Retourne le/les message(s) d'erreur de la validation.
     } else {
         try {
             if ($motPasse == "") {
                 //                    return "test2";
                 self::$database->query('UPDATE utilisateurs SET prenom= :prenom, nom= :nom, descriptionProfil= :descriptionProfil WHERE idUtilisateur = :idUtilisateur');
                 self::$database->bind(':prenom', $prenom);
                 self::$database->bind(':nom', $nom);
                 self::$database->bind(':descriptionProfil', $descriptionProfil);
                 self::$database->bind(':idUtilisateur', $idUtilisateur);
             } else {
                 self::$database->query('UPDATE utilisateurs SET motPasse= :motPasse, prenom= :prenom, nom= :nom, descriptionProfil= :descriptionProfil WHERE idUtilisateur = :idUtilisateur');
                 self::$database->bind(':motPasse', $motPasse);
                 self::$database->bind(':prenom', $prenom);
                 self::$database->bind(':nom', $nom);
                 self::$database->bind(':descriptionProfil', $descriptionProfil);
                 self::$database->bind(':idUtilisateur', $idUtilisateur);
             }
             self::$database->execute();
         } catch (Exception $e) {
             $msgErreurs["errRequeteModif"] = $e->getMessage();
         }
     }
     return $msgErreurs;
     //array vide = succès.
 }
开发者ID:MontreArt,项目名称:origin,代码行数:46,代码来源:Utilisateur.class.php

示例13: log

 /**
  * Inserts $message to the currently open database.  Calls open(),
  * if necessary.  Also passes the message along to any Log_observer
  * instances that are observing this Log.
  *
  * @param mixed  $message  String or object containing the message to log.
  * @param string $priority The priority of the message.  Valid
  *                  values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
  *                  PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
  *                  PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
  * @return boolean  True on success or false on failure.
  * @access public
  */
 function log($message, $priority = null)
 {
     /* If a priority hasn't been specified, use the default value. */
     if ($priority === null) {
         $priority = $this->_priority;
     }
     /* Abort early if the priority is above the maximum logging level. */
     if (!$this->_isMasked($priority)) {
         return false;
     }
     /* If the connection isn't open and can't be opened, return failure. */
     if (!$this->_opened && !$this->open()) {
         return false;
     }
     /* If we don't already have our statement object yet, create it. */
     if (!is_object($this->_statement) && !$this->_prepareStatement()) {
         return false;
     }
     /* Extract the string representation of the message. */
     $message = $this->_extractMessage($message);
     /* Build our set of values for this log entry. */
     $id = $this->_db->nextId($this->_sequence);
     $values = array($id, $this->_ident, $priority, $message);
     /* Execute the SQL query for this log entry insertion. */
     $result =& $this->_db->execute($this->_statement, $values);
     if (DB::isError($result)) {
         return false;
     }
     $this->_announce(array('priority' => $priority, 'message' => $message));
     return true;
 }
开发者ID:jamesiarmes,项目名称:php-ups-api,代码行数:44,代码来源:sql.php

示例14: fetchTopicParticipants

 /**
  * Fetch the topic participants
  *
  * @access	public
  * @param	int			Topic ID
  * @param	boolean		Load and parse member data (TRUE for yes, FALSE for no)
  * @return	array 		Array of member data indexed by member ID
  */
 public function fetchTopicParticipants($topicID, $parseThem = FALSE)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $memberData = array();
     $remapData = array();
     //-----------------------------------------
     // Grab 'em
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'message_topic_user_map', 'where' => 'map_topic_id=' . intval($topicID)));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         $remapData[$row['map_user_id']] = $row;
     }
     if (!count($remapData)) {
         return array();
     }
     /* Parse 'em? */
     if ($parseThem === TRUE) {
         /* Grab member data */
         $memberData = IPSMember::load(array_keys($remapData), 'all');
         foreach ($memberData as $id => $data) {
             $data['_canBeBlocked'] = IPSMember::isIgnorable($data['member_group_id'], $data['mgroup_others']);
             $memberData[$id] = IPSMember::buildDisplayData($data, array('__all__' => 1));
             $memberData[$id] = array_merge($memberData[$id], $remapData[$id]);
         }
         $remapData = $memberData;
     }
     return $remapData;
 }
开发者ID:dalandis,项目名称:Visualization-of-Cell-Phone-Locations,代码行数:39,代码来源:messengerFunctions.php

示例15: executeCode

 /**
  * Execute javascript on the database
  *
  * @param mixed $code      MongoCode or javascript string
  * @param array $arguments function arguments
  *
  * @return mixed result
  */
 public function executeCode($code, array $arguments = [])
 {
     if (!$code instanceof MongoCode) {
         $code = new MongoCode($code);
     }
     return $this->database->execute($code, $arguments);
 }
开发者ID:kornrunner,项目名称:monga-mongodb,代码行数:15,代码来源:Database.php


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