Creates the prepared statement for insterting URLs into database (if not done yet)

@param bool $recreate If TRUE, the prepared statement will get (re)created nevertheless
773356
protected function createPreparedInsertStatement($recreate = false)
  {
    if ($this->PreparedInsertStatement == null || $recreate == true)
    {
      // Prepared statement for URL-inserts
      $this->PreparedInsertStatement = $this->PDO->prepare("INSERT OR IGNORE INTO urls (priority_level, distinct_hash, link_raw, linkcode, linktext, refering_url, url_rebuild, is_redirect_url, url_link_depth)
                                                            VALUES(:priority_level,
                                                                   :distinct_hash,
                                                                   :link_raw,
                                                                   :linkcode,
                                                                   :linktext,
                                                                   :refering_url,
                                                                   :url_rebuild,
                                                                   :is_redirect_url,
                                                                   :url_link_depth);");
    }
  }
345927
public function prepare($sql)
    {
        $this->_connect();
        if ($this->_stmt) {
            $this->_stmt->close();
        }
        $stmtClass = $this->_defaultStmtClass;
        if (!class_exists($stmtClass)) {
            // require_once 'Zend/Loader.php';
            Zend_Loader::loadClass($stmtClass);
        }
        $stmt = new $stmtClass($this, $sql);
        if ($stmt === false) {
            return false;
        }
        $stmt->setFetchMode($this->_fetchMode);
        $this->_stmt = $stmt;
        return $stmt;
    }
439300
public function create_database($database) {
		$query = 'CREATE DATABASE ' . $this->quote_identifier($database);
		$statement = $this->get_statement($query);

		$statement->execute();
	}
567786
public function applyEditSettings($create = false)
    {
        $this->applyDetailSettings();
        $this->copyKeys(); // The user can edit the keys.

        $translated = $this->util->getTranslated();
        $ucfirst    = new \Zend_Filter_Callback('ucfirst');

        if ($create && ($this->hashSsn !== self::SSN_HIDE)) {
            $onblur = new \MUtil_Html_JavascriptArrayAttribute('onblur');
            $onblur->addSubmitOnChange('this.value');

            $this->set('grs_ssn',
                    'onblur', $onblur->render($this->view),  // Render needed as element does not know HtmlInterface
                    'validator[]', $this->createUniqueValidator('grs_ssn')
                    );
        }

        $this->set('gr2o_id_organization', 'default', $this->currentUser->getCurrentOrganizationId());
        $this->setIfExists('gr2o_patient_nr',
                'size', 15,
                'minlength', 4,
                'validators[unique]', $this->createUniqueValidator(
                        array('gr2o_patient_nr', 'gr2o_id_organization'),
                        array('gr2o_id_user' => 'grs_id_user', 'gr2o_id_organization')
                        ),
                'validators[regex]', new Zend_Validate_Regex('/^[^\/\\%&]*$/'), // Between start and end no \/%& allowed
                'validators[csvinj]', 'NoCsvInjectionChars'
                );
        $this->set('grs_id_user');

        $this->set('gr2o_email',
                'required', true,
                'autoInsertNotEmptyValidator', false, // Make sure it works ok with next
                'size', 30,
                'validator', 'SimpleEmail');
        $this->addColumn('CASE WHEN gr2o_email IS NULL OR LENGTH(TRIM(gr2o_email)) = 0 THEN 1 ELSE 0 END', 'calc_email');
        $this->set('calc_email',
                'label', $this->_('Respondent has no e-mail'),
                'elementClass', 'Checkbox',
                'required', true,
                'order', $this->getOrder('gr2o_email') + 1,
                'validator', new \Gems_Validate_OneOf(
                        $this->_('Respondent has no e-mail'),
                        'gr2o_email',
                        $this->get('gr2o_email', 'label')
                        )
                );
        $this->set('gr2o_mailable',
                'label', $this->_('May be mailed'),
                'elementClass', 'radio',
                'multiOptions', $translated->getYesNo(),
                'separator', ' '
                );

        $this->setIfExists('grs_first_name', 'filter', $ucfirst,
                'validators[csvinj]', 'NoCsvInjectionChars'
                );
        $this->setIfExists('grs_surname_prefix',
                'validators[csvinj]', 'NoCsvInjectionChars'
                );
        $this->setIfExists('grs_last_name',  'filter', $ucfirst,
                'required', true,
                'validators[csvinj]', 'NoCsvInjectionChars'
                );
        $this->setIfExists('grs_partner_surname_prefix',
                'validators[csvinj]', 'NoCsvInjectionChars'
                );
        $this->setIfExists('grs_partner_last_name',  'filter', new \Zend_Filter_Callback('ucfirst'),
                'validators[csvinj]', 'NoCsvInjectionChars'
                );

        $this->setIfExists('grs_gender',
                'elementClass', 'Radio',
                'separator', '',
                'multiOptions', $translated->getGenders(),
                'tab', $this->_('Medical data')
                );

        $this->setIfExists('grs_birthday',
                'jQueryParams', array('defaultDate' => '-30y', 'maxDate' => 0, 'yearRange' => 'c-130:c0'),
                'elementClass', 'Date',
                'validator', new \MUtil_Validate_Date_DateBefore()
                );

        $this->setIfExists('gr2o_treatment', 'size', 30);
        $this->setIfExists('gr2o_comments',  'elementClass', 'Textarea', 'rows', 4, 'cols', 60);

        $this->setIfExists('grs_address_1',
                'size',  40,
                'description', $this->_('With housenumber'),
                'filter', $ucfirst
                );
        $this->setIfExists('grs_address_2', 'size', 40);
        $this->setIfExists('grs_city', 'filter', $ucfirst);
        $this->setIfExists('grs_phone_1', 'size', 15);
        $this->setIfExists('grs_phone_2', 'size', 15);
        $this->setIfExists('grs_phone_3', 'size', 15);
        $this->setIfExists('grs_phone_4', 'size', 15);

        $this->setIfExists('gr2o_consent',
                'default', $this->util->getDefaultConsent(),
                'elementClass', 'Radio',
                'separator', ' ',
                'required', true);

        $this->setMulti(array('name', 'row_class', 'resp_deleted'), 'elementClass', 'None');
        $this->setMulti($this->getItemsFor('table', 'gems__reception_codes'), 'elementClass', 'None');

        if ($create) {
            $this->setIfExists('gr2o_changed',    'elementClass', 'None');
            $this->setIfExists('gr2o_changed_by', 'elementClass', 'None');
            $this->setIfExists('gr2o_created',    'elementClass', 'None');
            $this->setIfExists('gr2o_created_by', 'elementClass', 'None');
        } else {
            $this->setIfExists('gr2o_changed',    'elementClass', 'Exhibitor');
            $this->setIfExists('gr2o_changed_by', 'elementClass', 'Exhibitor');
            $this->setIfExists('gr2o_created',    'elementClass', 'Exhibitor');
            $this->setIfExists('gr2o_created_by', 'elementClass', 'Exhibitor');
        }

        return $this;
    }
1002490
protected function createMySQLDatabase()
    {
        $this->checkParameters();
        $this->url = $this->obtainAPIURLEndpoint();
        try {
            $this->http->post($this->url, [
                    'form_params' => $data = $this->getData(),
                    'headers' => [
                        'X-Requested-With' => 'XMLHttpRequest',
                        'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCESS_TOKEN')
                    ]
                ]
            );
            if ($this->option('wait')) {
                $this->info('Waiting for database to be installed in Laravel Forge server...');
                $this->waitForMySQLDatabaseByName($data['name']);
                $this->info('Installed!');
            }
        } catch (\GuzzleHttp\Exception\ServerException $se) {
            if (str_contains($se->getResponse()->getBody()->getContents(), 'The given data failed to pass validation')) {
                $this->error('Skipping installation. Some of the data you provided already exists in server');
            }
        } catch (\Exception $e) {
            dump($e->getMessage());
        }
    }
