Add the XSD for a column property to the ``TreeBuilder``.
433057
def add_column_property_xsd(self, tb, column_property):
        
        if len(column_property.columns) != 1:
            raise NotImplementedError  # pragma: no cover
        column = column_property.columns[0]
        if column.primary_key and not self.include_primary_keys:
            return
        if column.foreign_keys and not self.include_foreign_keys:
            if len(column.foreign_keys) != 1:  # pragma: no cover
                # FIXME understand when a column can have multiple
                # foreign keys
                raise NotImplementedError()
            return
        attrs = {'name': column_property.key}
        self.add_column_xsd(tb, column, attrs)
231491
function (namespace, schemaContent, cb) {
    var self = this;

    if (multivalue.hasValue(self.parsedSchemas, namespace, schemaContent)) {
      cb(null, {});
      return;
    }

    xml2js.parseString(schemaContent, function (err, result) {
      if (err) {
        cb(err);
        return;
      }

      // Only one root element expected
      if (!result || _.size(result) !== 1) {
        cb("Invalid schema for " + namespace + ": " + util.inspect(result, false, null));
        return;
      }

      parseNamespacePrefixes(result, function (err, defaultNamespace, namespaces, xsPrefix) {
        if (err) {
          cb(err);
          return;
        }

        assert(result[xsPrefix + 'schema'], result);

        var schema = result[xsPrefix + 'schema'];

        if (schema.$ && schema.$.targetNamespace && schema.$.targetNamespace !== namespace) {
          cb("Schema does not have expected target namespace " + namespace + ": " + util.inspect(result, false, null));
          return;
        }

        var schemaParser = new XsdSchema(self, namespace, defaultNamespace, namespaces, xsPrefix);

        var importsAndIncludes = schemaParser.parseImportsAndIncludes(namespace, schema);

        var newElements = schemaParser.parseElements(schema, null);
        // TODO: Check if we are overriding anything
        _.extend(self.elements, newElements);

        var newAttributes = schemaParser.parseAttributes(schema);
        // TODO: Check if we are overriding anything
        _.extend(self.attributes, newAttributes);

        var newTypes = schemaParser.parseTypes(schema);
        // TODO: Check if we are overriding anything
        _.extend(self.types, newTypes);

        // TODO: Add support for element and attribute groups
        delete schema[xsPrefix + 'group'];
        delete schema[xsPrefix + 'attributeGroup'];

        // Previous parsing calls are destructive and should consume schema so that it is empty now
        assert(_.isEmpty(schema), schema);

        multivalue.addValue(self.parsedSchemas, namespace, schemaContent);

        cb(null, importsAndIncludes);
      });
    });
  }
1167715
def AddDescriptorFromSchema(self, schema_name, schema):
        """"""
        # TODO(craigcitro): Is schema_name redundant?
        if self.__GetDescriptor(schema_name):
            return
        if schema.get('enum'):
            self.__DeclareEnum(schema_name, schema)
            return
        if schema.get('type') == 'any':
            self.__DeclareMessageAlias(schema, 'extra_types.JsonValue')
            return
        if schema.get('type') != 'object':
            raise ValueError('Cannot create message descriptors for type %s' %
                             schema.get('type'))
        message = extended_descriptor.ExtendedMessageDescriptor()
        message.name = self.__names.ClassName(schema['id'])
        message.description = util.CleanDescription(schema.get(
            'description', 'A %s object.' % message.name))
        self.__DeclareDescriptor(message.name)
        with self.__DescriptorEnv(message):
            properties = schema.get('properties', {})
            for index, (name, attrs) in enumerate(sorted(properties.items())):
                field = self.__FieldDescriptorFromProperties(
                    name, index + 1, attrs)
                message.fields.append(field)
                if field.name != name:
                    message.field_mappings.append(
                        type(message).JsonFieldMapping(
                            python_name=field.name, json_name=name))
                    self.__AddImport(
                        'from %s import encoding' % self.__base_files_package)
            if 'additionalProperties' in schema:
                self.__AddAdditionalProperties(message, schema, properties)
        self.__RegisterDescriptor(message)
