テーブルのカラムに紐づくインデックス名を更新します。

@param	string	テーブル名
@param	bool	強制再取得フラグ
@return	array	テーブルのインデックス。
@see ickx\fw2\io\rdbms\drivers\interfaces.IRdbmsDriver::getColumns()
555330
protected function _updateUniqueIndexNames ($table_name, $forced_obtain = false) {
		if (!isset(array_flip($this->getTables($forced_obtain))[$table_name])) {
			throw CoreException::RaiseSystemError('存在しないテーブルを指定されました。table_name:%s', [$table_name]);
		}
		if ($forced_obtain || !isset($this->_indexes[$table_name])) {
			$this->_updateIndexes($table_name);
		}

		$tmp_unique_index_names = [];
		foreach ($this->_indexes[$table_name] as $index_name => $rows) {
			if ($index_name == 'PRIMARY') {
				foreach ($rows as $row) {
					$tmp_unique_index_names[$row['column_name']][$index_name] = $index_name;
				}
				continue;
			}
			foreach ($rows as $row) {
				if (!$row['unique']) {
					continue;
				}
				$tmp_unique_index_names[$row['column_name']][$index_name] = $index_name;
			}
		}
		$this->_uniqueIndexNames[$table_name] = $tmp_unique_index_names;
	}
1161622
public function getColumnNames ($table_name, $forced_obtain = false) {
		if (!isset(array_flip($this->getTables($forced_obtain))[$table_name])) {
			throw CoreException::RaiseSystemError('存在しないテーブルを指定されました。table_name:%s', [$table_name]);
		}
		if ($forced_obtain || !isset($this->_columnNames[$table_name])) {
			$column_names = array_keys($this->getColumns($table_name, $forced_obtain));
			$this->_columnNames[$table_name] = array_combine($column_names, $column_names);
		}
		return $this->_columnNames[$table_name];
	}
982332
public function get($table_name, $byColumns) {		
        $all = $this->getAll($table_name, $byColumns);
        return array_shift($all);
    }
168072
private function get_columns() {
		$meta = $this->result_metadata();

		// FIXME: This is a check to be compatible with PHP versions > 5.3.6
		// Not having the database name in the key results in name collisions when using multiple databases
		if (version_compare(PHP_VERSION, '5.3.6') >= 0) {
			$database_in_key = true;
		} else {
			$database_in_key = false;
		}

		$columns = [];
		while ($column = $meta->fetch_field()) {
			if ($database_in_key === true) {
				$columns[] = $column->db . '.' . $column->table . '.' . $column->name;
			} else {
				$columns[] = $column->table . '.' . $column->name;
			}
		}
		return $columns;
	}
625088
protected function getSelectColumns() {
		//obtain attributes from config
		if ($this->hasOption('query.attrs')) {
			$columns = [];
			
			foreach ($this->getOption('query.attrs') as $attr) {
				if ($attr instanceof Attr)
					$name = $attr->getName();				
				elseif (is_string($attr))
					$name = $attr;
				else
					throw new \InvalidArgumentException("Method 'attrs' expects a list of strings or instances of \eMapper\Query\Attr");
				
				if (!$this->entityProfile->hasProperty($name))
					throw new \InvalidArgumentException(sprintf("Attribute '%s' not found in class '%s'", $name, $this->entityProfile->getReflectionClass()->getName()));
				
				$column = $this->entityProfile->getProperty($name)->getColumn();
				if (!array_key_exists($column, $columns))
					$columns[$column] = new Column($column);
			}
			
			return $columns;
		}
	
		return $this->selectColumns;
	}
766894
public function getNotNullColumns ($table_name, $forced_obtain = false) {
		if ($forced_obtain || !Arrays::KeyExists($this->_notNullColumns, $table_name)) {
			$this->_updateNotNullColumns($table_name);
		}
		return $this->_notNullColumns[$table_name];
	}