131649
public function prepare($bindings= array (), $byValue= true, $cacheFlag= null) {
        $this->stmt= null;
        if ($this->construct() && $this->stmt= $this->xpdo->prepare($this->sql)) {
            $this->bind($bindings, $byValue, $cacheFlag);
        } else {
            $this->xpdo->log(xPDO::LOG_LEVEL_ERROR, 'Could not construct or prepare query because it is invalid or could not connect: ' . $this->sql);
        }
        return $this->stmt;
    }
668139
public function prepareSource(&$source = null, $reference = false)
    {
        if (is_null($source)) {
            $raw = static::loadRawFromRequest();

            $this->data = json_decode($raw, true);

            if (!is_array($this->data)) {
                $this->data = [];
            }
        } else {
            if ($reference) {
                $this->data = &$source;
            } else {
                $this->data = $source;
            }
        }
    }
917571
public function postCreate()
    {

        // Check if we should store creations in our revision history
        // Set this value to true in your model if you want to
        if(empty($this->revisionCreationsEnabled))
        {
            // We should not store creations.
            return false;
        }

        if ((!isset($this->revisionEnabled) || $this->revisionEnabled))
        {
            $revisions[] = array(
                'revisionable_type' => $this->getMorphClass(),
                'revisionable_id' => $this->getKey(),
                'key' => self::CREATED_AT,
                'old_value' => null,
                'new_value' => $this->{self::CREATED_AT},
                'user_id' => $this->getSystemUserId(),
                'created_at' => new \DateTime(),
                'updated_at' => new \DateTime(),
            );

            $revision = static::newModel();
            \DB::table($revision->getTable())->insert($revisions);
        }
    }
