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


PHP ADODB_mysqli::Execute方法代码示例

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


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

示例1: handleWork

 function handleWork($msgId)
 {
     $message = $this->db->GetRow("SELECT server_id, message, id, handle_attempts FROM messages WHERE id=?", array($msgId));
     try {
         if ($message['handle_attempts'] >= 3) {
             $this->db->Execute("UPDATE messages SET status=? WHERE id=?", array(MESSAGE_STATUS::FAILED, $message['id']));
         } else {
             try {
                 $DBServer = DBServer::LoadByID($message['server_id']);
             } catch (Exception $e) {
                 $this->db->Execute("UPDATE messages SET status=? WHERE id=?", array(MESSAGE_STATUS::FAILED, $message['id']));
                 return;
             }
             if ($DBServer->status == SERVER_STATUS::RUNNING || $DBServer->status == SERVER_STATUS::INIT || $DBServer->status == SERVER_STATUS::IMPORTING || $DBServer->status == SERVER_STATUS::TEMPORARY || $DBServer->status == SERVER_STATUS::PENDING_TERMINATE) {
                 $msg = $this->messageSerializer->unserialize($message['message']);
                 $msg->dbMessageId = $message['id'];
                 $DBServer->SendMessage($msg);
             } elseif (in_array($DBServer->status, array(SERVER_STATUS::TROUBLESHOOTING, SERVER_STATUS::TERMINATED, SERVER_STATUS::SUSPENDED))) {
                 $this->db->Execute("UPDATE messages SET status=? WHERE id=?", array(MESSAGE_STATUS::FAILED, $message['id']));
             }
         }
     } catch (Exception $e) {
         //var_dump($e->getMessage());
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:25,代码来源:MessagingQueue.php

示例2: enqueue

 /**
  * {@inheritdoc}
  * @see \Scalr\System\Zmq\Cron\TaskInterface::enqueue()
  */
 public function enqueue()
 {
     $queue = new ArrayObject([]);
     //This is necessary for the next query
     $this->db->Execute("SET @fid := NULL, @num := NULL");
     //Selects one Farm Role from each Farm with synchronous lauhch type and
     //all Farm Roles from each Farm with asynchronous launch type
     $rs = $this->db->Execute("\n            SELECT * FROM (\n                SELECT IF(f.`farm_roles_launch_order` = 1, @num := IF(@fid = f.`id`, @num + 1, 1), 1) `row_number`,\n            \t    @fid := f.`id` `farm_id`,\n            \t    f.`name` `farm_name`,\n            \t    fr.`id` `farm_role_id`,\n            \t    rs.`value` `dt_last_polling`,\n            \t    rs2.`value` `polling_interval`,\n                    f.`farm_roles_launch_order`\n                FROM `farms` f\n                JOIN `clients` c ON c.`id` = f.`clientid`\n                JOIN `client_environments` ce ON ce.`id` = f.`env_id`\n                JOIN `farm_roles` fr ON fr.`farmid` = f.`id`\n                LEFT JOIN `farm_role_settings` rs  ON rs.`farm_roleid` = fr.`id` AND rs.`name` = ?\n                LEFT JOIN `farm_role_settings` rs2 ON rs2.`farm_roleid` = fr.`id` AND rs2.`name` = ?\n                WHERE c.`status` = ? AND ce.`status` = ? AND f.`status` = ?\n                AND (rs.`value` IS NULL OR UNIX_TIMESTAMP() > rs.`value` + IFNULL(rs2.`value`, 1) * 60)\n                ORDER BY f.`id`, fr.`launch_index`\n            ) t WHERE t.`row_number` = 1\n        ", [DBFarmRole::SETTING_SCALING_LAST_POLLING_TIME, DBFarmRole::SETTING_SCALING_POLLING_INTERVAL, Scalr_Account::STATUS_ACTIVE, Scalr_Environment::STATUS_ACTIVE, FARM_STATUS::RUNNING]);
     while ($row = $rs->FetchRow()) {
         $obj = new stdClass();
         $obj->farmId = $row['farm_id'];
         $obj->farmName = $row['farm_name'];
         if (!$row['farm_roles_launch_order']) {
             //Asynchronous launch order
             $obj->farmRoleId = $row['farm_role_id'];
             $obj->lastPollingTime = $row['last_polling_time'];
             $obj->pollingInterval = $row['polling_interval'];
         }
         $queue->append($obj);
     }
     if ($count = $queue->count()) {
         $this->getLogger()->info("%d running farm roles found.", $count);
     }
     return $queue;
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:29,代码来源:Scaling.php

示例3: getFinancialAdmins

 /**
  * Gets all active financial admins
  *
  * @return   array  Returns all financial admins array(Scalr_Account_User)
  */
 public function getFinancialAdmins()
 {
     $rs = $this->db->Execute("SELECT id FROM account_users WHERE type = ? AND status = ?", [\Scalr_Account_User::TYPE_FIN_ADMIN, \Scalr_Account_User::STATUS_ACTIVE]);
     $result = [];
     while ($row = $rs->FetchRow()) {
         $user = \Scalr_Account_User::init()->loadById($row['id']);
         $result[$user->id] = $user;
     }
     return $result;
 }
开发者ID:rickb838,项目名称:scalr,代码行数:15,代码来源:Notifications.php

示例4: cancelLastRequest

 public function cancelLastRequest()
 {
     $last = $this->getLastRequest();
     if ($last && $last['status'] == self::STATUS_PENDING) {
         $this->db->Execute('UPDATE farm_lease_requests SET status = ? WHERE id = ?', array(self::STATUS_CANCEL, $last['id']));
         return true;
     } else {
         return false;
     }
 }
开发者ID:mheydt,项目名称:scalr,代码行数:10,代码来源:FarmLease.php

示例5: handle

 function handle($queue, Scalr_Messaging_Msg $message, $rawMessage, $type = 'xml')
 {
     $this->logger->info(sprintf("Received message '%s' from server '%s'", $message->getName(), $message->getServerId()));
     try {
         $this->db->Execute("INSERT INTO messages SET\n                messageid = ?,\n                message = ?,\n                server_id = ?,\n                dtadded = NOW(),\n                type = ?,\n                ipaddress = ?,\n                message_name = ?,\n                message_format = ?\n            ", array($message->messageId, $rawMessage, $message->getServerId(), "in", $_SERVER['REMOTE_ADDR'], $message->getName(), $type));
     } catch (Exception $e) {
         // Message may be already delivered.
         // urlopen issue on scalarizr side:
         // QueryEnvError: <urlopen error [Errno 4] Interrupted system call>
         if (strpos($e->getMessage(), 'Duplicate entry') === false) {
             throw $e;
         }
     }
 }
开发者ID:sacredwebsite,项目名称:scalr,代码行数:14,代码来源:ControlQueueHandler.php

示例6: getAccountProjects

 /**
  * Gets available projects for account scope
  *
  * @param int        $accountId     Current user object
  * @param string     $query         optional Search criteria
  * @return \Scalr\Model\Collections\ArrayCollection
  */
 public function getAccountProjects($accountId, $query = null)
 {
     $collection = $this->findByKey($query, ['accountId' => $accountId], true);
     //Select identifiers of all projects assigned to farms from the account
     $assignedProjects = [];
     $rs = $this->db->Execute("\n            SELECT DISTINCT fs.value\n            FROM farms f\n            JOIN farm_settings fs ON f.id = fs.farmid\n            WHERE fs.name = ?\n            AND f.clientid = ?\n        ", [Entity\FarmSetting::PROJECT_ID, $accountId]);
     while ($rec = $rs->fetchRow()) {
         $assignedProjects[$rec['value']] = true;
     }
     //Adjusts missing projects.
     //This is going to be very rare event.
     foreach ($collection as $projectEntity) {
         if (isset($assignedProjects[$projectEntity->projectId])) {
             unset($assignedProjects[$projectEntity->projectId]);
         }
     }
     foreach ($assignedProjects as $projectId => $v) {
         $project = ProjectEntity::findPk($projectId);
         /* @var $project ProjectEntity */
         $projectBillingCode = $project->getProperty(ProjectPropertyEntity::NAME_BILLING_CODE);
         if (empty($query) || (stripos($project->name, $query) !== false || stripos($projectBillingCode, $query) !== false)) {
             $collection->append($project);
         }
     }
     return $collection;
 }
开发者ID:scalr,项目名称:scalr,代码行数:33,代码来源:Projects.php

示例7: get

 /**
  * Gets event list
  *
  * @param  \DateTime              $start      Start date of the period
  * @param  \DateTime              $end        End date of the period
  * @param  array                  $criteria   optional Filter array ['filterId' => 'value']
  * @return ArrayCollection        Returns collection of the TimelineEventEntity objects
  */
 public function get($start, $end, array $criteria = null)
 {
     $eventEntity = new TimelineEventEntity();
     $joinData = $this->buildJoin($criteria);
     $and = '';
     if (!empty($criteria['envId'])) {
         $and = 'AND e.env_id =' . $criteria['envId'];
     } else {
         if (!empty($criteria['accountId'])) {
             $and = 'AND e.account_id =' . $criteria['accountId'];
         }
     }
     $fields = '';
     foreach ($eventEntity->getIterator()->fields() as $field) {
         $fields .= ',`' . $field->column->name . '`';
     }
     $result = $this->db->Execute("\n            SELECT " . ltrim($fields, ',') . "\n            FROM (\n                SELECT " . $eventEntity->fields('e') . "\n                FROM " . $eventEntity->table('e') . (isset($joinData['join']) ? $joinData['join'] : '') . "\n                WHERE e.dtime BETWEEN " . $eventEntity->qstr('dtime', $start) . " AND " . $eventEntity->qstr('dtime', $end) . " " . $and . "\n                " . (isset($joinData['join']) ? "\n                UNION\n                SELECT " . $eventEntity->fields('e2') . "\n                FROM " . $eventEntity->table('e2') . "\n                WHERE e2.event_type = " . $eventEntity::EVENT_TYPE_CHANGE_CLOUD_PRICING . "\n                AND e2.dtime BETWEEN " . $eventEntity->qstr('dtime', $start) . " AND " . $eventEntity->qstr('dtime', $end) : "") . "\n            ) p\n            ORDER BY p.dtime DESC\n        ");
     $events = new ArrayCollection();
     while ($record = $result->FetchRow()) {
         $item = new TimelineEventEntity();
         $item->load($record);
         $events->append($item);
     }
     return $events;
 }
开发者ID:mheydt,项目名称:scalr,代码行数:33,代码来源:Events.php

示例8: fetchStatusBefore

 /**
  * Fetches statuses of the previous updates
  */
 private function fetchStatusBefore()
 {
     $this->stateBefore = new \ArrayObject();
     //Loads performed updates of MYSQL type
     $rs = $this->db->Execute("\n            SELECT LOWER(HEX(u.`uuid`)) `uuid`, u.`released`, u.`appears`, u.`applied`, u.`status`, LOWER(HEX(u.`hash`)) `hash`\n            FROM `" . self::DB_TABLE_UPGRADES . "` u\n        ");
     while ($rec = $rs->FetchRow()) {
         $entity = new MysqlUpgradeEntity();
         $entity->load($rec);
         $this->stateBefore[$rec['uuid']] = $entity;
         if (isset($entity->appears) && $this->maxDate < $entity->appears) {
             $this->maxDate = $entity->appears;
         }
     }
     //Loads updates of FileSystem type
     self::checkFilesystemStorage();
     //Loads performed updates of Filesystem type
     foreach (new FilesystemStorageIterator(self::FS_STORAGE_PATH) as $fileInfo) {
         /* @var $fileInfo \SplFileInfo */
         if (!$fileInfo->isReadable()) {
             throw new Exception\UpgradeException(sprintf('Could not read from file "%s". Lack of access permissions.', $fileInfo->getFilename()));
         }
         $entity = new FilesystemUpgradeEntity();
         $obj = unserialize(file_get_contents($fileInfo->getPathname()));
         if (!is_object($obj)) {
             throw new Exception\UpgradeException(sprintf('There was error while trying to load record from filesystem storage "%s". Object is expected, %s given', $fileInfo->getPathname(), gettype($obj)));
         }
         $entity->load($obj);
         $this->stateBefore[$entity->uuid] = $entity;
         if (isset($entity->appears) && $this->maxDate < $entity->appears) {
             $this->maxDate = $entity->appears;
         }
         unset($obj);
     }
 }
开发者ID:recipe,项目名称:scalr,代码行数:37,代码来源:UpgradeHandler.php

示例9: save

 /**
  * Saves an entity to database
  *
  * @return \Scalr\Server\History
  * @throws Exception
  */
 public function save()
 {
     $stmt = array();
     $bind = array();
     $idKey = 'id';
     $idValue = array();
     $cols = array();
     foreach ($this->_getFields() as $field) {
         $cols[$field] = $this->{$field};
     }
     if (array_key_exists($idKey, $cols)) {
         if ($cols[$idKey]) {
             $idValue[] = $cols[$idKey];
         }
         unset($cols[$idKey]);
     }
     foreach ($cols as $field => $value) {
         $stmt[] = "`" . Scalr::decamelize($field) . "` = ?";
         $bind[] = $value;
     }
     try {
         $stmt = (empty($idValue) ? "INSERT" : "UPDATE") . " `servers_history` SET " . join(", ", $stmt) . (!empty($idValue) ? " WHERE `" . Scalr::decamelize($idKey) . "` = ?" : "");
         $this->db->Execute($stmt, array_merge($bind, $idValue));
         if (empty($idValue)) {
             $this->{$idKey} = $this->db->Insert_ID();
         }
     } catch (Exception $e) {
         throw new Exception(sprintf("Cannot save server history record. Error: %s", $e->getMessage()), $e->getCode());
     }
     return $this;
 }
开发者ID:recipe,项目名称:scalr,代码行数:37,代码来源:History.php

示例10: save

 public function save()
 {
     if ($this->exists) {
         $this->db->Execute("UPDATE farm_role_cloud_services SET\n                `farm_id` = ?,\n                `farm_role_id` = ?,\n                `platform` = ?,\n                `cloud_location` = ?\n                WHERE `id` = ?\n            ", array($this->farmId, $this->farmRoleId, $this->platform, $this->cloudLocation, $this->serviceId));
     } else {
         $this->db->Execute("INSERT INTO farm_role_cloud_services SET\n                `id`      = ?,\n                `type`    = ?,\n                `env_id`  = ?,\n                `farm_id` = ?,\n                `farm_role_id` = ?,\n                `platform` = ?,\n                `cloud_location` = ?\n            ", array($this->serviceId, $this->type, $this->envId, $this->farmId, $this->farmRoleId, $this->platform, $this->cloudLocation));
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:8,代码来源:FarmRoleService.php

示例11: getFarmsList

 /**
  * Get the list of the farms which are assigned to specified project
  *
  * @param   string                   $projectId  The UUID of the project
  * @return  array     Returns the array looks like [farm_id => name]
  */
 public function getFarmsList($projectId)
 {
     $ret = [];
     $res = $this->db->Execute("\n            SELECT f.id, f.name FROM farms f\n            JOIN farm_settings s ON s.farmid = f.id\n            WHERE s.name = ? AND s.value = ?\n        ", [\DBFarm::SETTING_PROJECT_ID, $projectId]);
     while ($rec = $res->FetchRow()) {
         $ret[$rec['id']] = $rec['name'];
     }
     return $ret;
 }
开发者ID:rickb838,项目名称:scalr,代码行数:15,代码来源:Projects.php

示例12: delete

 public function delete($id = null)
 {
     $id = !is_null($id) ? $id : $this->id;
     try {
         $this->db->Execute("DELETE FROM {$this->dbTableName} WHERE id=?", array($id));
     } catch (Exception $e) {
         throw new Exception(sprintf(_("Cannot delete record. Error: %s"), $e->getMessage()), $e->getCode());
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:9,代码来源:Model.php

示例13: LogRequest

 protected function LogRequest($trans_id, $action, $ipaddr, $request, $response)
 {
     if ($request['debug'] == 1 || $request['Debug'] == 1 || $request['Action'] == 'DNSZoneRecordAdd') {
         try {
             $this->DB->Execute("INSERT INTO api_log SET\n                    transaction_id\t= ?,\n                    dtadded\t\t\t= ?,\n                    action\t\t\t= ?,\n                    ipaddress\t\t= ?,\n                    request\t\t\t= ?,\n                    response\t\t= ?,\n                    clientid\t\t= ?,\n                    env_id\t\t\t= ?\n                ", array($trans_id, time(), $action, $ipaddr, http_build_query($request), $response, $this->user->getAccountId(), $this->Environment->id));
         } catch (Exception $e) {
         }
     }
 }
开发者ID:rickb838,项目名称:scalr,代码行数:9,代码来源:class.ScalrAPICore.php

示例14: getCloudLocations

 /**
  * Gets all known cloud locations for the specified platform.
  *
  * These locations are retrieved from prices table, not from
  * the environment settings.
  *
  * @param   string    $platform  The cloud platform
  * @return  array     Returns array looks like array(url1 => array(cloudLocation1, cloudLocation2, ...), url2 => ...);
  */
 public function getCloudLocations($platform)
 {
     $ret = [];
     $res = $this->cadb->Execute("\n            SELECT DISTINCT `url`, `cloud_location` FROM `price_history`\n            WHERE `platform` = ?\n        ", [$platform]);
     while ($rec = $res->FetchRow()) {
         $url = is_null($rec['url']) ? '' : $rec['url'];
         $ret[$url][] = $rec['cloud_location'];
     }
     return $ret;
 }
开发者ID:mheydt,项目名称:scalr,代码行数:19,代码来源:Prices.php

示例15: LogRequest

 protected function LogRequest($trans_id, $action, $ipaddr, $request, $response)
 {
     $request = filter_var_array($request, ['debug' => ['filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_SCALAR], 'Debug' => ['filter' => FILTER_VALIDATE_INT, 'flags' => FILTER_REQUIRE_SCALAR], 'Action' => ['filter' => FILTER_DEFAULT, 'flags' => FILTER_REQUIRE_SCALAR]], true);
     if ($request['debug'] === 1 || $request['Debug'] === 1 || $request['Action'] === 'DNSZoneRecordAdd') {
         try {
             $this->DB->Execute("\n                    INSERT INTO api_log SET\n                        transaction_id = ?,\n                        dtadded        = ?,\n                        action         = ?,\n                        ipaddress      = ?,\n                        request        = ?,\n                        response       = ?,\n                        clientid       = ?,\n                        env_id         = ?\n                ", [$trans_id, time(), $action, $ipaddr, http_build_query($request), $response, $this->user instanceof Scalr_Account_User ? $this->user->getAccountId() : null, !empty($this->Environment->id) ? $this->Environment->id : null]);
         } catch (Exception $ignore) {
         }
     }
 }
开发者ID:scalr,项目名称:scalr,代码行数:10,代码来源:class.ScalrAPICore.php


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