Determine if a column should be copied.
186486
def should_copy(column):
    
    if not isinstance(column.type, Serial):
        return True

    if column.nullable:
        return True

    if not column.server_default:
        return True

    # do not create temporary serial values; they will be defaulted on upsert/insert
    return False
206160
private void checkColumnSize(Column<?> newColumn) {
        if (columnCount() != 0) {
            Preconditions.checkArgument(newColumn.size() == rowCount(),
                    "Column " + newColumn.name() +
                            " does not have the same number of rows as the other columns in the table.");
        }
    }
1308022
def ensure_hbounds(self):
        """"""
        self.cursor.x = min(max(0, self.cursor.x), self.columns - 1)
927883
protected void ensureColumns(List columns, List existingColumns)
    {
        if (columns == null || columns.isEmpty())
        {
            return;
        }
        
        Iterator iter = columns.iterator();

        while (iter.hasNext())
        {
            FieldHelper cf = (FieldHelper) iter.next();
            if (!existingColumns.contains(cf.name))
            {
                getAttributeInfo(cf.name, false, null, getQuery().getPathClasses());
            }
        }
    }
425628
function(oColumn, iNewIndex) {
			var oTable = oColumn.getParent(),
				iCurrentIndex = oTable.indexOfColumn(oColumn),
				aColumns = oTable.getColumns();

			if (iNewIndex > iCurrentIndex) {
				// The index is always given for the current table setup
				// -> A move consists of a remove and an insert, so if a column is moved to a higher index the index must be shifted
				iNewIndex--;
			}
			if (iNewIndex < 0) {
				iNewIndex = 0;
			} else if (iNewIndex > aColumns.length) {
				iNewIndex = aColumns.length;
			}

			return iNewIndex;
		}
1329055
private function isSelectColumn($data)
    {
        if (null !== $data && !in_array($data, $this->virtualColumns)) {
            return true;
        }

        return false;
    }
371707
def change_column_if_table_exists(self,
                                      tablename: str,
                                      oldfieldname: str,
                                      newfieldname: str,
                                      newdef: str) -> Optional[int]:
        """"""
        if not self.table_exists(tablename):
            return None
        if not self.column_exists(tablename, oldfieldname):
            return None
        sql = "ALTER TABLE {t} CHANGE COLUMN {old} {new} {newdef}".format(
            t=tablename,
            old=oldfieldname,
            new=newfieldname,
            newdef=newdef,
        )
        log.info(sql)
        return self.db_exec_literal(sql)
502098
boolean canInsert(Table table, boolean[] columnCheckList) {

        if (isFull || isFullInsert) {
            return true;
        }

        return containsAllColumns(insertColumnSet, table, columnCheckList);
    }
1217251
def column(self, col):
        
        if type(col) is str:
            for c in self._cols:
                if c.name == col:
                    return c
        else:
            return self._cols[col]
339195
function(len){
    var chunk = len[0];
    len = chunk ? chunk.length : len;
    this.str = this.str.substr(len);
    if (chunk) {
      this.move(chunk);
    } else {
      this.column += len;
    }
  }
47500
public boolean isUnique(String columnName) {
        if (columnName == null) {
            return false;
        }

        for (IndexHolder ih : indexHoldersByName.values()) {
            if (ih.isUnique() && ih.getSize() == 1) {
                if (ih.getIndexes().iterator().next().getColumnName().equalsIgnoreCase(columnName)) {
                    return true;
                }
            }
        }

        return false;
    }
1014626
def setColumn( self, column ):
        
        if ( not column ):
            return
        
        self._columnName = column.name()
        
        if ( column.columnType() != ColumnType.ForeignKey ):
            return
        
        if ( self._editor ):
            self._editor.setTableType(column.referenceModel())
            self._editor.setRequired(column.required())
644595
def _should_split_column_cells(cls, column_cells: List[str]) -> bool:
        
        return any(cls._should_split_cell(cell_text) for cell_text in column_cells)
756278
private boolean isRowKeyColumn(AssociationKeyMetadata metadata, String column) {
		for ( String rowKeyColumn : metadata.getRowKeyColumnNames() ) {
			if ( rowKeyColumn.equals( column ) ) {
				return true;
			}
		}

		return false;
	}
521585
def copy_table(tbl, start=0, stop=None, blen=None, storage=None,
               create='table', **kwargs):
    """"""

    # setup
    names, columns = _util.check_table_like(tbl)
    storage = _util.get_storage(storage)
    blen = _util.get_blen_table(tbl, blen)
    if stop is None:
        stop = len(columns[0])
    else:
        stop = min(stop, len(columns[0]))
    length = stop - start
    if length < 0:
        raise ValueError('invalid stop/start')

    # copy block-wise
    out = None
    for i in range(start, stop, blen):
        j = min(i+blen, stop)
        res = [c[i:j] for c in columns]
        if out is None:
            out = getattr(storage, create)(res, names=names,
                                           expectedlen=length, **kwargs)
        else:
            out.append(res)

    return out
1348413
void checkAddColumn(ColumnSchema col) {

        if (table.isText() && !table.isEmpty(session)) {
            throw Error.error(ErrorCode.X_S0521);
        }

        if (table.findColumn(col.getName().name) != -1) {
            throw Error.error(ErrorCode.X_42504);
        }

        if (col.isPrimaryKey() && table.hasPrimaryKey()) {
            throw Error.error(ErrorCode.X_42530);
        }

        if (col.isIdentity() && table.hasIdentityColumn()) {
            throw Error.error(ErrorCode.X_42525);
        }

        if (!table.isEmpty(session) && !col.hasDefault()
                && (!col.isNullable() || col.isPrimaryKey())
                && !col.isIdentity()) {
            throw Error.error(ErrorCode.X_42531);
        }
    }
710690
def copycol(self, origin_col: str, dest_col: str):
        
        try:
            self.df[dest_col] = self.df[[origin_col]]
        except Exception as e:
            self.err(e, self.copy_col, "Can not copy column")