1032984
def add_from_xmlnode(self, element):
        """"""
        if self.tree is None:
            root = ET.Element('interface')
            root.append(element)
            self.tree = tree = ET.ElementTree(root)
            self.root = tree.getroot()
            self.objects = {}
            # ET.dump(tree)
        else:
            # TODO: append to current tree
            pass
1245487
public void addSchema(String version, TTypes types, MessageInfo recMessageInfo)
    {
        String name = this.fixName(recMessageInfo.getField(MessageInfo.DESCRIPTION).toString());
        
        Import importel = schemaFactory.createImport();
        org.w3._2001.xmlschema.Schema schema = (org.w3._2001.xmlschema.Schema)types.getAny().get(0);    // LAME
        schema.getIncludeOrImportOrRedefine().add(importel);
        String code = recMessageInfo.getField(MessageInfo.CODE).toString();
        if (code == null)
            code = name;
        String namespace = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.NAMESPACE);
        String element = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.ELEMENT);
        String schemaLocation = ((PropertiesField)recMessageInfo.getField(MessageInfo.MESSAGE_PROPERTIES)).getProperty(MessageInfo.SCHEMA_LOCATION);
        
        if (namespace == null)
            namespace = this.getMessageControl().getNamespaceFromVersion(version);
        if (element == null)
            if (code != null)
                element = code;
        if (schemaLocation == null)
            if (code != null)
                schemaLocation = code + ".xsd";
        schemaLocation = this.getMessageControl().getSchemaLocation(version, schemaLocation);
        if (namespace != null)
            importel.setNamespace(namespace);
        importel.setSchemaLocation(schemaLocation);
    }
1181635
def add_column(self, tablename: str, fieldspec: FIELDSPEC_TYPE) -> int:
        """"""
        sql = "ALTER TABLE {} ADD COLUMN {}".format(
            tablename, self.fielddefsql_from_fieldspec(fieldspec))
        log.info(sql)
        return self.db_exec_literal(sql)
425430
public final B addKey(String column) {
        return addMapping(column, calculatedIndex++, FieldMapperColumnDefinition.<K>key());
    }
