Execute all statements and returns boolean on succes/failure
@return boolean
436421
public function execute() {

		foreach($this -> stmt as $stmt) {
			$this -> executeStatement($stmt);
		}

		$this -> shadow = $this -> stmt;
		$this -> reset();

		//Write time for debugging
		$this -> trace = microtime(true) - $this -> trace;

		return true;
	}
329723
public function execute()
    {
        try {
            $opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
            $pdo = new PDO('sqlite:' . $this->path, $opts);

            foreach ($this->queries as $query) {
                $pdo->query($this->phpci->interpolate($query));
            }
        } catch (\Exception $ex) {
            $this->phpci->logFailure($ex->getMessage());
            return false;
        }
        return true;
    }
276414
public function execute()
    {
        $build = $this->phpci->buildPath;

        if ($this->directory == $build) {
            return false;
        }

        $this->wipeExistingDirectory();

        $cmd = 'mkdir -p "%s" && cp -R "%s" "%s"';
        if (IS_WIN) {
            $cmd = 'mkdir -p "%s" && xcopy /E "%s" "%s"';
        }

        $success = $this->phpci->executeCommand($cmd, $this->directory, $build, $this->directory);

        $this->deleteIgnoredFiles();

        return $success;
    }
1274749
public function execute()
    {
        
        if (null === $this->statement) {
            throw new Exception('The database statement resource is not currently set.');
        }
        if ($this->statement->execute()) {
            
            if (($metaData = $this->statement->result_metadata()) !== false) {
                foreach ($metaData->fetch_fields() as $col) {
                    ${$col->name}   = null;
                    $results[]      = &${$col->name};
                    $cols[]         = $col->name;
                }
                
                call_user_func_array([$this->statement, 'bind_result'], $results);
                
                $this->stmt_results = $results;
                $this->stmt_cols = $cols;
            }
            return true;
        }
        return false;
    }
190348
public function run()
    {
        // If the truthTest failed, don't run
        if ($this->truthTest !== true) {
            return false;
        }

        // If overlapping, don't run
        if ($this->isOverlapping()) {
            return false;
        }

        // Write lock file if necessary
        $this->createLockFile();

        // Call before if required
        if (is_callable($this->before)) {
            call_user_func($this->before);
        }

        // If command is callable...
        if (is_callable($this->command)) {
            $this->output = $this->exec();
        } else {
            $args = \is_string($this->args) ? $this->args : implode(' ', $this->args);
            $command = $this->command . ' ' . $args;
            $process = new Process($command);

            $this->process = $process;

            if ($this->runInBackground()) {
                $process->start();
            } else {
                $process->run();
                $this->finalize();
            }
        }

        return true;
    }
691554
public function execute()
    {
        if (!defined('ENABLE_SHELL_PLUGIN') || !ENABLE_SHELL_PLUGIN) {
            throw new \Exception(Lang::get('shell_not_enabled'));
        }

        $success = true;

        foreach ($this->commands as $command) {
            $command = $this->phpci->interpolate($command);

            if (!$this->phpci->executeCommand($command)) {
                $success = false;
            }
        }

        return $success;
    }
807766
private function exec()
    {
        $return_data = '';
        ob_start();
        try {
            $return_data = call_user_func_array($this->command, $this->args);
            $this->successful = true;
        } catch (\RuntimeException $e) {
            $this->successful = false;
        }
        $this->output = ob_get_clean() . (is_string($return_data) ? $return_data : '');

        $this->postRun();
    }
