X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=ovsdb%2Fexecution.c;h=7a1db0c543c6402bfeba30a3d54c6f5cafcc616f;hb=0ef165ecb57943e17a8ee8270df68ffb8d032e29;hp=1aff0c51eaca917d2c2d8cc86b7c629050bed06e;hpb=e0edde6fee279cdbbf3c179f5f50adaf0c7c7f1e;p=sliver-openvswitch.git diff --git a/ovsdb/execution.c b/ovsdb/execution.c index 1aff0c51e..7a1db0c54 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2009, 2010, 2011 Nicira, Inc. +/* Copyright (c) 2009, 2010, 2011, 2012, 2013 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ #include -#include #include #include "column.h" @@ -141,7 +140,7 @@ ovsdb_execute(struct ovsdb *db, const struct ovsdb_session *session, /* Parse and execute operation. */ ovsdb_parser_init(&parser, operation, - "ovsdb operation %zu of %zu", i, n_operations); + "ovsdb operation %"PRIuSIZE" of %"PRIuSIZE, i, n_operations); op = ovsdb_parser_member(&parser, "op", OP_ID); result = json_object_create(); if (op) { @@ -154,7 +153,7 @@ ovsdb_execute(struct ovsdb *db, const struct ovsdb_session *session, op_name); } } else { - assert(ovsdb_parser_has_error(&parser)); + ovs_assert(ovsdb_parser_has_error(&parser)); } /* A parse error overrides any other error. @@ -434,6 +433,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);