Postgres::getAttributeNames PHP Метод

getAttributeNames() публичный Метод

Given an array of attnums and a relation, returns an array mapping attribute number to attribute name.
public getAttributeNames ( $table, $atts ) : -2
$table The table to get attributes for
$atts An array of attribute numbers
Результат -2 array mapping attnum to attname
    function getAttributeNames($table, $atts)
    {
        $c_schema = $this->_schema;
        $this->clean($c_schema);
        $this->clean($table);
        $this->arrayClean($atts);
        if (!is_array($atts)) {
            return -1;
        }
        if (sizeof($atts) == 0) {
            return array();
        }
        $sql = "SELECT attnum, attname FROM pg_catalog.pg_attribute WHERE\n\t\t\tattrelid=(SELECT oid FROM pg_catalog.pg_class WHERE relname='{$table}' AND\n\t\t\trelnamespace=(SELECT oid FROM pg_catalog.pg_namespace WHERE nspname='{$c_schema}'))\n\t\t\tAND attnum IN ('" . join("','", $atts) . "')";
        $rs = $this->selectSet($sql);
        if ($rs->recordCount() != sizeof($atts)) {
            return -2;
        } else {
            $temp = array();
            while (!$rs->EOF) {
                $temp[$rs->fields['attnum']] = $rs->fields['attname'];
                $rs->moveNext();
            }
            return $temp;
        }
    }
Postgres