Get the status keys for active agenda items as a quoted db query string for use in "x IN (?)"

@return \Zend_Db_Expr
497697
public function getStatusKeysActiveDbQuoted()
    {
        $codes = array();
        foreach ($this->getStatusKeysActive() as $key) {
            $codes[] = $this->db->quote($key);
        }
        return new \Zend_Db_Expr(implode(", ", $codes));
    }
787494
public function getStatusText()
    {
        $statusCode = $this->getStatusCode();

        if (!isset($this->defaultStatusTextList[$statusCode])) {
            return '';
        }

        return $this->defaultStatusTextList[$statusCode];
    }
654066
public function GetQueryRestrictionForActiveFilter()
    {
        $sQuery = '';
        $dStartValue = $this->GetActiveStartValue();
        $dEndValue = $this->GetActiveEndValue();
        if ($dStartValue > 0 && $dEndValue > 0) {
            $sQuery = "`shop_article`.`{$this->sItemFieldName}` >= '".MySqlLegacySupport::getInstance()->real_escape_string(
                $dStartValue
            )."' AND `shop_article`.`{$this->sItemFieldName}` <= '".MySqlLegacySupport::getInstance()->real_escape_string($dEndValue)."'";
        } elseif ($dStartValue > 0) {
            $sQuery = "`shop_article`.`{$this->sItemFieldName}` >= '".MySqlLegacySupport::getInstance()->real_escape_string($dStartValue)."'";
        } elseif ($dEndValue > 0) {
            $sQuery = "`shop_article`.`{$this->sItemFieldName}` <= '".MySqlLegacySupport::getInstance()->real_escape_string($dEndValue)."'";
        }

        return $sQuery;
    }
1311546
public function getStatuses()
    {
        $statuses = &gplcart_static('order.statuses');

        if (isset($statuses)) {
            return $statuses;
        }

        $statuses = array(
            'pending' => $this->translation->text('Pending'),
            'canceled' => $this->translation->text('Canceled'),
            'delivered' => $this->translation->text('Delivered'),
            'completed' => $this->translation->text('Completed'),
            'processing' => $this->translation->text('Processing'),
            'dispatched' => $this->translation->text('Dispatched'),
            'pending_payment' => $this->translation->text('Awaiting payment')
        );

        $this->hook->attach('order.statuses', $statuses, $this);
        return $statuses;
    }
550209
public function GetQueryRestrictionForActiveFilter()
    {
        $sQuery = $this->GetFromInternalCache('sQueryRestrictionForActiveFilter');
        if (is_null($sQuery)) {
            $aValues = $this->aActiveFilterData;
            if (is_array($aValues) && count($aValues) > 0) {
                $aValues = TTools::MysqlRealEscapeArray($aValues);
                $sItemListQuery = 'SELECT * FROM `'.MySqlLegacySupport::getInstance()->real_escape_string($this->sItemTableName).'` WHERE '.$this->GetTargetTableNameField()." IN ('".implode("','", $aValues)."')";
                $tRes = MySqlLegacySupport::getInstance()->query($sItemListQuery);
                $aIdList = array();
                while ($aItemRow = MySqlLegacySupport::getInstance()->fetch_assoc($tRes)) {
                    $aIdList[] = MySqlLegacySupport::getInstance()->real_escape_string($aItemRow['id']);
                }

                if (count($aIdList) > 0) {
                    $sQuery = '`shop_article`.`'.MySqlLegacySupport::getInstance()->real_escape_string($this->sItemFieldName)."` IN ('".implode("','", $aIdList)."')";
                }
            }
            $this->SetInternalCache('sQueryRestrictionForActiveFilter', $sQuery);
        }

        return $sQuery;
    }
125683
public function approvedWithPending(): ActiveQuery
    {
        return $this->andWhere([$this->statusAttribute => [Status::APPROVED, Status::PENDING]]);
    }
958185
public function getStatusString()
    {
        if (array_key_exists($this->status, TicketMessageInterface::STATUSES)) {
            return TicketMessageInterface::STATUSES[$this->status];
        }

        return TicketMessageInterface::STATUSES[0];
    }