1118646
public function get_columns($table, $usecache=true) {

        if ($usecache) {
            if ($this->temptables->is_temptable($table)) {
                if ($data = $this->get_temp_tables_cache()->get($table)) {
                    return $data;
                }
            } else {
                if ($data = $this->get_metacache()->get($table)) {
                    return $data;
                }
            }
        }

        $structure = array();

        // get table's CREATE TABLE command (we'll need it for autoincrement fields)
        $sql = 'SELECT sql FROM sqlite_master WHERE type="table" AND tbl_name="'.$this->prefix.$table.'"';
        if ($this->debug) {
            $this->debug_query($sql);
        }
        $createsql = $this->pdb->query($sql)->fetch();
        if (!$createsql) {
            return false;
        }
        $createsql = $createsql['sql'];

        $sql = 'PRAGMA table_info("'. $this->prefix.$table.'")';
        if ($this->debug) {
            $this->debug_query($sql);
        }
        $rscolumns = $this->pdb->query($sql);
        foreach ($rscolumns as $row) {
            $columninfo = array(
                'name' => strtolower($row['name']), // colum names must be lowercase
                'not_null' =>(boolean)$row['notnull'],
                'primary_key' => (boolean)$row['pk'],
                'has_default' => !is_null($row['dflt_value']),
                'default_value' => $row['dflt_value'],
                'auto_increment' => false,
                'binary' => false,
                //'unsigned' => false,
            );
            $type = explode('(', $row['type']);
            $columninfo['type'] = strtolower($type[0]);
            if (count($type) > 1) {
                $size = explode(',', trim($type[1], ')'));
                $columninfo['max_length'] = $size[0];
                if (count($size) > 1) {
                    $columninfo['scale'] = $size[1];
                }
            }
            // SQLite does not have a fixed set of datatypes (ie. it accepts any string as
            // datatype in the CREATE TABLE command. We try to guess which type is used here
            switch(substr($columninfo['type'], 0, 3)) {
                case 'int': // int integer
                    if ($columninfo['primary_key'] && preg_match('/'.$columninfo['name'].'\W+integer\W+primary\W+key\W+autoincrement/im', $createsql)) {
                        $columninfo['meta_type'] = 'R';
                        $columninfo['auto_increment'] = true;
                    } else {
                        $columninfo['meta_type'] = 'I';
                    }
                    break;
                case 'num': // number numeric
                case 'rea': // real
                case 'dou': // double
                case 'flo': // float
                    $columninfo['meta_type'] = 'N';
                    break;
                case 'var': // varchar
                case 'cha': // char
                    $columninfo['meta_type'] = 'C';
                    break;
                case 'enu': // enums
                    $columninfo['meta_type'] = 'C';
                    break;
                case 'tex': // text
                case 'clo': // clob
                    $columninfo['meta_type'] = 'X';
                    break;
                case 'blo': // blob
                case 'non': // none
                    $columninfo['meta_type'] = 'B';
                    $columninfo['binary'] = true;
                    break;
                case 'boo': // boolean
                case 'bit': // bit
                case 'log': // logical
                    $columninfo['meta_type'] = 'L';
                    $columninfo['max_length'] = 1;
                    break;
                case 'tim': // timestamp
                    $columninfo['meta_type'] = 'T';
                    break;
                case 'dat': // date datetime
                    $columninfo['meta_type'] = 'D';
                    break;
            }
            if ($columninfo['has_default'] && ($columninfo['meta_type'] == 'X' || $columninfo['meta_type']== 'C')) {
                // trim extra quotes from text default values
                $columninfo['default_value'] = substr($columninfo['default_value'], 1, -1);
            }
            $structure[$columninfo['name']] = new database_column_info($columninfo);
        }

        if ($usecache) {
            if ($this->temptables->is_temptable($table)) {
                $this->get_temp_tables_cache()->set($table, $structure);
            } else {
                $this->get_metacache()->set($table, $structure);
            }
        }

        return $structure;
    }
857904
public static function GetColumnList ($forced_obtain = false, $options = []) {
		$options += $options + static::GetDefaultOptions();
		$column_list = array_keys(DBI::GetColumns($options, static::GetName(), $forced_obtain));
		return array_combine($column_list, $column_list);
	}
833438
protected function getFields()/*# : bool */
    {
        if (null === $this->cols) {
            $result = $this->statement->result_metadata();
            if (false === $result) {
                return false;
            }

            $this->cols = [];

            // set column name
            foreach ($result->fetch_fields() as $col) {
                $this->cols[] = $col->name;
            }
        }
        return true;
    }
659409
@Override
    public List<DColumn> getColumns(String storeName, String rowKey, String startColumn, String endColumn, int count) {
        DBConn dbConn = getDBConnection();
        try {
            List<ColumnOrSuperColumn> columns = dbConn.getSlice(
                    CassandraDefs.columnParent(storeName),
                    CassandraDefs.slicePredicateStartEndCol(Utils.toBytes(startColumn), Utils.toBytes(endColumn), count),
                    Utils.toByteBuffer(rowKey));
            List<DColumn> result = new ArrayList<>(columns.size());
            for(ColumnOrSuperColumn column: columns) {
                result.add(new DColumn(column.getColumn().getName(), column.getColumn().getValue()));
            }
            return result;
        } finally {
            returnDBConnection(dbConn);
        }
    }
