Adds Columns to the specified table.

@param      Table $table The Table model class to add columns to.
512484
protected function addColumns(Table $table)
	{
		$stmt = $this->dbh->query("SHOW COLUMNS FROM `" . $table->getName() . "`");
		$table_quoted = $this->dbh->quote($table->getName());
		$db_quoted = $this->dbh->quote($table->getDatabase()->getName());

		while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
			$field_quoted = $this->dbh->quote($row['Field']);

			$row['Comment'] = $this->dbh->query("
				SELECT
				COLUMN_COMMENT
				FROM information_schema.COLUMNS
				WHERE TABLE_NAME=$table_quoted
					AND TABLE_SCHEMA=$db_quoted
					AND COLUMN_NAME=$field_quoted LIMIT 1")->fetchColumn();

			$name = $row['Field'];
			$is_nullable = ($row['Null'] == 'YES');
			$autoincrement = (strpos($row['Extra'], 'auto_increment') !== false);
			$size = null;
			$precision = null;
			$scale = null;

			if (preg_match('/^(\w+)[\(]?([\d,]*)[\)]?( |$)/', $row['Type'], $matches)) {
				//            colname[1]   size/precision[2]
				$nativeType = $matches[1];
				if ($matches[2]) {
					if ( ($cpos = strpos($matches[2], ',')) !== false) {
						$size = (int) substr($matches[2], 0, $cpos);
						$precision = $size;
						$scale = (int) substr($matches[2], $cpos + 1);
					} else {
						$size = (int) $matches[2];
					}
				}
				foreach (self::$defaultTypeSizes as $type => $defaultSize) {
					if ($nativeType == $type && $size == $defaultSize) {
						$size = null;
						continue;
					}
				}
			} elseif (preg_match('/^(\w+)\(/', $row['Type'], $matches)) {
				$nativeType = $matches[1];
			} else {
				$nativeType = $row['Type'];
			}

			//BLOBs can't have any default values in MySQL
			$default = preg_match('~blob|text~', $nativeType) ? null : $row['Default'];

			$propelType = $this->getMappedPropelType($nativeType);

			if (
				in_array($propelType, array(PropelTypes::INTEGER, PropelTypes::BIGINT))
				&& strpos($row['Comment'], 'timestamp') === 0
			) {
				$propelType = PropelTypes::INTEGER_TIMESTAMP;
			} elseif (!$propelType) {
				$propelType = Column::DEFAULT_TYPE;
				$this->warn("Column [" . $table->getName() . "." . $name. "] has a column type (".$nativeType.") that Propel does not support.");
			}

			$column = new Column($name);
			$column->setTable($table);
			$column->setDomainForType($propelType);
			// We may want to provide an option to include this:
			// $column->getDomain()->replaceSqlType($type);
			$column->getDomain()->replaceSize($size);
			$column->getDomain()->replaceScale($scale);
			if ($default !== null) {
				if ($propelType == PropelTypes::BOOLEAN) {
					if ($default == '1') $default = 'true';
					if ($default == '0') $default = 'false';
				}
				if (in_array($default, array('CURRENT_TIMESTAMP'))) {
					$type = ColumnDefaultValue::TYPE_EXPR;
				} else {
					$type = ColumnDefaultValue::TYPE_VALUE;
				}
				$column->getDomain()->setDefaultValue(new ColumnDefaultValue($default, $type));
			}
			$column->setAutoIncrement($autoincrement);
			$column->setNotNull(!$is_nullable);

			if ($this->addVendorInfo) {
				$vi = $this->getNewVendorInfoObject($row);
				$column->addVendorInfo($vi);
			}

			$table->addColumn($column);
		}


	}
1349559
private function createColumns(Table $table)
    {
        $table->addColumn(RdsDeliveryExecutionService::COLUMN_ID, Type::STRING, ["length" => 255, "notnull" => true]);
        $table->addColumn(RdsDeliveryExecutionService::COLUMN_DELIVERY_ID, Type::STRING, ["length" => 255, "notnull" => true]);
        $table->addColumn(RdsDeliveryExecutionService::COLUMN_USER_ID, Type::STRING, ["length" => 255, "notnull" => true]);
        $table->addColumn(RdsDeliveryExecutionService::COLUMN_LABEL, Type::STRING, ["length" => 255, "notnull" => true]);
        $table->addColumn(RdsDeliveryExecutionService::COLUMN_STATUS, Type::STRING, ["length" => 255, "notnull" => true]);
        $table->addColumn(RdsDeliveryExecutionService::COLUMN_STARTED_AT, Type::DATETIME, ["notnull" => true]);
        $table->addColumn(RdsDeliveryExecutionService::COLUMN_FINISHED_AT, Type::DATETIME, ["notnull" => false]);
        $table->setPrimaryKey([RdsDeliveryExecutionService::COLUMN_ID]);
    }
1094898
public function initialize(Table $table)
    {
        $this->table = $table;
        $this->table->setTableId($this->tableId);
    }
176651
public function setTable($table)
    {
        $this->table = $table;

        //for each row
        foreach ($this->data as $row) {
            if (!is_object($row) || !method_exists($row, __FUNCTION__)) {
                continue;
            }

            //let the row handle this
            $row->setTable($table);
        }

        return $this;
    }
65629
public function setTables($tables) {
		foreach($tables as $key=>$value) {
			if (is_numeric($key)) {
				$this->tables[] = $value;
			}
			else {
				$this->tables[] = $key;
				$this->columns[$key] = $value;
			}
		}
		$this->cacheTables = true;
	}
342744
public function filter($table)
    {
        if (!isset($this->nameToAppend) || '' === $this->nameToAppend || false === $this->nameToAppend) {
            return;
        }

        foreach ($table->getRows() as $row) {
            $columns = $row->getColumns();

            foreach ($columns as $column => $value) {
                $row->deleteColumn($column);
                $row->setColumn($column . $this->nameToAppend, $value);
            }

            $this->filterSubTable($row);
        }
    }