60381
public function getIndexes()
    {
        $query = $this->db->getQuery(true);
        $table = $this->db->replacePrefix($this->name);

        $query->select([
            'tbl.name AS table_name',
            'col.name AS column_name',
            'idx.name AS index_name',
            'col.*',
            'idx.*'
        ])
            ->from('sys.columns AS col')
            ->leftJoin(
                'sys.tables AS tbl',
                'col.object_id = tbl.object_id'
            )
            ->leftJoin(
                'sys.index_columns AS ic',
                'col.column_id = ic.column_id AND ic.object_id = tbl.object_id'
            )
            ->leftJoin(
                'sys.indexes AS idx',
                'idx.object_id = tbl.object_id AND idx.index_id = ic.index_id'
            )
            ->where('tbl.name = %q', $table)

            ->where('(idx.name IS NOT NULL OR col.is_identity = 1 OR idx.is_primary_key = 1)');

        $indexes = $this->db->prepare($query)->loadAll();

        $keys = [];

        foreach ($indexes as $index) {
            $key = new \stdClass();

            $key->Table = $table;
            $key->Is_primary = $index->is_primary_key ?: $index->is_identity;
            $key->Non_unique = !$index->is_unique;
            $key->Key_name = $key->Is_primary ? 'PRIMARY' : $index->index_name;
            $key->Column_name = $index->column_name;
            $key->Collation = 'A';
            $key->Cardinality = 0;
            $key->Sub_part = null;
            $key->Packed = null;
            $key->Null = null;
            $key->Index_type = 'BTREE';
            // TODO: Finish comments query
            $key->Comment = null;
            $key->Index_comment = null;
            $key->is_identity = $index->is_identity ? 'auto_increment' : '';

            $keys[] = $key;
        }

        return $keys;
    }
143099
protected function _getQuery()
    {
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sArtId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $sSynchArtId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        $sAttrViewName = $this->_getViewName('oxattribute');
        $sO2AViewName = $this->_getViewName('oxobject2attribute');
        if ($sArtId) {
            // all categories article is in
            $sQAdd = " from {$sO2AViewName} left join {$sAttrViewName} " .
                     "on {$sAttrViewName}.oxid={$sO2AViewName}.oxattrid " .
                     " where {$sO2AViewName}.oxobjectid = " . $oDb->quote($sArtId) . " ";
        } else {
            $sQAdd = " from {$sAttrViewName} where {$sAttrViewName}.oxid not in ( select {$sO2AViewName}.oxattrid " .
                     "from {$sO2AViewName} left join {$sAttrViewName} " .
                     "on {$sAttrViewName}.oxid={$sO2AViewName}.oxattrid " .
                     " where {$sO2AViewName}.oxobjectid = " . $oDb->quote($sSynchArtId) . " ) ";
        }

        return $sQAdd;
    }
56800
public function getForDynamoDB()
    {
        $exists = $this->getExists();
        $value = $this->getValue();

        $condition = array();
        if (isset($exists)) {
           $condition['Exists'] = $exists;
        }
        if (isset($value)) {
            $condition['Value'] = $value->getForDynamoDB();
        }

        return $condition;
    }
1214459
public function getActiveFaqs()
    {
        $em = $this->getServiceManager()->get('playgroundfaq_doctrine_em');

        $query = $em->createQuery('SELECT f FROM PlaygroundFaq\Entity\Faq f WHERE f.isActive = true ORDER BY f.position ASC');
        $faqs = $query->getResult();

        return $faqs;
    }
759430
protected function getStatus()
    {
        if (!$this->getModuleSetting('status')) {
            return false;
        }

        if ($this->getModuleSetting('test')) {
            return $this->getModuleSetting('test_key') && $this->getModuleSetting('test_public_key');
        }

        return $this->getModuleSetting('live_key') && $this->getModuleSetting('live_public_key');
    }
