mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-01-02 12:27:09 +08:00
mdb-schema: Exit with code 1 if the requested table is not found
This commit is contained in:
@@ -33,6 +33,7 @@ main (int argc, char **argv)
|
||||
int opt_comments = MDB_SHEXP_DEFAULT & MDB_SHEXP_COMMENTS;
|
||||
int opt_indexes = MDB_SHEXP_DEFAULT & MDB_SHEXP_INDEXES;
|
||||
int opt_relations = MDB_SHEXP_DEFAULT & MDB_SHEXP_RELATIONS;
|
||||
int success = 0;
|
||||
|
||||
GOptionEntry entries[] = {
|
||||
{ "table", 'T', 0, G_OPTION_ARG_STRING, &tabname, "Only create schema for named table", "table"},
|
||||
@@ -107,13 +108,17 @@ main (int argc, char **argv)
|
||||
export_options |= MDB_SHEXP_INDEXES;
|
||||
if (opt_relations)
|
||||
export_options |= MDB_SHEXP_RELATIONS;
|
||||
mdb_print_schema(mdb, stdout, tabname, namespace, export_options);
|
||||
|
||||
success = mdb_print_schema(mdb, stdout, tabname, namespace, export_options);
|
||||
if (tabname && !success) {
|
||||
fprintf(stderr, "Error: No table named \"%s\" found in the database\n", tabname);
|
||||
}
|
||||
|
||||
mdb_close (mdb);
|
||||
|
||||
g_option_context_free(opt_context);
|
||||
g_free(namespace);
|
||||
g_free(tabname);
|
||||
return 0;
|
||||
return !success;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user