427912
public function addColumn($column) {
        $columns = $this->getColumns();
        $columns[] = $column;
        $this->setColumns($columns);
    }
877735
protected function addForeignKeys(Table $table)
	{
		$database = $table->getDatabase();

		$stmt = $this->dbh->query("SELECT ccu1.TABLE_NAME, ccu1.COLUMN_NAME, ccu2.TABLE_NAME AS FK_TABLE_NAME, ccu2.COLUMN_NAME AS FK_COLUMN_NAME, ccu2.CONSTRAINT_NAME AS FK_NAME
									FROM INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu1 INNER JOIN
											INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc1 ON tc1.CONSTRAINT_NAME = ccu1.CONSTRAINT_NAME AND
											UPPER (CONSTRAINT_TYPE) = 'FOREIGN KEY' INNER JOIN
											INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc1 ON rc1.CONSTRAINT_NAME = tc1.CONSTRAINT_NAME INNER JOIN
											INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu2 ON ccu2.CONSTRAINT_NAME = rc1.UNIQUE_CONSTRAINT_NAME
									WHERE (ccu1.table_name = '".$table->getName()."')");

		$foreignKeys = array(); // local store to avoid duplicates
		while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {

			$lcol = $row['COLUMN_NAME'];
			$ftbl = $row['FK_TABLE_NAME'];
			$fcol = $row['FK_COLUMN_NAME'];
			$name = $row['FK_NAME'];

			$foreignTable = $database->getTable($ftbl);
			$foreignColumn = $foreignTable->getColumn($fcol);
			$localColumn   = $table->getColumn($lcol);

			if (!isset($foreignKeys[$name])) {
				$fk = new ForeignKey($name);
				$fk->setForeignTableCommonName($foreignTable->getCommonName());
				$fk->setForeignSchemaName($foreignTable->getSchema());
				//$fk->setOnDelete($fkactions['ON DELETE']);
				//$fk->setOnUpdate($fkactions['ON UPDATE']);
				$table->addForeignKey($fk);
				$foreignKeys[$name] = $fk;
			}
			$foreignKeys[$name]->addReference($localColumn, $foreignColumn);
		}

	}
53214
public function setTable(Table $table)
    {
        $this->_table = $table;
        $eventManager = $table->getEventManager();
        if ($eventManager !== null) {
            $this->setEventManager($eventManager);
        }
    }
1116470
public function addColumns(array $columns)
    {
        /*
         * Build a final collection of list column objects
         */
        foreach ($columns as $columnName => $config) {
            $this->allColumns[$columnName] = $this->makeListColumn($columnName, $config);
        }
    }
979360
public function createTable(Table $table)
    {
        $createFlags = AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS;
        $this->_execSql($this->_platform->getCreateTableSQL($table, $createFlags));
    }
1170145
protected function addIndexes(Table $table)
    {
        $stmt = $this->dbh->query('PRAGMA index_list("' . $table->getName() . '")');

        while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
            $name = $row['name'];
            $internalName = $name;

            if (0 === strpos($name, 'sqlite_autoindex')) {
                $internalName = '';
            }

            $index = $row['unique'] ? new Unique($internalName) : new Index($internalName);

            $stmt2 = $this->dbh->query("PRAGMA index_info('".$name."')");
            while ($row2 = $stmt2->fetch(\PDO::FETCH_ASSOC)) {
                $colname = $row2['name'];
                $index->addColumn($table->getColumn($colname));
            }

            if (1 === count($table->getPrimaryKey()) && 1 === count($index->getColumns())) {
                // exclude the primary unique index, since it's autogenerated by sqlite
                if ($table->getPrimaryKey()[0]->getName() === $index->getColumns()[0]) {
                    continue;
                }
            }

            if ($index instanceof Unique) {
                $table->addUnique($index);
            } else {
                $table->addIndex($index);
            }
        }
    }
756413
def AddTableColumn(self, table, column):
    """"""
    if column not in self._table_columns[table]:
      self._table_columns[table].append(column)
693152
public function filter($table)
    {
        $row = new DataTableSummaryRow($table);
        $row->setColumn('label', $this->labelSummaryRow);
        $table->addSummaryRow($row);
    }
607284
protected function add_user_columns($table, &$columns, &$headers) {
        global $CFG;
        if (!$table->is_downloading() && $CFG->grade_report_showuserimage) {
            $columns[] = 'picture';
            $headers[] = '';
        }
        if (!$table->is_downloading()) {
            $columns[] = 'fullname';
            $headers[] = get_string('name');
        } else {
            $columns[] = 'lastname';
            $headers[] = get_string('lastname');
            $columns[] = 'firstname';
            $headers[] = get_string('firstname');
        }

        $extrafields = get_extra_user_fields($this->context);
        foreach ($extrafields as $field) {
            $columns[] = $field;
            $headers[] = get_user_field_name($field);
        }
    }
355658
public function filter($table)
    {
        foreach ($table->getRows() as $row) {
            $value = $row->getColumn($this->columnToDecode);
            if ($value !== false) {
                $value = self::decodeLabelSafe($value);
                $row->setColumn($this->columnToDecode, $value);

                $this->filterSubTable($row);
            }
        }
    }
737674
public function displayTable($table)
    {
        $headers = $this->makeHeaders($table[0]);

        $rows = [];

        foreach ($table as $row) {
            $rows[] = (array) $row;
        }

        $this->table = $this->getHelperSet()->get('table');

        $this->table->setHeaders($headers)->setRows($rows);

        $this->table->render($this->getOutput());
    }