This function executes the script for given layout for the current db.
775617
def doScript(self, script_name, params=None, return_all=False):
		""""""
		request = [
			uu({'-db': self._db }),
			uu({'-lay': self._layout }),
			uu({'-script': script_name})
		]

		if params:
			request.append(uu({'-script.param': params }))

		request.append(uu({'-findall': '' }))

		result = self._doRequest(request)
		result = FMResultset.FMResultset(result)

		try:
			# Try to return results from the script
			resp = result.resultset if return_all else result.resultset[0]
		except IndexError:
			resp = None

		return resp
338267
async def execute(
        self,
        db_name,
        sql,
        params=None,
        truncate=False,
        custom_time_limit=None,
        page_size=None,
    ):
        """"""
        page_size = page_size or self.page_size

        def sql_operation_in_thread(conn):
            time_limit_ms = self.sql_time_limit_ms
            if custom_time_limit and custom_time_limit < time_limit_ms:
                time_limit_ms = custom_time_limit

            with sqlite_timelimit(conn, time_limit_ms):
                try:
                    cursor = conn.cursor()
                    cursor.execute(sql, params or {})
                    max_returned_rows = self.max_returned_rows
                    if max_returned_rows == page_size:
                        max_returned_rows += 1
                    if max_returned_rows and truncate:
                        rows = cursor.fetchmany(max_returned_rows + 1)
                        truncated = len(rows) > max_returned_rows
                        rows = rows[:max_returned_rows]
                    else:
                        rows = cursor.fetchall()
                        truncated = False
                except sqlite3.OperationalError as e:
                    if e.args == ('interrupted',):
                        raise InterruptedError(e)
                    print(
                        "ERROR: conn={}, sql = {}, params = {}: {}".format(
                            conn, repr(sql), params, e
                        )
                    )
                    raise

            if truncate:
                return Results(rows, truncated, cursor.description)

            else:
                return Results(rows, False, cursor.description)

        with trace("sql", (db_name, sql.strip(), params)):
            results = await self.execute_against_connection_in_thread(
                db_name, sql_operation_in_thread
            )
        return results
1319921
async def execute(self, stmt, *args):
        
        with (await self.application.db.cursor()) as cur:
            await cur.execute(stmt, args)
721708
void runScript() {

        //Show report field and hide form fields
        m_report.setVisible(true);
        m_form.setVisible(false);
        m_ok.setEnabled(false);

        Map<String, String> webconfig = OpenCms.getSiteManager().getWebServerConfig();
        if (webconfig == null) {
            webconfig = Maps.newHashMap();
        }
        CmsSitesWebserverThread thread = new CmsSitesWebserverThread(
            A_CmsUI.getCmsObject(),
            webconfig.get(CmsSiteManagerImpl.WEB_SERVER_CONFIG_TARGETPATH),
            webconfig.get(CmsSiteManagerImpl.WEB_SERVER_CONFIG_CONFIGTEMPLATE),
            webconfig.get(CmsSiteManagerImpl.WEB_SERVER_CONFIG_WEBSERVERSCRIPT),
            webconfig.get(CmsSiteManagerImpl.WEB_SERVER_CONFIG_FILENAMEPREFIX),
            webconfig.get(CmsSiteManagerImpl.WEB_SERVER_CONFIG_LOGGINGDIR),
            webconfig.get(CmsSiteManagerImpl.WEB_SERVER_CONFIG_SECURETEMPLATE));
        thread.start();

        CmsReportWidget report = new CmsReportWidget(thread);
        m_threadReport.addComponent(report);
    }