942381
public function compileDbTableStructureDump($create = false)
	{
		$fields = $this->entity->getScalarFields();
		$connection = $this->entity->getConnection();

		$autocomplete = array();

		foreach ($fields as $field)
		{
			if ($field->isAutocomplete())
			{
				$autocomplete[] = $field->getName();
			}
		}

		if($create === false){
			// start collecting queries
			$connection->disableQueryExecuting();
		}

		// create table
		$this->createTableMysql($this->entity->getDBTableName(), $fields, $this->entity->getPrimaryArray(), $autocomplete);
		$dump = $connection->getDisabledQueryExecutingDump();
		if($create === false){
			// stop collecting queries
			$connection->enableQueryExecuting();
		}

		return $dump;
	}
191954
protected function prepareNewSite(
        Site $newSite,
        array $defaultSiteSettings,
        string $createdByUserId,
        string $createdReason
    ) {
        $siteId = $newSite->getSiteId();
        if (!empty($siteId)) {
            throw new \Exception(
                "Site ID must be empty to create new site, id {$siteId} given."
            );
        }

        if (empty($newSite->getDomain())) {
            throw new \Exception('Domain is required to create new site.');
        }

        return $this->prepareDefaultValues(
            $newSite,
            $defaultSiteSettings,
            $createdByUserId,
            $createdReason
        );
    }
229394
public function executePrepared($prepare)
    {
        $execute = $prepare->execute();

        if (!$execute) {
            $errorInfo = $prepare->errorInfo();

            throw new Exception(
                'Cannot execute prepared statement: ' . end($errorInfo) . ' : ' . $prepare->queryString
            );
        }

        return $execute;
    }
635841
public function applyEditSettings($create = false)
    {
        parent::applyEditSettings($create);

        $translator = $this->getTranslateAdapter();

        if ($this->hashSsn !== parent::SSN_HIDE) {
            self::setDutchSsn($this, $translator);
        }

        $this->setIfExists('grs_iso_lang', 'default', 'nl');
        $this->setIfExists('gr2o_treatment', 'description', $this->_('DBC\'s, etc...'));

        self::setDutchZipcode($this, $translator);

        return $this;
    }
