mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
Added --p for producing output parsable by LOAD TABLE INFILE
This commit is contained in:
parent
950e258fde
commit
a03d5ad9f2
1 changed files with 24 additions and 7 deletions
|
@ -31,6 +31,7 @@ static Ndb_cluster_connection *ndb_cluster_connection= 0;
|
||||||
static Ndb* ndb = 0;
|
static Ndb* ndb = 0;
|
||||||
static const NdbDictionary::Dictionary * dic = 0;
|
static const NdbDictionary::Dictionary * dic = 0;
|
||||||
static int _unqualified = 0;
|
static int _unqualified = 0;
|
||||||
|
static int _parsable = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fatal(char const* fmt, ...)
|
fatal(char const* fmt, ...)
|
||||||
|
@ -76,10 +77,13 @@ list(const char * tabname,
|
||||||
if (dic->listIndexes(list, tabname) == -1)
|
if (dic->listIndexes(list, tabname) == -1)
|
||||||
fatal_dict("listIndexes");
|
fatal_dict("listIndexes");
|
||||||
}
|
}
|
||||||
|
if (!_parsable)
|
||||||
|
{
|
||||||
if (ndb->usingFullyQualifiedNames())
|
if (ndb->usingFullyQualifiedNames())
|
||||||
ndbout_c("%-5s %-20s %-8s %-7s %-12s %-8s %s", "id", "type", "state", "logging", "database", "schema", "name");
|
ndbout_c("%-5s %-20s %-8s %-7s %-12s %-8s %s", "id", "type", "state", "logging", "database", "schema", "name");
|
||||||
else
|
else
|
||||||
ndbout_c("%-5s %-20s %-8s %-7s %s", "id", "type", "state", "logging", "name");
|
ndbout_c("%-5s %-20s %-8s %-7s %s", "id", "type", "state", "logging", "name");
|
||||||
|
}
|
||||||
for (unsigned i = 0; i < list.count; i++) {
|
for (unsigned i = 0; i < list.count; i++) {
|
||||||
NdbDictionary::Dictionary::List::Element& elt = list.elements[i];
|
NdbDictionary::Dictionary::List::Element& elt = list.elements[i];
|
||||||
char type[100];
|
char type[100];
|
||||||
|
@ -170,10 +174,20 @@ list(const char * tabname,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ndb->usingFullyQualifiedNames())
|
if (ndb->usingFullyQualifiedNames())
|
||||||
|
{
|
||||||
|
if (_parsable)
|
||||||
|
ndbout_c("%d\t'%s'\t'%s'\t'%s'\t'%s'\t'%s'\t'%s'", elt.id, type, state, store, (elt.database)?elt.database:"", (elt.schema)?elt.schema:"", elt.name);
|
||||||
|
else
|
||||||
ndbout_c("%-5d %-20s %-8s %-7s %-12s %-8s %s", elt.id, type, state, store, (elt.database)?elt.database:"", (elt.schema)?elt.schema:"", elt.name);
|
ndbout_c("%-5d %-20s %-8s %-7s %-12s %-8s %s", elt.id, type, state, store, (elt.database)?elt.database:"", (elt.schema)?elt.schema:"", elt.name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (_parsable)
|
||||||
|
ndbout_c("%d\t'%s'\t'%s'\t'%s'\t'%s'", elt.id, type, state, store, elt.name);
|
||||||
else
|
else
|
||||||
ndbout_c("%-5d %-20s %-8s %-7s %s", elt.id, type, state, store, elt.name);
|
ndbout_c("%-5d %-20s %-8s %-7s %s", elt.id, type, state, store, elt.name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NDB_STD_OPTS_VARS;
|
NDB_STD_OPTS_VARS;
|
||||||
|
@ -196,6 +210,9 @@ static struct my_option my_long_options[] =
|
||||||
{ "unqualified", 'u', "Use unqualified table names",
|
{ "unqualified", 'u', "Use unqualified table names",
|
||||||
(gptr*) &_unqualified, (gptr*) &_unqualified, 0,
|
(gptr*) &_unqualified, (gptr*) &_unqualified, 0,
|
||||||
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
|
{ "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE",
|
||||||
|
(gptr*) &_parsable, (gptr*) &_parsable, 0,
|
||||||
|
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
|
||||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
static void usage()
|
static void usage()
|
||||||
|
|
Loading…
Reference in a new issue