947575
public static void runScript(Database database, String logFilename,
                                 int logType) {

        IntKeyHashMap sessionMap = new IntKeyHashMap();
        Session       current    = null;
        int           currentId  = 0;

        database.setReferentialIntegrity(false);

        ScriptReaderBase scr = null;
        String           statement;
        int              statementType;

        try {
            StopWatch sw = new StopWatch();

            scr = ScriptReaderBase.newScriptReader(database, logFilename,
                                                   logType);

            while (scr.readLoggedStatement(current)) {
                int sessionId = scr.getSessionNumber();

                if (current == null || currentId != sessionId) {
                    currentId = sessionId;
                    current   = (Session) sessionMap.get(currentId);

                    if (current == null) {
                        current =
                            database.getSessionManager().newSession(database,
                                database.getUserManager().getSysUser(), false,
                                true, 0);

                        sessionMap.put(currentId, current);
                    }
                }

                if (current.isClosed()) {
                    sessionMap.remove(currentId);

                    continue;
                }

                Result result = null;

                statementType = scr.getStatementType();

                switch (statementType) {

                    case ScriptReaderBase.ANY_STATEMENT :
                        statement = scr.getLoggedStatement();
                        result    = current.executeDirectStatement(statement);

                        if (result != null && result.isError()) {
                            if (result.getException() != null) {
                                throw result.getException();
                            }

                            throw Error.error(result);
                        }
                        break;

                    case ScriptReaderBase.SEQUENCE_STATEMENT :
                        scr.getCurrentSequence().reset(scr.getSequenceValue());
                        break;

                    case ScriptReaderBase.COMMIT_STATEMENT :
                        current.commit(false);
                        break;

                    case ScriptReaderBase.INSERT_STATEMENT : {
                        current.beginAction(null);

                        Object[] data = scr.getData();

                        scr.getCurrentTable().insertNoCheckFromLog(current,
                                data);
                        current.endAction(Result.updateOneResult);

                        break;
                    }
                    case ScriptReaderBase.DELETE_STATEMENT : {
                        current.beginAction(null);

                        Object[] data = scr.getData();

                        scr.getCurrentTable().deleteNoCheckFromLog(current,
                                data);
                        current.endAction(Result.updateOneResult);

                        break;
                    }
                    case ScriptReaderBase.SET_SCHEMA_STATEMENT : {
                        current.setSchema(scr.getCurrentSchema());
                    }
                }

                if (current.isClosed()) {
                    sessionMap.remove(currentId);
                }
            }
        } catch (Throwable e) {
            String message;

            // catch out-of-memory errors and terminate
            if (e instanceof EOFException) {

                // end of file - normal end
            } else if (e instanceof OutOfMemoryError) {
                message = "out of memory processing " + logFilename
                          + " line: " + scr.getLineNumber();

                database.logger.appLog.logContext(SimpleLog.LOG_ERROR,
                                                  message);

                throw Error.error(ErrorCode.OUT_OF_MEMORY);
            } else {

                // stop processing on bad log line
                message = logFilename + " line: " + scr.getLineNumber() + " "
                          + e.toString();

                database.logger.appLog.logContext(SimpleLog.LOG_ERROR,
                                                  message);
            }
        } finally {
            if (scr != null) {
                scr.close();
            }

            database.getSessionManager().closeAllSessions();
            database.setReferentialIntegrity(true);
        }
    }
2020
function execute () {
    // check access and set access params
    this.accessControl()
    // build select
    this.select = sql.select(this.model, this.args)
    // debug
    debug(this.select.sql, this.select.params)
    // do query
    defined(this.model.cache)
        && this.args.cache !== false
        && (!this.modelViewEngine || this.modelViewEngine.cache !== false)
        ? this.executeQueryCached()
        : this.executeQueryDirect()
    // add queries for related records if any
    this.executeRelated()
    // build result
    return this.result()
}
313127
public function execute()
	{
		$this->connect();

		// 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 = $this->limit($sql, $this->limit, $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 = '';

		$options = array();

		// SQLSrv_num_rows requires a static or keyset cursor.
		if (strncmp(strtoupper(ltrim($sql)), 'SELECT', \strlen('SELECT')) === 0)
		{
			$options = array('Scrollable' => SQLSRV_CURSOR_KEYSET);
		}

		$params = array();

		// Bind the variables:
		if ($this->sql instanceof PreparableInterface)
		{
			$bounded =& $this->sql->getBounded();

			if (\count($bounded))
			{
				foreach ($bounded as $key => $obj)
				{
					// And add the value as an additional param
					$params[] = $obj->value;
				}
			}
		}

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

		// 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 (ConnectionFailureException $e)
				{
					// If connect fails, ignore that exception and throw the normal exception.
					$errors         = sqlsrv_errors();
					$this->errorNum = $errors[0]['code'];
					$this->errorMsg = $errors[0]['message'];

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

					throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
				}

				// Since we were able to reconnect, run the query again.
				return $this->execute();
			}

			// The server was not disconnected.
			$errors         = sqlsrv_errors();
			$this->errorNum = $errors[0]['code'];
			$this->errorMsg = $errors[0]['message'];

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

			throw new ExecutionFailureException($sql, $this->errorMsg, $this->errorNum);
		}

		return $this->cursor;
	}
820171
def execute(*args, **kwargs):
        

        # Inspect the call stack for the originating call
        args = CoyoteDb.__add_query_comment(args[0])
        db = CoyoteDb.__get_db_write_instance(target_database=kwargs.pop('target_database', None))
        filtered_kwargs = {k: v for k, v in kwargs.iteritems() if k != 'target_database'}

        # Execute the query
        cursor = db.cursor()
        try:
            cursor.execute(*args, **filtered_kwargs)
        except OperationalError, e:
            raise OperationalError('{} when executing: {}'.format(e.args, args[0]))
        return db, cursor
