X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ovsdb%2Fmutation.c;h=5fd983a4badfa634707db5017761a9c6eb158710;hb=46d4c97ff75b647474f59cb141623a89a75388cd;hp=9f09d594197712b71755aaf565daa2310e5d83cb;hpb=a0bc29a541fc7dc6e20137d5558e2094d614e6ab;p=sliver-openvswitch.git diff --git a/ovsdb/mutation.c b/ovsdb/mutation.c index 9f09d5941..5fd983a4b 100644 --- a/ovsdb/mutation.c +++ b/ovsdb/mutation.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010 Nicira Networks +/* Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,6 +95,12 @@ ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts, "No column %s in table %s.", column_name, ts->name); } + if (!m->column->mutable) { + return ovsdb_syntax_error(json, "constraint violation", + "Cannot mutate immutable column %s in " + "table %s.", column_name, ts->name); + } + ovsdb_type_clone(&m->type, &m->column->type); mutator_name = json_string(array->elems[1]); @@ -327,7 +333,7 @@ ovsdb_mutation_check_count(struct ovsdb_datum *dst, if (!ovsdb_datum_conforms_to_type(dst, dst_type)) { char *s = ovsdb_type_to_english(dst_type); struct ovsdb_error *e = ovsdb_error( - "constaint violation", + "constraint violation", "Attempted to store %u elements in %s.", dst->n, s); free(s); return e;