609834
public function getColumns($table)
    {
        $table = str_replace("`", "", $table);

        $columns = Db::fetchAll("SHOW COLUMNS FROM `" . $table . "`");

        $columnNames = array();
        foreach ($columns as $column) {
            $columnNames[] = $column['Field'];
        }

        return $columnNames;
    }
366279
public static function get($clearColumns = false)
	{
		/** @var Lib_Model_Db $ret */
		$ret = new static();
		if ($clearColumns)
		{
			$ret->clearColumns();
		}
		else
		{
			$ret->normalizeColumns();
		}
		return $ret;
	}
83931
public function getColumns($table)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        $query = $this->utility()->showColumns($table);
        $results = $this->query($query, $this->getBinds());
        
        $columns = array();
        foreach ($results as $column) {
            $key = null;
            if ($column['pk'] == 1) {
                $key = 'PRI';
            }
            
            $columns[] = array(
                'Field'     => $column['name'],
                'Type'      => $column['type'],
                'Default'   => $column['dflt_value'],
                'Null'      => $column['notnull'] != 1,
                'Key'       => $key);
        }
        
        return $columns;
    }
1110524
public String[] getColumnsBySql(Sql sql) throws SQLException {
		String columns[] = null;
		
		List<Map<String, String>> table = getMetadataBySql(sql);
		if (table != null) {
			columns = new String[table.size()];
			for (int i = 0 ; i < table.size() ; i++) {
				Map<String, String> row = table.get(i);
				if (row.containsKey("NAME") && row.get("NAME") != null) {
					columns[i] = row.get("NAME");
				}
			}
		}
		
		return columns;
	}
1225141
public function getTableColumns($table, $typeOnly = true)
	{
		$result = array();

		$table_temp = $this->replacePrefix((string) $table);

		// Set the query to get the table fields statement.
		$this->setQuery(
			'SELECT column_name as Field, data_type as Type, is_nullable as \'Null\', column_default as \'Default\'' .
			' FROM information_schema.columns' . ' WHERE table_name = ' . $this->quote($table_temp)
		);
		$fields = $this->loadObjectList();

		// If we only want the type as the value add just that to the list.
		if ($typeOnly)
		{
			foreach ($fields as $field)
			{
				$result[$field->Field] = preg_replace("/[(0-9)]/", '', $field->Type);
			}
		}
		else
		// If we want the whole field data object add that to the list.
		{
			foreach ($fields as $field)
			{
				$result[$field->Field] = $field;
			}
		}

		return $result;
	}
1203880
@Override
  public OperationHandle getColumns(SessionHandle sessionHandle,
      String catalogName, String schemaName, String tableName, String columnName)
          throws HiveSQLException {
    OperationHandle opHandle = sessionManager.getSession(sessionHandle)
        .getColumns(catalogName, schemaName, tableName, columnName);
    LOG.debug(sessionHandle + ": getColumns()");
    return opHandle;
  }
1353859
@Override
    public List<DColumn> getColumns(String storeName, String rowKey, String startColumn, String endColumn, int count) {
        String tableName = storeToCQLName(storeName);
        ResultSet rs = null;
        if (startColumn == null) {
            if (endColumn == null) {
                rs = executeQuery(Query.SELECT_1_ROW_ALL_COLUMNS, tableName, rowKey, new Integer(count));
            } else {
                rs = executeQuery(Query.SELECT_1_ROW_LOWER_COLUMNS, tableName, rowKey, endColumn, new Integer(count));
            }
        } else if (endColumn == null) {
            rs = executeQuery(Query.SELECT_1_ROW_UPPER_COLUMNS, tableName, rowKey, startColumn, new Integer(count));
        } else {
            rs = executeQuery(Query.SELECT_1_ROW_COLUMN_RANGE, tableName, rowKey, startColumn, endColumn, new Integer(count));
        }
        List<Row> list = rs.all();
        List<DColumn> result = new ArrayList<>(list.size());
        boolean isValueBinary = columnValueIsBinary(storeName);
        for(Row r: list) {
            DColumn cqlCol = null;
            if (isValueBinary) {
                cqlCol = new DColumn(r.getString("column1"), r.getBytes("value"));
            } else {
                cqlCol = new DColumn(r.getString("column1"), r.getString("value"));
            }
            
            result.add(cqlCol);
        }
        return result;
    }