X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=inline;f=ovsdb%2Fexecution.c;h=300c247a3d98a3485b217006c5eb9c978e07229a;hb=5ca1ba484bd9ade5116a49cf241cb98219d7d696;hp=9e3a8d07b5d04252531d5fe6196f5ff66ce88fab;hpb=da897f41cd795e325ec5ce773a70a819100bd26e;p=sliver-openvswitch.git diff --git a/ovsdb/execution.c b/ovsdb/execution.c index 9e3a8d07b..300c247a3 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010, 2011 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. @@ -434,6 +434,22 @@ ovsdb_execute_update(struct ovsdb_execution *x, struct ovsdb_parser *parser, if (!error) { error = parse_row(row_json, table, x->symtab, &row, &columns); } + if (!error) { + size_t i; + + for (i = 0; i < columns.n_columns; i++) { + const struct ovsdb_column *column = columns.columns[i]; + + if (!column->mutable) { + error = ovsdb_syntax_error(parser->json, + "constraint violation", + "Cannot update immutable column %s " + "in table %s.", + column->name, table->schema->name); + break; + } + } + } if (!error) { error = ovsdb_condition_from_json(table->schema, where, x->symtab, &condition); @@ -719,7 +735,7 @@ ovsdb_execute_assert(struct ovsdb_execution *x, struct ovsdb_parser *parser, { const struct json *lock_name; - lock_name = ovsdb_parser_member(parser, "lock", OP_STRING); + lock_name = ovsdb_parser_member(parser, "lock", OP_ID); if (!lock_name) { return NULL; }