-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009, 2010 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "ovsdb-error.h"
#include "row.h"
#include "table.h"
+#include "timeval.h"
#include "transaction.h"
#include "uuid.h"
#include "util.h"
table = shash_find_data(&db->tables, table_name);
if (!table) {
+ if (!strcmp(table_name, "_date")
+ || !strcmp(table_name, "_comment")) {
+ continue;
+ }
+
error = ovsdb_syntax_error(json, "unknown table",
"No table named %s.", table_name);
goto error;
unsigned int idx = column->index;
if (idx != OVSDB_COL_UUID && column->persistent
- && (!old || !ovsdb_datum_equals(&old->fields[idx],
- &new->fields[idx], type)))
+ && (old
+ ? !ovsdb_datum_equals(&old->fields[idx], &new->fields[idx],
+ type)
+ : !ovsdb_datum_is_default(&new->fields[idx], type)))
{
if (!row) {
row = json_object_create();
struct ovsdb_file_replica *r = ovsdb_file_replica_cast(r_);
struct ovsdb_file_replica_aux aux;
struct ovsdb_error *error;
+ const char *comment;
aux.json = NULL;
aux.table_json = NULL;
return NULL;
}
+ comment = ovsdb_txn_get_comment(txn);
+ if (comment) {
+ json_object_put_string(aux.json, "_comment", comment);
+ }
+
+ json_object_put(aux.json, "_date", json_integer_create(time_now()));
+
error = ovsdb_log_write(r->log, aux.json);
json_destroy(aux.json);
if (error) {