581854
final function execute() {
		//parse content first, to allow for any ADDTEMPLATE items
		$content = $this->parseContent($this->data['bodycontent']);

		if( !$this->getLayoutClass()	){
			throw new \Exception('No layout class defined.');
		}
		$layoutClass = $this->getLayoutClass();
		$layout = new $layoutClass($this->getSkin(), $this);
		//set up standard content zones
		//head element (including opening body tag)
		$layout->addHTMLTo('head', $this->html('headelement') );
		//the logo image defined in LocalSettings
		$layout->addHTMLTo('logo', $this->data['logopath']);
		$layout->addHTMLTo('prepend:body', $this->html( 'prebodyhtml' ));
		//the article title
		if($this->showTitle){
			$layout->addHTMLTo('content-container.class', 'has-title');
			$layout->addHTMLTo('title-html', $this->data['title']);
		}
		//article content
		$layout->addHTMLTo('content-html', $content);
		//the site notice
		if( !empty($this->data['sitenotice'])){
			$layout->addHTMLTo('site-notice', $this->data['sitenotice']);
		}
		//the site tagline, if there is one
		if($this->showTagline){
			$layout->addHTMLTo('content-container.class', 'has-tagline');
			$layout->addHTMLTo('tagline', $this->getMsg('tagline') );
		}
		$breadcrumbTrees = $this->breadcrumbs();
		$layout->addTemplateTo('breadcrumbs', 'breadcrumbs', array('trees' => $breadcrumbTrees) );

		// if(\Skinny::hasContent('toc')){
		// 	$layout->addHTMLTo('toc', (\Skinny::getContent('toc')[0]['html']));
		// }

		// if ( $this->data['dataAfterContent'] ) {
		// 	$layout->addHTMLTo('append:content', $this->data['dataAfterContent']);
		// }
		//the contents of Mediawiki:Sidebar
		// $layout->addTemplate('classic-sidebar', 'classic-sidebar', array(
		// 	'sections'=>$this->data['sidebar']
		// ));
		// //list of language variants
		// $layout->addTemplate('language-variants', 'language-variants', array(
		// 	'variants'=>$this->data['language_urls']
		// ));

		//page footer
		$layout->addHookTo('footer-links', array($this,'getFooterLinks'));
		$layout->addHookTo('footer-icons', array($this,'getFooterIcons'));
		//mediawiki needs this to inject script tags after the footer
		$layout->addHookTo('append:body', array($this,'afterFooter'));


		$this->data['pageLanguage'] = $this->getSkin()->getTitle()->getPageViewLanguage()->getCode();

		//allow skins to set up before render
		$this->initialize();

		echo $layout->render();
		// $this->printTrail();
	}
329713
public function execute()
    {
        $this->query("ALTER TABLE `{{NAILS_DB_PREFIX}}blog_post` ADD `commentsEnabled` TINYINT(1)  UNSIGNED  NOT NULL  DEFAULT '1'  AFTER `seo_keywords`;");
        $this->query("ALTER TABLE `{{NAILS_DB_PREFIX}}blog_post` ADD `commentsExpire` DATETIME  NULL  AFTER `commentsEnabled`;");
        $this->query("ALTER TABLE `{{NAILS_DB_PREFIX}}blog_post` ADD `type` ENUM('TEXT','AUDIO','VIDEO','PHOTO')  NOT NULL  DEFAULT 'PHOTO'  AFTER `slug`;");
        $this->query("ALTER TABLE `{{NAILS_DB_PREFIX}}blog_post` ADD `video_url` VARCHAR(255)  NULL  DEFAULT NULL  AFTER `image_id`;");
        $this->query("ALTER TABLE `{{NAILS_DB_PREFIX}}blog_post` ADD `audio_url` VARCHAR(255)  NULL  DEFAULT NULL  AFTER `video_url`;");
        $this->query("UPDATE `{{NAILS_DB_PREFIX}}blog_post` SET type = 'TEXT' WHERE image_id IS NULL;");
    }
897692
def run_script(pycode):
    """"""
    # Fix up the whitespace in pycode.
    if pycode[0] == "\n":
        pycode = pycode[1:]
    pycode.rstrip()
    pycode = textwrap.dedent(pycode)

    # execute it.
    globs = {}
    six.exec_(pycode, globs, globs)  # pylint: disable=W0122

    return globs
791485
def _executing(self, sql, params=[]):
        
        with self.connection() as connection:
            for row in connection.execute(sql, params):
                yield row
                if not self._db:
                    return
1022107
def db_exec(self, query, args=None):
        
        if args is None:
            self.db_query(query)
        else:
            self.db_query(query, args)

        self.db.commit()
255113
public void execute() throws ActivityException {

        try {
            String language = getLanguage();
            String script = getScript();
            Object retObj = executeScript(script, language, null, null);

            if (retObj != null)
                setReturnCode(retObj.toString());
        }
        catch (ActivityException ex) {
            throw ex;
        }
        catch (Exception ex) {
            logger.severeException(ex.getMessage(), ex);
            throw new ActivityException(-1, ex.getMessage(), ex);
        }
    }
1193135
def _execute(self, *args):
        
        cursor = self.db.cursor()
        cursor.execute(*args)
        return cursor
1158538
def executescript(self, *args, **kwargs):
        

        with self:
            self._cursor.executescript(*args, **kwargs)
345656
@Override
	public void execute(SQLiteDatabase database, int previuosVersion, int currentVersion) {
		List<String> executionList=null;
	
		if (inputStream==null) {
			File f = new File(schemaDefinitionFile);
			executionList = SQLiteUpdateTaskHelper.readSQLFromFile(schemaDefinitionFile);
			Logger.info("Load DDL from " + f.getAbsolutePath());
		} else {
			executionList = SQLiteUpdateTaskHelper.readSQLFromFile(inputStream);
			Logger.info("Load DDL from stream");
		}
		
		for (String item : executionList) {
			Logger.info(item);
			database.execSQL(item);
		}

	}