framework/db/cubrid/Schema.php
private function loadTableConstraints($tableName, $returnType)
    {
        $constraints = $this->db->getSlavePdo()->cubrid_schema(\PDO::CUBRID_SCH_CONSTRAINT, $tableName);
        $constraints = ArrayHelper::index($constraints, null, ['TYPE', 'NAME']);
        ArrayHelper::multisort($constraints, 'KEY_ORDER', SORT_ASC, SORT_NUMERIC);
        $result = [
            'indexes' => [],
            'uniques' => [],
        ];
        foreach ($constraints as $type => $names) {
            foreach ($names as $name => $constraint) {
                $isUnique = in_array((int) $type, [0, 2], true);
                $result['indexes'][] = new IndexConstraint([
                    'isPrimary' => (bool) $constraint[0]['PRIMARY_KEY'],
                    'isUnique' => $isUnique,
                    'name' => $name,
                    'columnNames' => ArrayHelper::getColumn($constraint, 'ATTR_NAME'),
                ]);
                if ($isUnique) {
                    $result['uniques'][] = new Constraint([
                        'name' => $name,
                        'columnNames' => ArrayHelper::getColumn($constraint, 'ATTR_NAME'),
                    ]);
                }
            }
        }
        foreach ($result as $type => $data) {
            $this->setTableMetadata($tableName, $type, $data);
        }

        return $result[$returnType];
    }
private function loadTableConstraints($tableName, $returnType)
    {
        $constraints = $this->db->getSlavePdo()->cubrid_schema(\PDO::CUBRID_SCH_CONSTRAINT, $tableName);
        $constraints = ArrayHelper::index($constraints, null, ['TYPE', 'NAME']);
        ArrayHelper::multisort($constraints, 'KEY_ORDER', SORT_ASC, SORT_NUMERIC);
        $result = [
            'indexes' => [],
            'uniques' => [],
        ];
        foreach ($constraints as $type => $names) {
            foreach ($names as $name => $constraint) {
                $isUnique = in_array((int) $type, [0, 2], true);
                $result['indexes'][] = new IndexConstraint([
                    'isPrimary' => (bool) $constraint[0]['PRIMARY_KEY'],
                    'isUnique' => $isUnique,
                    'name' => $name,
                    'columnNames' => ArrayHelper::getColumn($constraint, 'ATTR_NAME'),
                ]);
                if ($isUnique) {
                    $result['uniques'][] = new Constraint([
                        'name' => $name,
                        'columnNames' => ArrayHelper::getColumn($constraint, 'ATTR_NAME'),
                    ]);
                }
            }
        }
        foreach ($result as $type => $data) {
            $this->setTableMetadata($tableName, $type, $data);
        }

        return $result[$returnType];
    }
Loads multiple types of constraints and returns the specified ones.
@param string $tableName table name.
@param string $returnType return type:
- indexes
- uniques
@return mixed constraints.