199023
public function getIndexes()
    {
        $this->db->setQuery(
            '
SELECT
    t.relname AS table_name,
    i.relname AS index_name,
    a.attname AS column_name,
    ix.indisunique AS is_unique,
    ix.indisprimary AS is_primary
FROM pg_class AS t,
    pg_class AS i,
    pg_index AS ix,
    pg_attribute AS a
WHERE t.oid = ix.indrelid
    AND i.oid = ix.indexrelid
    AND a.attrelid = t.oid
    AND a.attnum = ANY(ix.indkey)
    AND t.relkind = \'r\'
    AND t.relname = ' . $this->db->quote($this->db->replacePrefix($this->getName())) . '
ORDER BY t.relname, i.relname;'
        );

        $keys = $this->db->loadAll();

        foreach ($keys as $key) {
            $key->Table = $this->getName();
            $key->Non_unique = !$key->is_unique;
            $key->Key_name = $key->index_name;
            $key->Column_name = $key->column_name;
            $key->Collation = 'A';
            $key->Cardinality = 0;
            $key->Sub_part = null;
            $key->Packed = null;
            $key->Null = null;
            $key->Index_type = 'BTREE';
            // TODO: Finish comments query
            $key->Comment = null;
            $key->Index_comment = null;
        }

        return $keys;
    }
343438
public function getNumberActiveModules(){
		if(HookProvider::getInstance()->isModuleOperational()){
			$sqlquery = '';
			$sqlparams = array($this->hook_function);
			if($this->hook_context != 'all') {
				$sqlparams = array($this->hook_function, $this->hook_context);
				$sqlquery = " OR majh_hook_context=?";
			}
			$module_names=Database::prepare(
					"SELECT majh_module_name AS modules FROM `##maj_hooks`".
					" WHERE majh_hook_function = ? AND (majh_hook_context='all'".$sqlquery.") AND majh_status='enabled'"
			)->execute($sqlparams)->fetchOneColumn();
			return count($module_names);
		}
		return 0;
	}
502600
public function getFieldNames()
    {
        if ( ! $this->isActive ) {
            throw new NonActiveException('You can only get the field names of the active template');
        }

        $ret = array();

        try {
            $result = $this->getSoapClient()->GetFieldNames();
        } catch ( SoapException $ex ) {
            throw new StatusException('Error while getting the list of all fields in the active template' , $ex);
        }

        if ( isset($result->GetFieldNamesResult->string) ) {
            if ( is_array($result->GetFieldNamesResult->string) ) {
                $ret = $result->GetFieldNamesResult->string;
            } else {
                $ret[] = $result->GetFieldNamesResult->string;
            }
        }

        return $ret;
    }
783065
private function getUpdateClause()
	{
		$placeholders = [];

		foreach ($this->values as $key => $value) {
			$placeholders[] = sprintf('%s = %s', $key, $value);
		}

		return sprintf('UPDATE %s SET %s', $this->table, implode(', ', $placeholders));
	}
378494
protected function _getQuery()
    {
        // active AJAX component
        $sGroupTable = $this->_getViewName('oxgroups');
        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $sDiscountId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('oxid');
        $sSynchDiscountId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        // category selected or not ?
        if (!$sDiscountId) {
            $sQAdd = " from $sGroupTable where 1 ";
        } else {
            $sQAdd = " from oxobject2group left join $sGroupTable on oxobject2group.oxgroupsid=$sGroupTable.oxid ";
            $sQAdd .= " where oxobject2group.oxobjectid = " . $oDb->quote($sDiscountId);
        }

        if ($sSynchDiscountId && $sSynchDiscountId != $sDiscountId) {
            $sQAdd .= ' and ' . $sGroupTable . '.oxid not in ( select ' . $sGroupTable . '.oxid from oxobject2group left join ' . $sGroupTable . ' on oxobject2group.oxgroupsid=' . $sGroupTable . '.oxid ';
            $sQAdd .= " where oxobject2group.oxobjectid = " . $oDb->quote($sSynchDiscountId) . " ) ";
        }

        return $sQAdd;
    }