mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-08-20 08:18:36 +08:00
parent
9e85bc4153
commit
f99c5539e7
@ -3,6 +3,7 @@ NAME
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-count file table
|
mdb-count file table
|
||||||
|
mdb-count --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-count is a utility program distributed with MDB Tools.
|
mdb-count is a utility program distributed with MDB Tools.
|
||||||
@ -10,6 +11,7 @@ DESCRIPTION
|
|||||||
It outputs the number of rows in a table.
|
It outputs the number of rows in a table.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
--version Print the mdbtools version and exit.
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ SYNOPSIS
|
|||||||
mdb-export [--no-header] [--delimiter delim] [--row-delimiter delim] [[--no-quote] | [--quote char [--escape char]]] [--escape-invisible] [--date-format fmt] [--datetime-format fmt] [--bin strip|raw|octal|hex] [--boolean-words] database table
|
mdb-export [--no-header] [--delimiter delim] [--row-delimiter delim] [[--no-quote] | [--quote char [--escape char]]] [--escape-invisible] [--date-format fmt] [--datetime-format fmt] [--bin strip|raw|octal|hex] [--boolean-words] database table
|
||||||
mdb-export --insert backend [--namespace prefix] [--batch-size int] database table
|
mdb-export --insert backend [--namespace prefix] [--batch-size int] database table
|
||||||
mdb-export -h|--help
|
mdb-export -h|--help
|
||||||
|
mdb-export --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-export is a utility program distributed with MDB Tools.
|
mdb-export is a utility program distributed with MDB Tools.
|
||||||
@ -29,6 +30,7 @@ OPTIONS
|
|||||||
-0, --null char Use char to represent a NULL value.
|
-0, --null char Use char to represent a NULL value.
|
||||||
-b, --bin strip|raw|octal|hex Binary export mode: strip binaries, export as-is, output \\ooo style octal data or output \\xx style hexadecimal data.
|
-b, --bin strip|raw|octal|hex Binary export mode: strip binaries, export as-is, output \\ooo style octal data or output \\xx style hexadecimal data.
|
||||||
-B, --boolean-words Use TRUE/FALSE in Boolean fields (default is 0/1).
|
-B, --boolean-words Use TRUE/FALSE in Boolean fields (default is 0/1).
|
||||||
|
--version Print the mdbtools version and exit.
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
Most of the formatting options actually also works with --insert.
|
Most of the formatting options actually also works with --insert.
|
||||||
|
|||||||
@ -4,6 +4,7 @@ NAME
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-import [-H lines] [-d char] database table csvfile
|
mdb-import [-H lines] [-d char] database table csvfile
|
||||||
mdb-import -h|--help
|
mdb-import -h|--help
|
||||||
|
mdb-import --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-import is a utility program distributed with MDB Tools.
|
mdb-import is a utility program distributed with MDB Tools.
|
||||||
@ -13,6 +14,7 @@ DESCRIPTION
|
|||||||
OPTIONS
|
OPTIONS
|
||||||
-H, --header lines Skip lines of CSV header.
|
-H, --header lines Skip lines of CSV header.
|
||||||
-d, --delimiter char Specify an alternative column delimiter. Default is , (comma).
|
-d, --delimiter char Specify an alternative column delimiter. Default is , (comma).
|
||||||
|
--version Print the mdbtools version and exit
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ NAME
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-json [-D fmt] [-T fmt] [-U] database table
|
mdb-json [-D fmt] [-T fmt] [-U] database table
|
||||||
mdb-json -h|--help
|
mdb-json -h|--help
|
||||||
|
mdb-json --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-json is a utility program distributed with MDB Tools.
|
mdb-json is a utility program distributed with MDB Tools.
|
||||||
@ -13,7 +14,8 @@ DESCRIPTION
|
|||||||
OPTIONS
|
OPTIONS
|
||||||
-D, --date-format fmt Set the date format (see strftime(3) for details).
|
-D, --date-format fmt Set the date format (see strftime(3) for details).
|
||||||
-T, --time-format fmt Set the date/time format (see strftime(3) for details).
|
-T, --time-format fmt Set the date/time format (see strftime(3) for details).
|
||||||
-U, --no-unprintable Change unprintable characters to spaces (otherwise escaped as \\u00XX)
|
-U, --no-unprintable Change unprintable characters to spaces (otherwise escaped as \\u00XX).
|
||||||
|
--version Print the mdbtools version and exit.
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ NAME
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-prop database name [propcol]
|
mdb-prop database name [propcol]
|
||||||
|
mdb-prop --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-prop is a utility program distributed with MDB Tools.
|
mdb-prop is a utility program distributed with MDB Tools.
|
||||||
@ -13,6 +14,9 @@ DESCRIPTION
|
|||||||
|
|
||||||
propcol is the name of the system table MSysObjects' column containing properties. It defaults to LvProp.
|
propcol is the name of the system table MSysObjects' column containing properties. It defaults to LvProp.
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
--version Print the mdbtools version and exit.
|
||||||
|
|
||||||
ENVIRONMENT
|
ENVIRONMENT
|
||||||
MDB_JET3_CHARSET Defines the charset of the input JET3 (access 97) file. Default is CP1252. See iconv(1).
|
MDB_JET3_CHARSET Defines the charset of the input JET3 (access 97) file. Default is CP1252. See iconv(1).
|
||||||
MDBICONV Defines the output charset. Default is UTF-8. mdbtools must have been compiled with iconv.
|
MDBICONV Defines the output charset. Default is UTF-8. mdbtools must have been compiled with iconv.
|
||||||
|
|||||||
@ -3,6 +3,7 @@ NAME
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-queries [-L] [-1] [-d delim] database query
|
mdb-queries [-L] [-1] [-d delim] database query
|
||||||
|
mdb-queries --version
|
||||||
mdb-queries -h|--help
|
mdb-queries -h|--help
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
@ -13,7 +14,8 @@ DESCRIPTION
|
|||||||
OPTIONS
|
OPTIONS
|
||||||
-L, --list List queries in the database (default if no query name is passed)
|
-L, --list List queries in the database (default if no query name is passed)
|
||||||
-1, --newline Use newline as the delimiter (used in conjunction with listing)
|
-1, --newline Use newline as the delimiter (used in conjunction with listing)
|
||||||
-d, --delimiter delim Specify delimiter to use
|
-d, --delimiter delim Specify delimiter to use (defaults to space)
|
||||||
|
--version Print the mdbtools version and exit
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ NAME
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-schema [options] [-T tablename] [-N prefix] database [backend]
|
mdb-schema [options] [-T tablename] [-N prefix] database [backend]
|
||||||
mdb-schema -h|--help
|
mdb-schema -h|--help
|
||||||
|
mdb-schema --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-schema is a utility program distributed with MDB Tools.
|
mdb-schema is a utility program distributed with MDB Tools.
|
||||||
@ -27,6 +28,7 @@ OPTIONS
|
|||||||
--no-indexes Don't export INDEXes.
|
--no-indexes Don't export INDEXes.
|
||||||
--relations Export foreign keys constraints. This is the default.
|
--relations Export foreign keys constraints. This is the default.
|
||||||
--no-relations Don't export foreign keys constraints.
|
--no-relations Don't export foreign keys constraints.
|
||||||
|
--version Print the mdbtools version and exit.
|
||||||
|
|
||||||
backend Specifies target DDL dialect. Supported values are access, sybase, oracle, postgres, mysql and sqlite. If not specified the generated DDL will be in access format.
|
backend Specifies target DDL dialect. Supported values are access, sybase, oracle, postgres, mysql and sqlite. If not specified the generated DDL will be in access format.
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ NAME
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-sql [-HFp] [-d char] [-i file] [-o file] [database]
|
mdb-sql [-HFp] [-d char] [-i file] [-o file] [database]
|
||||||
mdb-sql -h|--help
|
mdb-sql -h|--help
|
||||||
|
mdb-sql --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-sql is a utility program distributed with MDB Tools.
|
mdb-sql is a utility program distributed with MDB Tools.
|
||||||
@ -23,6 +24,7 @@ specified, columns will be delimited by a tab character if pretty printing
|
|||||||
(-p) is turned off. If pretty printing is enabled this option is meaningless.
|
(-p) is turned off. If pretty printing is enabled this option is meaningless.
|
||||||
-i, --input file Specify an input file. This option allows an input file containing the SQL to be passed to mdb-sql. See Notes.
|
-i, --input file Specify an input file. This option allows an input file containing the SQL to be passed to mdb-sql. See Notes.
|
||||||
-o, --output file Specify an output file. This option allows the name of an output file to be used instead of stdout.
|
-o, --output file Specify an output file. This option allows the name of an output file to be used instead of stdout.
|
||||||
|
--version Print the mdbtools version and exit.
|
||||||
|
|
||||||
COMMANDS
|
COMMANDS
|
||||||
mdb-sql in interactive mode takes some special commands.
|
mdb-sql in interactive mode takes some special commands.
|
||||||
|
|||||||
@ -4,6 +4,7 @@ NAME
|
|||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-tables [-S] [-1 | -d delim] [-t form|table|macro|systable|report|query|linkedtable|module|relationship|dbprop|any|all] [-T] database
|
mdb-tables [-S] [-1 | -d delim] [-t form|table|macro|systable|report|query|linkedtable|module|relationship|dbprop|any|all] [-T] database
|
||||||
mdb-tables -h|--help
|
mdb-tables -h|--help
|
||||||
|
mdb-tables --version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-tables is a utility program distributed with MDB Tools.
|
mdb-tables is a utility program distributed with MDB Tools.
|
||||||
@ -16,6 +17,7 @@ OPTIONS
|
|||||||
-d, --delimiter delim Specifies an alternative delimiter. If no delimiter is specified, table names will be delimited by a tab character, or by newline if the -1 option was specified.
|
-d, --delimiter delim Specifies an alternative delimiter. If no delimiter is specified, table names will be delimited by a tab character, or by newline if the -1 option was specified.
|
||||||
-t, --type type Filters entries to show alternate types. Autorized values are form, table, macro, systable, report, query, linkedtable, module, relationship, dbprop, any, and all. Default value is table.
|
-t, --type type Filters entries to show alternate types. Autorized values are form, table, macro, systable, report, query, linkedtable, module, relationship, dbprop, any, and all. Default value is table.
|
||||||
-T, --showtype Display the entry type indentifier before each entry.
|
-T, --showtype Display the entry type indentifier before each entry.
|
||||||
|
--version Print the mdbtools version and exit.
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@ NAME
|
|||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
mdb-ver database
|
mdb-ver database
|
||||||
mdb-ver -M
|
|
||||||
mdb-ver -h|--help
|
mdb-ver -h|--help
|
||||||
|
mdb-ver -M|--version
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-ver is a utility program distributed with MDB Tools.
|
mdb-ver is a utility program distributed with MDB Tools.
|
||||||
@ -12,8 +12,7 @@ DESCRIPTION
|
|||||||
It will return a single line of output corresponding to the program that produced the file: 'JET3' (for files produced by Access 97), 'JET4' (Access 2000, XP and 2003), 'ACE12' (Access 2007), 'ACE14' (Access 2010), 'ACE15' (Access 2013), or 'ACE16' (Access 2016).
|
It will return a single line of output corresponding to the program that produced the file: 'JET3' (for files produced by Access 97), 'JET4' (Access 2000, XP and 2003), 'ACE12' (Access 2007), 'ACE14' (Access 2010), 'ACE15' (Access 2013), or 'ACE16' (Access 2016).
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
|
-M, --version Print the version of mdbtools (rather than the MDB file) and exit.
|
||||||
-M, --mdbtools Prints the version of MDB Tools itself instead of the MDB file.
|
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
Access changed its format between Jet 3 used in Access 97 and Jet 4 used for Access 2000 and XP. The nature of the changes included moving the page size from 2K to 4K and added support for unicode. MDB Tools actively supports both formats. Newer version are very much like Jet4.
|
Access changed its format between Jet 3 used in Access 97 and Jet 4 used for Access 2000 and XP. The nature of the changes included moving the page size from 2K to 4K and added support for unicode. MDB Tools actively supports both formats. Newer version are very much like Jet4.
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
@ -28,10 +29,39 @@ int main(int argc, char **argv) {
|
|||||||
char *locale = NULL;
|
char *locale = NULL;
|
||||||
char *table_name = NULL;
|
char *table_name = NULL;
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
|
||||||
if (argc < 3) {
|
GOptionContext *opt_context;
|
||||||
fprintf(stderr, "Usage: %s <file> <table>\n", argv[0]);
|
GOptionEntry entries[] = {
|
||||||
return 1;
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
|
{NULL}
|
||||||
|
};
|
||||||
|
opt_context = g_option_context_new("<file> <table> - print the number of records in an Access database");
|
||||||
|
g_option_context_add_main_entries(opt_context, entries, NULL /*i18n*/);
|
||||||
|
locale = setlocale(LC_CTYPE, "");
|
||||||
|
if (!g_option_context_parse (opt_context, &argc, &argv, &error))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "option parsing failed: %s\n", error->message);
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
|
if (argc != 3) {
|
||||||
|
fputs("Wrong number of arguments.\n\n", stderr);
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
table_name = g_locale_to_utf8(argv[2], -1, NULL, NULL, &error);
|
||||||
|
setlocale(LC_CTYPE, locale);
|
||||||
|
if (!table_name) {
|
||||||
|
fprintf(stderr, "Error converting table argument: %s\n", error->message);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// open db and try to read table:
|
// open db and try to read table:
|
||||||
@ -42,13 +72,6 @@ int main(int argc, char **argv) {
|
|||||||
if (!mdb_read_catalog(mdb, MDB_TABLE)) {
|
if (!mdb_read_catalog(mdb, MDB_TABLE)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
locale = setlocale(LC_CTYPE, "");
|
|
||||||
table_name = g_locale_to_utf8(argv[2], -1, NULL, NULL, &error);
|
|
||||||
setlocale(LC_CTYPE, locale);
|
|
||||||
if (!table_name) {
|
|
||||||
fprintf(stderr, "Error converting table argument: %s\n", error->message);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
for (i = 0; i < mdb->num_catalog; i++) {
|
for (i = 0; i < mdb->num_catalog; i++) {
|
||||||
entry = g_ptr_array_index(mdb->catalog, i);
|
entry = g_ptr_array_index(mdb->catalog, i);
|
||||||
if (entry->object_type == MDB_TABLE && !g_ascii_strcasecmp(entry->object_name, table_name)) {
|
if (entry->object_type == MDB_TABLE && !g_ascii_strcasecmp(entry->object_name, table_name)) {
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
#define EXPORT_BIND_SIZE 200000
|
#define EXPORT_BIND_SIZE 200000
|
||||||
|
|
||||||
@ -56,6 +57,7 @@ main(int argc, char **argv)
|
|||||||
int ret;
|
int ret;
|
||||||
char *locale = NULL;
|
char *locale = NULL;
|
||||||
char *table_name = NULL;
|
char *table_name = NULL;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
|
||||||
GOptionEntry entries[] = {
|
GOptionEntry entries[] = {
|
||||||
{"no-header", 'H', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &header_row, "Suppress header row.", NULL},
|
{"no-header", 'H', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &header_row, "Suppress header row.", NULL},
|
||||||
@ -73,6 +75,7 @@ main(int argc, char **argv)
|
|||||||
{"null", '0', 0, G_OPTION_ARG_STRING, &null_text, "Use <char> to represent a NULL value", "char"},
|
{"null", '0', 0, G_OPTION_ARG_STRING, &null_text, "Use <char> to represent a NULL value", "char"},
|
||||||
{"bin", 'b', 0, G_OPTION_ARG_STRING, &str_bin_mode, "Binary export mode", "strip|raw|octal|hex"},
|
{"bin", 'b', 0, G_OPTION_ARG_STRING, &str_bin_mode, "Binary export mode", "strip|raw|octal|hex"},
|
||||||
{"boolean-words", 'B', 0, G_OPTION_ARG_NONE, &boolean_words, "Use TRUE/FALSE in Boolean fields (default is 0/1)", NULL},
|
{"boolean-words", 'B', 0, G_OPTION_ARG_NONE, &boolean_words, "Use TRUE/FALSE in Boolean fields (default is 0/1)", NULL},
|
||||||
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
{NULL},
|
{NULL},
|
||||||
};
|
};
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -88,7 +91,13 @@ main(int argc, char **argv)
|
|||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
fputs("Wrong number of arguments.\n\n", stderr);
|
fputs("Wrong number of arguments.\n\n", stderr);
|
||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
#define MAX_ROW_SIZE 4096
|
#define MAX_ROW_SIZE 4096
|
||||||
|
|
||||||
@ -158,10 +159,12 @@ main(int argc, char **argv)
|
|||||||
FILE *in;
|
FILE *in;
|
||||||
char *delimiter;
|
char *delimiter;
|
||||||
int header_rows = 0;
|
int header_rows = 0;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
|
||||||
GOptionEntry entries[] = {
|
GOptionEntry entries[] = {
|
||||||
{ "header", 'H', 0, G_OPTION_ARG_INT, &header_rows, "skip <rows> header rows", "row"},
|
{ "header", 'H', 0, G_OPTION_ARG_INT, &header_rows, "skip <rows> header rows", "row"},
|
||||||
{ "delimiter", 'd', 0, G_OPTION_ARG_STRING, &delimiter, "Specify a column delimiter", "char"},
|
{ "delimiter", 'd', 0, G_OPTION_ARG_STRING, &delimiter, "Specify a column delimiter", "char"},
|
||||||
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -176,6 +179,13 @@ main(int argc, char **argv)
|
|||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
|
|
||||||
if (!delimiter)
|
if (!delimiter)
|
||||||
delimiter = g_strdup(",");
|
delimiter = g_strdup(",");
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
#include "base64.h"
|
#include "base64.h"
|
||||||
|
|
||||||
@ -115,11 +116,13 @@ main(int argc, char **argv)
|
|||||||
int ret;
|
int ret;
|
||||||
char *table_name = NULL;
|
char *table_name = NULL;
|
||||||
char *locale = NULL;
|
char *locale = NULL;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
|
||||||
GOptionEntry entries[] = {
|
GOptionEntry entries[] = {
|
||||||
{"date-format", 'D', 0, G_OPTION_ARG_STRING, &shortdate_fmt, "Set the date format (see strftime(3) for details)", "format"},
|
{"date-format", 'D', 0, G_OPTION_ARG_STRING, &shortdate_fmt, "Set the date format (see strftime(3) for details)", "format"},
|
||||||
{"datetime-format", 'T', 0, G_OPTION_ARG_STRING, &date_fmt, "Set the date/time format (see strftime(3) for details)", "format"},
|
{"datetime-format", 'T', 0, G_OPTION_ARG_STRING, &date_fmt, "Set the date/time format (see strftime(3) for details)", "format"},
|
||||||
{"no-unprintable", 'U', 0, G_OPTION_ARG_NONE, &drop_nonascii, "Change unprintable characters to spaces (otherwise escaped as \\u00XX)", NULL},
|
{"no-unprintable", 'U', 0, G_OPTION_ARG_NONE, &drop_nonascii, "Change unprintable characters to spaces (otherwise escaped as \\u00XX)", NULL},
|
||||||
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -135,6 +138,13 @@ main(int argc, char **argv)
|
|||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
if (argc != 3) {
|
if (argc != 3) {
|
||||||
fputs("Wrong number of arguments.\n\n", stderr);
|
fputs("Wrong number of arguments.\n\n", stderr);
|
||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
void dump_kkd(MdbHandle *mdb, void *kkd, size_t len);
|
void dump_kkd(MdbHandle *mdb, void *kkd, size_t len);
|
||||||
|
|
||||||
@ -32,10 +33,43 @@ main(int argc, char **argv)
|
|||||||
void *buf;
|
void *buf;
|
||||||
int col_num;
|
int col_num;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
if (argc < 3) {
|
GOptionContext *opt_context;
|
||||||
fprintf(stderr,"Usage: %s <file> <object name> [<prop col>]\n",
|
GOptionEntry entries[] = {
|
||||||
argv[0]);
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
|
{NULL}
|
||||||
|
};
|
||||||
|
opt_context = g_option_context_new("<file> <object name> [<prop col>] - display properties of an object in an Access database");
|
||||||
|
g_option_context_add_main_entries(opt_context, entries, NULL /*i18n*/);
|
||||||
|
locale = setlocale(LC_CTYPE, "");
|
||||||
|
if (!g_option_context_parse (opt_context, &argc, &argv, &error))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "option parsing failed: %s\n", error->message);
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
|
if (argc != 3 && argc != 4) {
|
||||||
|
fputs("Wrong number of arguments.\n\n", stderr);
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
table_name = g_locale_to_utf8(argv[2], -1, NULL, NULL, NULL);
|
||||||
|
if (argc < 4)
|
||||||
|
propColName = g_strdup("LvProp");
|
||||||
|
else
|
||||||
|
propColName = g_locale_to_utf8(argv[3], -1, NULL, NULL, NULL);
|
||||||
|
setlocale(LC_CTYPE, locale);
|
||||||
|
if (!table_name || !propColName) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,17 +78,6 @@ main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
locale = setlocale(LC_CTYPE, "");
|
|
||||||
table_name = g_locale_to_utf8(argv[2], -1, NULL, NULL, NULL);
|
|
||||||
if (argc < 4)
|
|
||||||
propColName = g_strdup("LvProp");
|
|
||||||
else
|
|
||||||
propColName = g_locale_to_utf8(argv[3], -1, NULL, NULL, NULL);
|
|
||||||
setlocale(LC_CTYPE, locale);
|
|
||||||
if (!table_name || !propColName) {
|
|
||||||
mdb_close(mdb);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
table = mdb_read_table_by_name(mdb, "MSysObjects", MDB_ANY);
|
table = mdb_read_table_by_name(mdb, "MSysObjects", MDB_ANY);
|
||||||
if (!table) {
|
if (!table) {
|
||||||
g_free(table_name);
|
g_free(table_name);
|
||||||
|
|||||||
@ -32,6 +32,7 @@
|
|||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
#define QUERY_BIND_SIZE 200000
|
#define QUERY_BIND_SIZE 200000
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ int main (int argc, char **argv) {
|
|||||||
char *sql_sorting = malloc(bind_size);
|
char *sql_sorting = malloc(bind_size);
|
||||||
int flagint;
|
int flagint;
|
||||||
char *locale = NULL;
|
char *locale = NULL;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GOptionContext *opt_context;
|
GOptionContext *opt_context;
|
||||||
@ -76,6 +78,7 @@ int main (int argc, char **argv) {
|
|||||||
{"list", 'L', 0, G_OPTION_ARG_NONE, &list_only, "List queries in the database (default if no query name is passed)", NULL},
|
{"list", 'L', 0, G_OPTION_ARG_NONE, &list_only, "List queries in the database (default if no query name is passed)", NULL},
|
||||||
{"newline", '1', 0, G_OPTION_ARG_NONE, &line_break, "Use newline as the delimiter (used in conjunction with listing)", NULL},
|
{"newline", '1', 0, G_OPTION_ARG_NONE, &line_break, "Use newline as the delimiter (used in conjunction with listing)", NULL},
|
||||||
{"delimiter", 'd', 0, G_OPTION_ARG_STRING, &delimiter, "Specify delimiter to use", "delim"},
|
{"delimiter", 'd', 0, G_OPTION_ARG_STRING, &delimiter, "Specify delimiter to use", "delim"},
|
||||||
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
opt_context = g_option_context_new("<file> <query name> - list or export queries from an Access database");
|
opt_context = g_option_context_new("<file> <query name> - list or export queries from an Access database");
|
||||||
@ -87,6 +90,13 @@ int main (int argc, char **argv) {
|
|||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
/* let's turn list_only on if only a database filename was passed */
|
/* let's turn list_only on if only a database filename was passed */
|
||||||
if(argc == 2) {
|
if(argc == 2) {
|
||||||
list_only=1;
|
list_only=1;
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
/* this utility dumps the schema for an existing database */
|
/* this utility dumps the schema for an existing database */
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
@ -34,6 +35,7 @@ main (int argc, char **argv)
|
|||||||
int opt_indexes = MDB_SHEXP_DEFAULT & MDB_SHEXP_INDEXES;
|
int opt_indexes = MDB_SHEXP_DEFAULT & MDB_SHEXP_INDEXES;
|
||||||
int opt_relations = MDB_SHEXP_DEFAULT & MDB_SHEXP_RELATIONS;
|
int opt_relations = MDB_SHEXP_DEFAULT & MDB_SHEXP_RELATIONS;
|
||||||
int success = 0;
|
int success = 0;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
|
||||||
GOptionEntry entries[] = {
|
GOptionEntry entries[] = {
|
||||||
{ "table", 'T', 0, G_OPTION_ARG_STRING, &tabname, "Only create schema for named table", "table"},
|
{ "table", 'T', 0, G_OPTION_ARG_STRING, &tabname, "Only create schema for named table", "table"},
|
||||||
@ -52,6 +54,7 @@ main (int argc, char **argv)
|
|||||||
{ "no-indexes", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_indexes, "Don't include indexes", NULL},
|
{ "no-indexes", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_indexes, "Don't include indexes", NULL},
|
||||||
{ "relations", 0, 0, G_OPTION_ARG_NONE, &opt_relations, "Include foreign key constraints", NULL},
|
{ "relations", 0, 0, G_OPTION_ARG_NONE, &opt_relations, "Include foreign key constraints", NULL},
|
||||||
{ "no-relations", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_relations, "Don't include foreign key constraints", NULL},
|
{ "no-relations", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &opt_relations, "Don't include foreign key constraints", NULL},
|
||||||
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -67,6 +70,13 @@ main (int argc, char **argv)
|
|||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
|
|
||||||
setlocale(LC_CTYPE, old_locale);
|
setlocale(LC_CTYPE, old_locale);
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,7 @@ extern void clear_history ();
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "mdbsql.h"
|
#include "mdbsql.h"
|
||||||
|
#include "mdbver.h"
|
||||||
|
|
||||||
void dump_results(FILE *out, MdbSQL *sql, char *delimiter);
|
void dump_results(FILE *out, MdbSQL *sql, char *delimiter);
|
||||||
void dump_results_pp(FILE *out, MdbSQL *sql);
|
void dump_results_pp(FILE *out, MdbSQL *sql);
|
||||||
@ -334,6 +335,7 @@ main(int argc, char **argv)
|
|||||||
char *delimiter = NULL;
|
char *delimiter = NULL;
|
||||||
int in_from_colon_r = 0;
|
int in_from_colon_r = 0;
|
||||||
char *locale = NULL;
|
char *locale = NULL;
|
||||||
|
int print_mdbver = 0;
|
||||||
|
|
||||||
GOptionEntry entries[] = {
|
GOptionEntry entries[] = {
|
||||||
{ "delim", 'd', 0, G_OPTION_ARG_STRING, &delimiter, "Use this delimiter.", "char"},
|
{ "delim", 'd', 0, G_OPTION_ARG_STRING, &delimiter, "Use this delimiter.", "char"},
|
||||||
@ -342,6 +344,7 @@ main(int argc, char **argv)
|
|||||||
{ "no-footer", 'F', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &footers, "Don't print footer", NULL},
|
{ "no-footer", 'F', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &footers, "Don't print footer", NULL},
|
||||||
{ "input", 'i', 0, G_OPTION_ARG_FILENAME, &filename_in, "Read SQL from specified file", "file"},
|
{ "input", 'i', 0, G_OPTION_ARG_FILENAME, &filename_in, "Read SQL from specified file", "file"},
|
||||||
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &filename_out, "Write result to specified file", "file"},
|
{ "output", 'o', 0, G_OPTION_ARG_FILENAME, &filename_out, "Write result to specified file", "file"},
|
||||||
|
{"version", 0, 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -357,6 +360,13 @@ main(int argc, char **argv)
|
|||||||
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
|
exit(argc > 1);
|
||||||
|
}
|
||||||
setlocale(LC_CTYPE, locale);
|
setlocale(LC_CTYPE, locale);
|
||||||
|
|
||||||
if (argc > 2) {
|
if (argc > 2) {
|
||||||
|
|||||||
@ -26,12 +26,8 @@ main(int argc, char **argv)
|
|||||||
MdbHandle *mdb;
|
MdbHandle *mdb;
|
||||||
int print_mdbver = 0;
|
int print_mdbver = 0;
|
||||||
|
|
||||||
/* setlocale (LC_ALL, ""); */
|
|
||||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
|
||||||
textdomain (PACKAGE);
|
|
||||||
|
|
||||||
GOptionEntry entries[] = {
|
GOptionEntry entries[] = {
|
||||||
{ "mdbtools", 'M', 0, G_OPTION_ARG_NONE, &print_mdbver, "Show MDBtools version", NULL},
|
{ "version", 'M', 0, G_OPTION_ARG_NONE, &print_mdbver, "Show mdbtools version and exit", NULL},
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
@ -48,9 +44,11 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (print_mdbver) {
|
if (print_mdbver) {
|
||||||
|
if (argc > 1) {
|
||||||
|
fputs(g_option_context_get_help(opt_context, TRUE, NULL), stderr);
|
||||||
|
}
|
||||||
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
fprintf(stdout,"%s\n", MDB_FULL_VERSION);
|
||||||
if (argc == 1)
|
exit(argc > 1);
|
||||||
exit(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc != 2) {
|
if (argc != 2) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user