918827
public function execute()
	{
		$this->connect();

		if (!is_resource($this->connection))
		{
			$this->log(
				Log\LogLevel::ERROR,
				'Database query failed (error #{code}): {message}',
				array('code' => $this->errorNum, 'message' => $this->errorMsg)
			);
			throw new \RuntimeException($this->errorMsg, $this->errorNum);
		}

		// Take a local copy so that we don't modify the original query and cause issues later
		$sql = $this->replacePrefix((string) $this->sql);

		if ($this->limit > 0 || $this->offset > 0)
		{
			$sql .= ' LIMIT ' . $this->limit . ' OFFSET ' . $this->offset;
		}

		// Increment the query counter.
		$this->count++;

		// If debugging is enabled then let's log the query.
		if ($this->debug)
		{
			// Add the query to the object queue.
			$this->log(
				Log\LogLevel::DEBUG,
				'{sql}',
				array('sql' => $sql, 'category' => 'databasequery', 'trace' => debug_backtrace())
			);
		}

		// Reset the error values.
		$this->errorNum = 0;
		$this->errorMsg = '';

		// Execute the query. Error suppression is used here to prevent warnings/notices that the connection has been lost.
		$this->cursor = @pg_query($this->connection, $sql);

		// If an error occurred handle it.
		if (!$this->cursor)
		{
			// Check if the server was disconnected.
			if (!$this->connected())
			{
				try
				{
					// Attempt to reconnect.
					$this->connection = null;
					$this->connect();
				}
				catch (\RuntimeException $e)
				// If connect fails, ignore that exception and throw the normal exception.
				{
					// Get the error number and message.
					$this->errorNum = (int) pg_result_error_field($this->cursor, PGSQL_DIAG_SQLSTATE) . ' ';
					$this->errorMsg = pg_last_error($this->connection) . "\nSQL=$sql";

					// Throw the normal query exception.
					$this->log(
						Log\LogLevel::ERROR,
						'Database query failed (error #{code}): {message}',
						array('code' => $this->errorNum, 'message' => $this->errorMsg)
					);
					throw new \RuntimeException($this->errorMsg);
				}

				// Since we were able to reconnect, run the query again.
				return $this->execute();
			}
			else
			// The server was not disconnected.
			{
				// Get the error number and message.
				$this->errorNum = (int) pg_result_error_field($this->cursor, PGSQL_DIAG_SQLSTATE) . ' ';
				$this->errorMsg = pg_last_error($this->connection) . "\nSQL=$sql";

				// Throw the normal query exception.
				$this->log(
					Log\LogLevel::ERROR,
					'Database query failed (error #{code}): {message}',
					array('code' => $this->errorNum, 'message' => $this->errorMsg)
				);
				throw new \RuntimeException($this->errorMsg);
			}
		}

		return $this->cursor;
	}
