Commit Graph

76 Commits

Author SHA1 Message Date
Evan Miller
ebb049eb6a Rename --escape-c to --escape-invisible 2020-12-21 09:30:02 -05:00
Evan Miller
bc97306d64 Merge branch 'master' of github.com:dragonfly-science/mdbtools into merge-108
Merge in pull request #108 with a few changes:

* Use the newer mdb_print_col function

* Redefine the last argument of mdb_print_col to be a flags argument

* Rename and redefine the BINEXPORT enums. While technically public,
  these were never intended as a public API.

* Name the command line option --escape-c
2020-12-19 13:21:32 -05:00
James Woodcock
de4f5516b7 Handle errors from mdb_bind_column() 2020-10-31 09:46:00 +00:00
Nirgal Vourgère
c7d527fdeb mdb-export: Rename --backend into --insert 2020-10-25 12:09:51 +01:00
Nirgal Vourgère
ea478f3bc6 mdb-export: reorder options, man, bash-completion 2020-10-25 11:24:28 +01:00
Evan Miller
7f7761e884 Improved support for "Short Date" fields
* Separate -D (date only) and -T (date/time) format options in mdb-export and mdb-json

* New public mdb_set_shortdate_fmt() function in libmdb

* New private(ish) mdb_col_is_shortdate() function

I'm calling it "shortdate" in order to preserve the existing API.

See https://github.com/mdbtools/mdbtools/issues/12
2020-09-02 22:14:57 -04:00
Evan Miller
0023e4efe4 Update options documentation [CI SKIP] 2020-09-02 21:33:49 -04:00
Evan Miller
aa0ce8fb3e Consolidate print_col functions into backend.c 2020-09-02 20:38:15 -04:00
Evan Miller
fb960553e6 New mdb_set_bind_size function overrides MDB_BIND_SIZE
This should fix long-standing complaints about the default bind size
without causing undue memory inflation in existing applications.

Could make this adjustable on the command line later.

Supersedes:

https://github.com/mdbtools/mdbtools/pull/137
2020-09-02 14:30:07 -04:00
Evan Miller
b7dd44d0d4
Merge pull request #42 from evanmiller/mdb-exportjson
mdb-json tool
2020-09-02 12:05:02 -04:00
Evan Miller
0f5bbdf96c Rename tool to mdb-json and use modern option parsing 2020-09-02 11:47:50 -04:00
Evan Miller
01711b49f4 Merge branch 'hexbinaryexportmode' of github.com:davidhicks/mdbtools into export-hex 2020-09-02 09:53:50 -04:00
Evan Miller
90ee7bfcb5 Remove references to dmalloc
There are more modern tools for memory debugging, get rid of DMALLOC
crap in the source code.

I've left one reference in backend.c to prevent a merge conflict but
this can be removed later.
2020-08-20 08:59:08 -04:00
Evan Miller
5d078838ed [API break] Make date/boolean formats thread safe
Store the preferred date and boolean formats in the MdbHandle rather
than in global memory.
2020-08-19 21:26:06 -04:00
Evan Miller
c93156626c Fix all sign-compare warnings
Also flip on -Wsign-compare in the default configuration
2020-08-09 16:15:20 -04:00
Evan Miller
cac3f7aca5 Default to single quotes when exporting to Postgres
See:

brianb/mdbtools#119
brianb/mdbtools#128
2020-08-05 18:27:48 -04:00
Evan Miller
cde53c4332 Respect octal flag in mdb-export brianb/mdbtools#153
The *col_val <= 0 check appears to have been intended to print ASCII
characters as-is. But this is not a good check, and goes against the
documented behavior.
2020-08-05 13:38:50 -04:00
Cyber Emissary
278f9ba441 Implemented bulk insert 2018-02-12 15:21:15 -05:00
Richard Mansfield
62f79ec3f3 Obey -e flag when quoting is disabled 2017-01-31 10:50:56 +13:00
Edward Abraham
4f10f09df8 Escape troublesome characters using a -e flag, following comment on issue #40 2017-01-26 17:26:01 +13:00
Brian Bruns
15230b5b73 Merge pull request #94 from ewen-naos-nz/boolean_data_as_words
mdb-export: Add boolean words option (TRUE/FALSE)
2016-08-29 09:40:51 -04:00
Joshua Short
e85c3438ec Adding option to for user-defined NULL token in CSV output (not sure if it should be escaped..) 2016-08-01 09:11:21 -07:00
Ewen McNeill
8b1db6c08e mdb-export: Add boolean words option (TRUE/FALSE)
Adds "-B" (--boolean-words) option to mdb-export, which will reconfigure
mdb/data.c to export TRUE/FALSE for boolean values instead of 1/0.  The
option is needed to support BOOLEAN fields on PostgreSQL, which will not
implicitly cast bare 1/0 into a BOOLEAN value.  Value literals are the
SQL TRUE/FALSE, and _quoted_ words meaning true/false and _quoted_
'1'/'0'.  With this flag the SQL TRUE/FALSE values are output, which should
work with several SQL databases.

PostgreSQL Reference:

http://www.postgresql.org/docs/current/static/datatype-boolean.html
2016-04-07 08:45:06 +12:00
Nirgal Vourgère
072f7c6518 Decrease POSIX required level to 1
One can now compile with CFLAGS="-std=c99 -D_POSIX_C_SOURCE=1 -pedantic"

Trade getopt.h function for glib equivalents:
This mean all utilities now have long option names.
Adjust manuals and bash_completion accordingly.

Added missing manual and bash_completion for mdb-import.
2014-12-29 13:12:23 +01:00
David Hicks
f2890dc1d0 Add hexadecimal binary output conversion option
This commit adds another binary output conversion option to convert
binary blobs into hexadecimal notation, similar to the output of the
following command:
  xxd -p binaryfile.bin | tr -d '\n'

(In other words, a single line string of hexadecimal characters
representing a binary blob)

When exporting SQL INSERT statements for SQLite and PostgreSQL and when
the hexadecimal notation is specified with 'mdb-export -b hex ...',
special consideration is given to ensure that binary blobs are safely
written to the SQLite or PostgreSQL database.

Signed-off-by: David Hicks <david@hicks.id.au>
2014-06-29 04:12:06 +10:00
Nirgal Vourgère
dfd752ec02 Spelling fix
Suppress has 2 p in English, thanks lintian.
2014-01-04 15:16:46 +01:00
Nirgal Vourgère
7841d30d43 Revert use of config.h
Revert
7162e8db74
088493d499

And drop AC_CONFIG_HEADERS so that config goes though the command line.
No longer generating config.h, update .gitignore
2013-07-15 02:42:12 +02:00
Nirgal Vourgère
7162e8db74 Include config.h in all .c files
Need to be the first file since it may define large files support
and other options.
2013-07-04 10:53:13 +02:00
Nirgal Vourgère
8a545120d7 Migrate mdb-export changes to gmdb2
Support for octal/stip of binary
Customisation of escape string
Quoting is done according to types rather that empiric analysis of str
conversion.
2013-01-13 21:20:00 +01:00
Nirgal Vourgère
7e8ae9b121 print_col new FILE* outfile parameter
TODO: Merge that code with the one in gmdb2
2012-12-09 13:10:09 +01:00
Nirgal Vourgère
915eeb61d4 mdb-export -b octal: Encode \0 too 2012-12-03 15:35:14 +01:00
Nirgal Vourgère
a66531c74a Added option to choose how to export blobs
Supported modes are:
- strip (don't export)
- raw (compatibility)
- octal (export as \ooo)

Note that gmdb2 dialog where updated, but not the code. Many fixes to do
there first :/
2012-12-02 20:52:21 +01:00
Nirgal Vourgère
f6cd70494c Automatically init/exit libmdb code
mdb_init() and mdb_exit() are now deprecated.
2012-07-22 02:29:04 +02:00
Will Daniels
04b6cf5232 Export REPID as string & use char(38) in mysql 2012-06-29 02:28:51 +02:00
Nirgal Vourgère
7e34078bcc Fix namespace in mdb-export when using -I
Thanks George L. Emigh for the bug report.
2012-01-30 11:41:04 +01:00
Nirgal Vourgre
dd0f4c3819 Patch docs.diff from Nirgal 2011-08-28 19:53:29 -04:00
Nirgal Vourgre
8ef50c444e Patch nosanitize.diff form Nirgal 2011-08-28 18:56:03 -04:00
Brian Bruns
5e4e31d1c9 format security patch from Nirgal Vourgère 2011-03-20 15:26:52 -04:00
Brian Bruns
b4238ac88f patch 'export' from Nirgal Vourgère 2011-02-21 14:11:41 -05:00
Brian Bruns
39277312d4 patch 'schema2' from Nirgal Vourgère 2011-02-16 18:58:22 -05:00
Brian Bruns
fa83ed0af0 patch 'ole' from Nirgal Vourgère 2011-02-16 18:57:40 -05:00
Brian Bruns
586fdebc5c fix exporting of OLE data, from Nirgal Vourgère 2011-02-07 22:08:08 -05:00
Brian Bruns
5ac44b69d9 patch from Terry Brown <terry_n_brown at yahoo.com> to add -N option to mdb-export 2010-08-03 20:09:37 -04:00
Brian Bruns
30e5a6f4bb Debian patch 150-backend-quote from Nirgal Vourgère 2010-06-20 16:27:42 -04:00
Brian Bruns
7a073df76e Patch 155-blob from Nirgal Vourgère 2010-06-17 22:12:44 -04:00
Brian Bruns
789f7803fc Debian patch 110-export-csv-null 2010-06-16 23:42:17 -04:00
brianb
5f6fc1cb9f bug #1398003. Sanitize column names when -S is given without -I 2007-03-06 01:16:54 +00:00
whydoubt
bc80bddf2b Fix typo in help text 2006-05-24 00:41:52 +00:00
brianb
a443e83ae7 Clean up for 0.6 release and some bug fixes 2005-09-07 23:27:43 +00:00
whydoubt
76c5cfe8c2 Fix a couple of leaks 2005-03-13 21:29:17 +00:00