set_program_name(argv[0]);
signal(SIGPIPE, SIG_IGN);
- time_init();
vlog_init();
vlog_set_levels(VLM_ANY_MODULE, VLF_CONSOLE, VLL_WARN);
vlog_set_levels(VLM_reconnect, VLF_ANY_FACILITY, VLL_WARN);
\n\
Database commands:\n\
list TBL [REC] list RECord (or all records) in TBL\n\
- get TBL REC COL[:KEY] print values of COLumns in RECORD in TBL\n\
+ get TBL REC COL[:KEY] print values of COLumns in RECord in TBL\n\
set TBL REC COL[:KEY]=VALUE set COLumn values in RECord in TBL\n\
add TBL REC COL [KEY=]VALUE add (KEY=)VALUE to COLumn in RECord in TBL\n\
remove TBL REC COL [KEY=]VALUE remove (KEY=)VALUE from COLumn\n\
clear TBL REC COL clear values from COLumn in RECord in TBL\n\
create TBL COL[:KEY]=VALUE create and initialize new record\n\
- destroy TBL REC delete REC from TBL\n\
+ destroy TBL REC delete RECord from TBL\n\
wait-until TBL REC [COL[:KEY]=VALUE] wait until condition is true\n\
Potentially unsafe database commands require --force option.\n\
\n\
static const struct ovsdb_idl_row *
get_row_by_id(struct vsctl_context *ctx, const struct vsctl_table_class *table,
- const struct vsctl_row_id *id, const char *record_id,
- bool partial_match_ok)
+ const struct vsctl_row_id *id, const char *record_id)
{
const struct ovsdb_idl_row *referrer, *final;
}
} else {
const struct ovsdb_idl_row *row;
- unsigned int best_score = 0;
referrer = NULL;
for (row = ovsdb_idl_first_row(ctx->idl, id->table);
- row != NULL && best_score != UINT_MAX;
+ row != NULL;
row = ovsdb_idl_next_row(row))
{
const struct ovsdb_datum *name;
name = ovsdb_idl_get(row, id->name_column,
OVSDB_TYPE_STRING, OVSDB_TYPE_VOID);
- if (name->n == 1) {
- unsigned int score;
-
- score = (partial_match_ok
- ? score_partial_match(name->keys[0].string, record_id)
- : !strcmp(name->keys[0].string, record_id));
- if (score > best_score) {
- referrer = row;
- best_score = score;
- } else if (score == best_score) {
- referrer = NULL;
+ if (name->n == 1 && !strcmp(name->keys[0].string, record_id)) {
+ if (referrer) {
+ vsctl_fatal("multiple rows in %s match \"%s\"",
+ table->class->name, record_id);
}
+ referrer = row;
}
}
- if (best_score && !referrer) {
- vsctl_fatal("multiple rows in %s match \"%s\"",
- table->class->name, record_id);
- }
}
if (!referrer) {
return NULL;
}
static const struct ovsdb_idl_row *
-get_row__(struct vsctl_context *ctx,
- const struct vsctl_table_class *table, const char *record_id,
- bool partial_match_ok)
+get_row (struct vsctl_context *ctx,
+ const struct vsctl_table_class *table, const char *record_id)
{
const struct ovsdb_idl_row *row;
struct uuid uuid;
int i;
for (i = 0; i < ARRAY_SIZE(table->row_ids); i++) {
- row = get_row_by_id(ctx, table, &table->row_ids[i], record_id,
- partial_match_ok);
+ row = get_row_by_id(ctx, table, &table->row_ids[i], record_id);
if (row) {
break;
}
return row;
}
-static const struct ovsdb_idl_row *
-get_row(struct vsctl_context *ctx,
- const struct vsctl_table_class *table, const char *record_id)
-{
- return get_row__(ctx, table, record_id, true);
-}
-
static const struct ovsdb_idl_row *
must_get_row(struct vsctl_context *ctx,
const struct vsctl_table_class *table, const char *record_id)
const char *operator;
unsigned int idx;
char *error;
- int cmp;
+ int cmp = 0;
error = parse_column_key_value(arg, table, &column, &key_string,
&operator, operators, ARRAY_SIZE(operators),
table = get_table(table_name);
- row = get_row__(ctx, table, record_id, false);
+ row = get_row(ctx, table, record_id);
if (!row) {
ctx->try_again = true;
return;
const char *unused;
struct vsctl_command *c;
int64_t next_cfg = 0;
- char *error;
+ char *error = NULL;
txn = the_idl_txn = ovsdb_idl_txn_create(idl);
if (dry_run) {