517747
public function execute()
    {
        if (empty($this->_filecontent) || empty($this->_ids)) {
            return;
        }
        foreach ($this->_filecontent as $disk=>$result) {
            // set the start and end offset in the result string at the beginning and end respectively
            // just in case we don't find the two strings, so that it still works as expected.
            $startIndex = 0;
            $endIndex = 0;
            $vendorInfos = "";

            // locate the beginning string offset for the attributes
            if (preg_match('/(Vendor Specific SMART Attributes with Thresholds)/', $result, $matches, PREG_OFFSET_CAPTURE))
               $startIndex = $matches[0][1];

            // locate the end string offset for the attributes, this is usually right before string "SMART Error Log Version" or "SMART Error Log not supported" or "Error SMART Error Log Read failed" (hopefully every output has it!)
            if (preg_match('/(SMART Error Log Version)|(SMART Error Log not supported)|(Error SMART Error Log Read failed)/', $result, $matches, PREG_OFFSET_CAPTURE))
               $endIndex = $matches[0][1];

            if ($startIndex && $endIndex && ($endIndex>$startIndex))
                 $vendorInfos = preg_split("/\n/", substr($result, $startIndex, $endIndex - $startIndex));

            if (!empty($vendorInfos)) {
                $labels = preg_split('/\s+/', $vendorInfos[1]);
                foreach ($labels as $k=>$v) {
                    $labels[$k] = str_replace('#', '', strtolower($v));
                }
                $i = 0; // Line number
                foreach ($vendorInfos as $line) {
                    $line = preg_replace('/^\s+/', '', $line);
                    $values = preg_split('/\s+/', $line);
                    if (count($values) > count($labels)) {
                        $values = array_slice($values, 0, count($labels), true);
                    }
                    $j = 0;
                    $found = false;
                    foreach ($values as $value) {
                        if ((in_array($value, array_keys($this->_ids)) && $labels[$j] == 'id')) {
                          $arrFullVa = preg_split('/-/', $this->_ids[$value]);
                          if (($arrFullVa[0]=="#replace") && !empty($arrFullVa[1]))
                              $value=$arrFullVa[1];
                        }
                        if (((in_array($value, array_keys($this->_ids)) && $labels[$j] == 'id') || ($found && (in_array($labels[$j], array_values($this->_ids)))) || ($found && $labels[$j] == 'attribute_name'))) {
                            $this->_result[$disk][$i][$labels[$j]] = $value;
                            $found = true;
                        }
                        $j++;
                    }
                    $i++;
                }
            } else {
                //SCSI and MVMe devices
                if (!empty($this->_ids[1]) && ($this->_ids[1]=="raw_value")) {
                    if (preg_match('/\nread\: (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[7]!=null)) {
                            $this->_result[$disk][0]['id'] = 1;
                            $this->_result[$disk][0]['attribute_name'] = "Raw_Read_Error_Rate";
                            $this->_result[$disk][0]['raw_value'] = trim($values[7]);
                        }
                    } elseif (preg_match('/\Media and Data Integrity Errors\: (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[5]!=null)) {
                            $vals=preg_replace('/,/', '', trim($values[5]));
                            $this->_result[$disk][0]['id'] = 1;
                            $this->_result[$disk][0]['attribute_name'] = "Raw_Read_Error_Rate";
                            $this->_result[$disk][0]['raw_value'] = $vals;
                        }
                    }
                }
                if (!empty($this->_ids[5]) && ($this->_ids[5]=="raw_value")) {
                    if (preg_match('/\nElements in grown defect list\: (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[5]!=null)) {
                            $this->_result[$disk][1]['id'] = 5;
                            $this->_result[$disk][1]['attribute_name'] = "Reallocated_Sector_Ct";
                            $this->_result[$disk][1]['raw_value'] = trim($values[5]);
                        }
                    }
                }
                if (!empty($this->_ids[9]) && ($this->_ids[9]=="raw_value")) {
                    if (preg_match('/\n +number of hours powered up = (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[7]!=null)) {
                            $vals=preg_split('/[,\.]/', trim($values[7]));
                            $this->_result[$disk][2]['id'] = 9;
                            $this->_result[$disk][2]['attribute_name'] = "Power_On_Hours";
                            $this->_result[$disk][2]['raw_value'] =  $vals[0];
                        }
                    } elseif (preg_match('/\nPower On Hours\: (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[3]!=null)) {
                            $vals=preg_replace('/,/', '', trim($values[3]));
                            $this->_result[$disk][2]['id'] = 9;
                            $this->_result[$disk][2]['attribute_name'] = "Power_On_Hours";
                            $this->_result[$disk][2]['raw_value'] =  $vals;
                        }
                    }
                }
                if (!empty($this->_ids[194]) && ($this->_ids[194]=="raw_value")) {
                    if (preg_match('/\nCurrent Drive Temperature\: (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[3]!=null)) {
                            $this->_result[$disk][3]['id'] = 194;
                            $this->_result[$disk][3]['attribute_name'] = "Temperature_Celsius";
                            $this->_result[$disk][3]['raw_value'] = trim($values[3]);
                        }
                    } elseif (preg_match('/\nTemperature\: (.*) Celsius/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[1]!=null)) {
                            $this->_result[$disk][3]['id'] = 194;
                            $this->_result[$disk][3]['attribute_name'] = "Temperature_Celsius";
                            $this->_result[$disk][3]['raw_value'] = trim($values[1]);
                        }
                    }
                }
                if (!empty($this->_ids[12]) && ($this->_ids[12]=="raw_value")) {
                    if (preg_match('/\nPower Cycles\: (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[2]!=null)) {
                            $vals=preg_replace('/,/', '', trim($values[2]));
                            $this->_result[$disk][4]['id'] = 12;
                            $this->_result[$disk][4]['attribute_name'] = "Power_Cycle_Count";
                            $this->_result[$disk][4]['raw_value'] = $vals;
                        }
                    }
                }
                if (!empty($this->_ids[192]) && ($this->_ids[192]=="raw_value")) {
                    if (preg_match('/\nUnsafe Shutdowns\: (.*)\n/', $result, $lines)) {
                        $values=preg_split('/ +/', $lines[0]);
                        if (!empty($values) && ($values[2]!=null)) {
                            $vals=preg_replace('/,/', '', trim($values[2]));
                            $this->_result[$disk][5]['id'] = 192;
                            $this->_result[$disk][5]['attribute_name'] = "Unsafe_Shutdown_Count";
                            $this->_result[$disk][5]['raw_value'] = $vals;
                        }
                    }
                }
            }
        }
        //Usage test
        $newIds = array();
        foreach ($this->_ids as $id=>$column_name) {
            $found = 0;
            foreach ($this->_result as $diskName=>$diskInfos) {
                if ($found!=2) foreach ($diskInfos as $lineInfos) {
                    if ($found!=2) {
                        $found = 0;
                        foreach ($lineInfos as $label=>$value) {
                            if (($found==0) && ($label=="id") && ($value==$id))
                                $found = 1;
                            if (($found==1) && ($label==$column_name))
                                $found = 2;
                        }
                    }
                }
            }
            if ($found==2) $newIds[$id] = $this->_ids[$id];
        }
        $this->_ids = $newIds;
    }
1009574
private function _execute($args = array())
    {
        if ($this->_err) {
            return false;
        };
        if ($this->_sth) {
            if ($this->_sth->execute($args)) {
                return true;
            } else {
                $this->_err = implode(' ', $this->_sth->errorInfo());
                return false;
            };
        } else {
            $this->_err = "No statement to execute.";
        };
        return false;
    }
