Zend_Db_Expr example

return $basketRow;
        }

        if (!$esdProduct['serials']) {
            // No serial number is needed             $this->db->insert('s_order_esd', [
                'serialID' => 0,
                'esdID' => $esdProduct['id'],
                'userID' => $this->sUserData['additional']['user']['id'],
                'orderID' => $orderID,
                'orderdetailsID' => $orderDetailsID,
                'datum' => new Zend_Db_Expr('NOW()'),
            ]);

            return $basketRow;
        }

        $availableSerials = $this->getAvailableSerialsOfEsd($esdProduct['id']);

        if ((\count($availableSerials) <= $this->config->get('esdMinSerials')) || \count($availableSerials) <= $quantity) {
            // Not enough serial numbers anymore, inform merchant             $context = [
                'sArticleName' => $basketRow['articlename'],
                

    public function group($spec)
    {
        if (!is_array($spec)) {
            $spec = [$spec];
        }

        foreach ($spec as $val) {
            // Remove comments from SQL statement             $noComments = preg_replace(self::REGEX_SQL_COMMENTS, '$1', (string) $val);
            if (preg_match(self::REGEX_COLUMN_EXPR_GROUP, $noComments)) {
                $val = new Zend_Db_Expr($val);
            }
            $this->_parts[self::GROUP][] = $val;
        }

        return $this;
    }

    /** * Adds a HAVING condition to the query by AND. * * If a value is passed as the second param, it will be quoted * and replaced into the condition wherever a question-mark * appears. See {@link where()} for an example * * @param string $cond the HAVING condition * @param mixed $value OPTIONAL The value to quote into the condition * @param int $type OPTIONAL The type of the given value * * @return Zend_Db_Select this Zend_Db_Select object */

    protected function _authenticateCreateSelect()
    {
        // build credential expression         if (empty($this->_credentialTreatment) || (strpos($this->_credentialTreatment, '?') === false)) {
            $this->_credentialTreatment = '?';
        }

        $credentialExpression = new Zend_Db_Expr(
            '(CASE WHEN ' .
            $this->_zendDb->quoteInto(
                $this->_zendDb->quoteIdentifier($this->_credentialColumn, true)
                . ' = ' . $this->_credentialTreatment, $this->_credential
                )
            . ' THEN 1 ELSE 0 END) AS '
            . $this->_zendDb->quoteIdentifier(
                $this->_zendDb->foldCase('zend_auth_credential_match')
                )
            );

        
's2' => 's_core_snippets'],
            "s1.namespace = s2.namespace AND s1.name = s2.name AND s2.localeId = $localeId AND s2.shopId = $shopId"
        );

        $secondStmt->reset('columns');
        $secondStmt->columns([
            's2.id',
            's1.namespace',
            's1.name',
            's2.value',
            's1.value as defaultValue',
            new Zend_Db_Expr("$shopId as shopId"),
            new Zend_Db_Expr("$localeId as localeID"),
        ]);

        $secondStmt->where('s1.localeId = ?', 1);
        $secondStmt->where('s1.shopID = ?', 1);
        $secondStmt->where('s2.id IS NULL');

        $stmt = $this->database
            ->select()
            ->from(
                ['s' => 's_core_snippets'],
                [
Home | Imprint | This part of the site doesn't use cookies.