713406
private void addColumnValue(Object value, VoltType columnType, int col) {
        // schema checking code that is used for some tests
        boolean allowNulls = true;
        int maxColSize = VoltType.MAX_VALUE_LENGTH;
        if (m_extraMetadata != null) {
            allowNulls = m_extraMetadata.originalColumnInfos[col].nullable;
            maxColSize = m_extraMetadata.originalColumnInfos[col].size;
        }

        if (VoltType.isVoltNullValue(value)) {
            // schema checking code that is used for some tests
            // allowNulls should always be true in production
            if (allowNulls == false) {
                throw new IllegalArgumentException(
                        String.format("Column %s at index %d doesn't allow NULL values.",
                        getColumnName(col), col));
            }

            switch (columnType) {
            case TINYINT:
                m_buffer.put(VoltType.NULL_TINYINT);
                break;
            case SMALLINT:
                m_buffer.putShort(VoltType.NULL_SMALLINT);
                break;
            case INTEGER:
                m_buffer.putInt(VoltType.NULL_INTEGER);
                break;
            case TIMESTAMP:
                m_buffer.putLong(VoltType.NULL_BIGINT);
                break;
            case BIGINT:
                m_buffer.putLong(VoltType.NULL_BIGINT);
                break;
            case FLOAT:
                m_buffer.putDouble(VoltType.NULL_FLOAT);
                break;
            case STRING:
            case GEOGRAPHY:
            case VARBINARY:
                m_buffer.putInt(NULL_STRING_INDICATOR);
                break;
            case GEOGRAPHY_POINT:
                GeographyPointValue.serializeNull(m_buffer);
                break;
            case DECIMAL:
                VoltDecimalHelper.serializeNull(m_buffer);
                break;

            default:
                throw new VoltTypeException("Unsupported type: " +
                        columnType);
            }
        }
        else {

            // Allow implicit conversions across all numeric types
            // except BigDecimal and anything else. Require BigDecimal
            // and reject Long128. Convert byte[] to VoltType.STRING.
            // Allow longs to be converted to VoltType.TIMESTAMPS.

            // In all error paths, catch ClassCastException
            // and VoltTypeException to restore
            // the correct table state.
            // XXX consider adding a fast path that checks for
            // equivalent types of input and column

            try {
                switch (columnType) {
                case TINYINT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n1 = (Number) value;
                    if (columnType.wouldCastOverflow(n1)) {
                        throw new VoltTypeException("Cast of " +
                                n1.doubleValue() +
                                " to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.put(n1.byteValue());
                    break;
                case SMALLINT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n2 = (Number) value;
                    if (columnType.wouldCastOverflow(n2)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putShort(n2.shortValue());
                    break;
                case INTEGER:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n3 = (Number) value;
                    if (columnType.wouldCastOverflow(n3)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putInt(n3.intValue());
                    break;
                case BIGINT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n4 = (Number) value;
                    if (columnType.wouldCastOverflow(n4)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putLong(n4.longValue());
                    break;

                case FLOAT:
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    final Number n5 = (Number) value;
                    if (columnType.wouldCastOverflow(n5)) {
                        throw new VoltTypeException("Cast to " +
                                columnType.toString() +
                                " would overflow");
                    }
                    m_buffer.putDouble(n5.doubleValue());
                    break;

                case STRING: {
                    // Accept byte[] and String
                    if (value instanceof byte[]) {
                        if (((byte[]) value).length > maxColSize) {
                            throw new VoltOverflowException(
                                    "Value in VoltTable.addRow(...) larger than allowed max " +
                                            VoltType.humanReadableSize(maxColSize));
                        }

                        // bytes MUST be a UTF-8 encoded string.
                        assert(testForUTF8Encoding((byte[]) value));
                        writeStringOrVarbinaryToBuffer((byte[]) value, m_buffer);
                    }
                    else {
                        if (((String) value).length() > maxColSize) {
                            throw new VoltOverflowException(
                                    "Value in VoltTable.addRow(...) larger than allowed max " +
                                            VoltType.humanReadableSize(maxColSize));
                        }

                        writeStringToBuffer((String) value, ROWDATA_ENCODING, m_buffer);
                    }
                    break;
                }

                case VARBINARY: {
                    // Accept byte[] and String (hex-encoded)
                    if (value instanceof String) {
                        value = Encoder.hexDecode((String) value);
                    }
                    if (value instanceof byte[]) {
                        if (((byte[]) value).length > maxColSize) {
                            throw new VoltOverflowException(
                                    "Value in VoltTable.addRow(...) larger than allowed max " +
                                            VoltType.humanReadableSize(maxColSize));
                        }
                        writeStringOrVarbinaryToBuffer((byte[]) value, m_buffer);
                    }
                    else {
                        throw new ClassCastException();
                    }
                    break;
                }

                case GEOGRAPHY: {
                    GeographyValue gv = (GeographyValue)value;
                    m_buffer.putInt(gv.getLengthInBytes());
                    gv.flattenToBuffer(m_buffer);
                    break;
                }

                case GEOGRAPHY_POINT: {
                    GeographyPointValue pt = (GeographyPointValue)value;
                    pt.flattenToBuffer(m_buffer);
                    break;
                }

                case TIMESTAMP: {
                    if (value instanceof BigDecimal) {
                        throw new ClassCastException();
                    }
                    long micros;
                    // Accept long and TimestampType and any kind of Date
                    if (value instanceof java.util.Date ||
                            value instanceof TimestampType) {
                         micros = ParameterSet.timestampToMicroseconds(value);
                    }
                    else {
                        micros = ((Number) value).longValue();
                    }
                    m_buffer.putLong(micros);
                    break;
                }

                case DECIMAL: {
                    // Only accept BigDecimal; rely on class cast exception for error path
                    VoltDecimalHelper.serializeBigDecimal( (BigDecimal)value, m_buffer);
                    break;
                }

                default:
                    throw new VoltTypeException("Unsupported type: " + columnType);
                }
            }
            catch (ClassCastException cce) {
                throw new VoltTypeException("Value for column " + col + " (" +
                        getColumnName(col) + ") is type " +
                        value.getClass().getSimpleName() + " when type " + columnType +
                        " was expected.");
            }
        }
    }
809711
private void addToWrapper(EntityMetadata entityMetadata, AttributeWrapper wrapper, Object embeddedObject,
            Attribute attrib, Attribute embeddedAttrib)
    {
        if (embeddedObject == null)
        {
            return;
        }
        
        byte[] value = PropertyAccessorHelper.get(embeddedObject, (Field) attrib.getJavaMember());
        byte[] name;
        if (value != null)
        {
            if (embeddedAttrib == null)
            {
                name = getEncodedBytes(((AbstractAttribute) attrib).getJPAColumnName());
            }
            else
            {
                name = getEncodedBytes(getHashKey(embeddedAttrib.getName(),
                        ((AbstractAttribute) attrib).getJPAColumnName()));
            }
            // add column name as key and value as value
            wrapper.addColumn(name, value);
            // // {tablename:columnname,hashcode} for value

            // selective indexing.
            if (entityMetadata.getIndexProperties().containsKey(((AbstractAttribute) attrib).getJPAColumnName()))
            {
                String valueAsStr = PropertyAccessorHelper.getString(embeddedObject, (Field) attrib.getJavaMember());
                wrapper.addIndex(
                        getHashKey(entityMetadata.getTableName(), ((AbstractAttribute) attrib).getJPAColumnName()),
                        getDouble(valueAsStr));

                wrapper.addIndex(
                        getHashKey(entityMetadata.getTableName(),
                                getHashKey(((AbstractAttribute) attrib).getJPAColumnName(), valueAsStr)),
                        getDouble(valueAsStr));
            }
        }
    }
395965
public <T, V> void addColumn(String name, Class<? extends V> type, 
        Function<T, V> getter, BiConsumer<T, V> setter)
    {
        Column column = new Column();
        column.name = Objects.requireNonNull(name, "The name may not be null");
        column.type = Objects.requireNonNull(type, "The type may not be null");
        column.getter = Objects.requireNonNull(
            getter, "The getter may not be null");
        column.setter = setter;
        columns.add(column);
        fireTableStructureChanged();
    }
32909
private void addProperties(final PropertyDescriptor[] _properties) throws ColumnBuilderException, ClassNotFoundException {
        for (final PropertyDescriptor property : _properties) {
            if (isValidProperty(property)) {
                addColumn(getColumnTitle(property), property.getName(), property.getPropertyType().getName(), getColumnWidth(property));
            }
        }
        setUseFullPageWidth(true);
    }
500437
def import_schema(self, definitions, d):
        """"""
        if not definitions.types:
            root = Element("types", ns=wsdlns)
            definitions.root.insert(root)
            types = Types(root, definitions)
            definitions.types.append(types)
        else:
            types = definitions.types[-1]
        types.root.append(d.root)
        log.debug("imported (XSD):\n%s", d.root)
1292144
def include(prop):
    ''''''
    if isinstance(prop, QueryableAttribute):
        prop = prop.property
    assert isinstance(prop, (Column, ColumnProperty, RelationshipProperty))
    #assert isinstance(prop, RelationshipProperty)
    _included.add(prop)
983709
private boolean appendColumnValue(StringBuilder builder, Object valueObj, Field column)
    {
        Object value = PropertyAccessorHelper.getObject(valueObj, column);
        boolean isPresent = false;
        isPresent = appendValue(builder, column.getType(), value, isPresent, false);
        return isPresent;
    }
1144615
private <S extends Model> String buildInsertSQL(S model, List<Object> columnValues) {
        SQLParams sqlParams = SQLParams.builder()
                .model(model)
                .columnValues(columnValues)
                .modelClass(this.modelClass)
                .tableName(this.tableName)
                .pkName(this.primaryKeyColumn)
                .build();

        return Anima.of().dialect().insert(sqlParams);
    }
1264214
def _bind_to_schema(self, field_name, schema):
        
        self.parent = self.parent or schema
        self.name = self.name or field_name
307846
def update(self, **kwargs):
        
        """
        for key, value in kwargs.items():
            helper = helpers.CAST_DICT.get(type(value), str)
            tag = self._get_aliases().get(key, key)

            elements = list(self._xml.iterchildren(tag=tag))
            if elements:
                for element in elements:
                    element.text = helper(value)
            else:
                element = etree.Element(key)
                element.text = helper(value)
                self._xml.append(element)
                self._aliases = None