249605
protected function doExecute()
    {
        $factory = $this->console->container->get('queue.manager');
        $failer  = $this->console->container->get('queue.failer');

        $all = $this->getOption('all');

        if ($all) {
            $ids = array_column($failer->all(), 'id');
        } else {
            $ids = $this->io->getArguments();

            if (!count($ids)) {
                throw new WrongArgumentException('No id provided');
            }
        }

        $delay = $this->getOption('delay');

        foreach ($ids as $id) {
            $failed = $failer->get($id);

            $connection = Arr::get($failed, 'connection', null);

            $manager = $factory->getManager($connection);

            $manager->pushRaw(json_decode($failed['body'], true), $delay, $failed['queue']);

            if (!$all) {
                $this->out(sprintf(
                    'Resend failed-job: <info>%s</info> to connection: <option>%s</option> queue: <option>%s</option>',
                    $id,
                    $connection,
                    $failed['queue']
                ));

                $failer->remove($id);
            }
        }

        if ($all) {
            $this->out('Flush all failed-jobs');

            $failer->clear();
        }

        return true;
    }
323715
protected function _execute()
    {
        $result = null;
        $spec = function () {
            $this->_expectations = [];
            $closure = $this->_closure;
            $result = $this->_suite->runBlock($this, $closure, 'specification');
            foreach ($this->_expectations as $expectation) {
                $this->_passed = $expectation->process() && $this->_passed;
            }
            return $result;
        };

        $suite = $this->suite();
        return $spec();
    }
776067
public function execute()
    {
        $statement = $this->getPdoStatement();
        $result = $statement->execute($this->bindings);
        if (!$result) {
            $errorInfo = $statement->errorInfo();
            throw new RuntimeException(
                $errorInfo[1],
                $errorInfo[2]
            );
        }
        return $statement;
    }
1315696
public function execute() {
        global $CFG, $DB;

        $timenow = time();

        // Delete users who haven't confirmed within required period.
        if (!empty($CFG->deleteunconfirmed)) {
            $cuttime = $timenow - ($CFG->deleteunconfirmed * 3600);
            $rs = $DB->get_recordset_sql ("SELECT *
                                             FROM {user}
                                            WHERE confirmed = 0 AND timecreated > 0
                                                  AND timecreated < ? AND deleted = 0", array($cuttime));
            foreach ($rs as $user) {
                delete_user($user);
                mtrace(" Deleted unconfirmed user ".fullname($user, true)." ($user->id)");
            }
            $rs->close();
        }
    }
1051221
public function execute() {
        $issuers = \core\oauth2\api::get_all_issuers();
        foreach ($issuers as $issuer) {
            if ($issuer->is_system_account_connected()) {
                try {
                    // Try to get an authenticated client; renew token if necessary.
                    // Returns false or throws a moodle_exception on error.
                    $success = \core\oauth2\api::get_system_oauth_client($issuer);
                } catch (moodle_exception $e) {
                    $success = false;
                }
                if ($success === false) {
                    $this->notify_admins($issuer);
                }
            }
        }
    }
1145953
public function execute()
    {
        $this->result_set = new \FreeFW\Model\ResultSet();
        switch ($this->type) {
            case self::QUERY_SELECT:
                $model            = \FreeFW\DI\DI::get($this->main_model);
                $this->result_set = $this->strategy->select($model, $this->conditions);
                return true;
                break;
            case self::QUERY_DELETE:
                $model = \FreeFW\DI\DI::get($this->main_model);
                return $this->strategy->delete($model, $this->conditions);
                break;
            default:
                var_dump('error query execute');
                die;
        }
        return false;
    }
100564
public function execute()
    {
        try {
            // @ prepare hook
            $this->prepareExecute();

            // @ before event
            $this->triggerEvent('onControllerBeforeExecute', [
                'controller' => $this
            ]);

            // Prepare the last middleware, the last middleware is the real logic of this controller self.
            $chain = $this->getMiddlewareChain()->setEndMiddleware(function () {
                return $this->container->call([$this, 'doExecute'], [], $this);
            });

            // Do execute, run middlewares.
            $result = $chain->execute(new ControllerData(get_object_vars($this)));

            // @ post hook
            $result = $this->postExecute($result);

            // @ post event
            $this->triggerEvent('onControllerAfterExecute', [
                'controller' => $this,
                'result' => &$result,
            ]);
        } catch (ValidateFailException $e) {
            return $this->processFailure($e);
        } catch (\Exception $e) {
            // You can do some error handling in processFailure(), for example: rollback the transaction.
            $result = $this->processFailure($e);

            if (!$this->app->get('system.debug')) {
                return $result;
            }

            throw $e;
        } catch (\Throwable $t) {
            // You can do some error handling in processFailure(), for example: rollback the transaction.
            $this->processFailure(new \ErrorException(
                $t->getMessage(),
                $t->getCode(),
                E_ERROR,
                $t->getFile(),
                $t->getLine(),
                $t
            ));

            throw $t;
        }

        if ($result === false) {
            // You can do some error handling in processFailure(), for example: rollback the transaction.
            return $this->processFailure(new \Exception('Unknown Error'));
        }

        // Now we return result to package that it will handle response.
        return $this->processSuccess($result);
    }