691657
def execute_prepared(self, prepared_statement, multi_row_parameters):
        
        self._check_closed()

        # Convert parameters into a generator producing lists with parameters as named tuples (incl. some meta data):
        parameters = prepared_statement.prepare_parameters(multi_row_parameters)

        while parameters:
            request = RequestMessage.new(
                self.connection,
                RequestSegment(
                    message_types.EXECUTE,
                    (StatementId(prepared_statement.statement_id),
                     Parameters(parameters))
                )
            )
            reply = self.connection.send_request(request)

            parts = reply.segments[0].parts
            function_code = reply.segments[0].function_code
            if function_code == function_codes.SELECT:
                self._handle_select(parts, prepared_statement.result_metadata_part)
            elif function_code in function_codes.DML:
                self._handle_upsert(parts, request.segments[0].parts[1].unwritten_lobs)
            elif function_code == function_codes.DDL:
                # No additional handling is required
                pass
            elif function_code in (function_codes.DBPROCEDURECALL, function_codes.DBPROCEDURECALLWITHRESULT):
                self._handle_dbproc_call(parts, prepared_statement._params_metadata) # resultset metadata set in prepare
            else:
                raise InterfaceError("Invalid or unsupported function code received: %d" % function_code)
157079
protected function prepareAttributes()
    {

        // load the store ID to use
        $storeId = $this->getRowStoreId();

        // initialize the values
        $entityId = $this->getSubject()->getLastEntityId();
        $requestPath = $this->prepareRequestPath();
        $targetPath = $this->prepareTargetPath();

        // return the prepared URL rewrite
        return $this->initializeEntity(
            array(
                MemberNames::ENTITY_TYPE      => UrlRewriteObserver::ENTITY_TYPE,
                MemberNames::ENTITY_ID        => $entityId,
                MemberNames::REQUEST_PATH     => $requestPath,
                MemberNames::TARGET_PATH      => $targetPath,
                MemberNames::REDIRECT_TYPE    => 0,
                MemberNames::STORE_ID         => $storeId,
                MemberNames::DESCRIPTION      => null,
                MemberNames::IS_AUTOGENERATED => 1,
                MemberNames::METADATA         => null
            )
        );
    }
691770
protected function prepareUrlRewrites()
    {

        // (re-)initialize the array for the existing URL rewrites
        $this->existingUrlRewrites = array();

        // prepare the new URL rewrites first
        parent::prepareUrlRewrites();

        // load the store ID to use
        $storeId = $this->getSubject()->getRowStoreId();

        // load the existing URL rewrites of the actual entity
        $existingUrlRewrites = $this->getUrlRewritesByEntityTypeAndEntityIdAndStoreId(
            UrlRewriteObserver::ENTITY_TYPE,
            $this->entityId,
            $storeId
        );

        // prepare the existing URL rewrites to improve searching them by request path
        foreach ($existingUrlRewrites as $existingUrlRewrite) {
            $this->existingUrlRewrites[$existingUrlRewrite[MemberNames::REQUEST_PATH]] = $existingUrlRewrite;
        }
    }
277916
protected function _prepare($sql)
    {
        try {
            $this->_stmt = $this->_adapter->getConnection()->prepare($sql);
        } catch (PDOException $e) {
            // require_once 'Zend/Db/Statement/Exception.php';
            throw new Zend_Db_Statement_Exception($e->getMessage(), $e->getCode(), $e);
        }
    }
895324
protected function reload(array $get = [], bool $merge = false): void
    {
        $path = parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);

        // Query
        {
            $query = [];

            if ($merge) {
                parse_str(parse_url($_SERVER["REQUEST_URI"], PHP_URL_QUERY), $query);
            }

            $query = array_merge($query, $get);
            $queryString = http_build_query($query);
        }

        $this->redirect($path . (!empty($queryString) ? '?' . $queryString : ''));
    }