Commit Graph

276 Commits

Author SHA1 Message Date
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
a598148afc Merge branch 'export-mongodb-json' of github.com:rutsky/mdbtools into mdb-exportjson 2020-09-02 09:18:52 -04:00
Evan Miller
9a0abb43ae Fix GCC warnings 2020-09-01 22:43:10 -04:00
Evan Miller
c76fad6356 Add ancient mdb-queries tool by Leonard Leblanc
Modified to run with modern libmdb.

See: https://github.com/mdbtools/mdbtools/issues/122
2020-09-01 22:34:55 -04:00
Evan Miller
cea7553e00 Export fakeglib symbols from main library 2020-08-31 13:27:08 -04:00
Evan Miller
be888e0dd7
Support fuzz testing (#4)
Quickstart (requires Clang 6 or later):

$ export LIB_FUZZING_ENGINE=/path/to/fuzzing/library.a
$ ./configure --enable-fuzz-testing
$ make
$ cd src/fuzz
$ make fuzz_mdb
$ ./fuzz_mdb

Also add a new `mdb_open_buffer function` to facilitate in-memory
fuzz-testing. This requires fmemopen, which may not be present on all
systems. The internal API has been reworked to use file streams instead
of file descriptors. This allows reading from memory and reading from
files using a consistent API.
2020-08-31 13:03:58 -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
3c6c8e07db Make mdb-count case-insensitive to table names
This matches the behavior of mdb-export. Thanks to Nicholas Crookston.
2020-08-13 06:32:41 -04:00
Nyall Dawson
1639283779 Fix int/guint comparison warnings 2020-08-12 13:04:20 +10:00
Evan Miller
d4f7bd6ec5 Remove mdb-check
This program is not built by default, and its functionality is covered
by the other utilties.
2020-08-10 06:58:05 -04:00
Evan Miller
7690ef376f Turn off -Wsign-compare for the lexer
Flex doesn't like it.
2020-08-09 16:23: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
18de0070af New --disable-glib configure option
This option uses the fake GLib shim even when GLib is present on the
system.
2020-08-05 20:36:20 -04:00
Evan Miller
68d3a22e77 Merge branch 'master' into no-glib 2020-08-05 18:49:24 -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
ce9ad2920d Merge branch 'master' into no-glib 2020-08-05 17:10:10 -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
Evan Miller
7436fa0e0e Yet another attempted cygwin fix 2020-08-05 09:53:41 -04:00
Evan Miller
bcc6defe94 Merge branch 'master' into no-glib 2020-08-04 23:53:50 -04:00
Evan Miller
679c90141f Improve error message 2020-08-04 15:10:23 -04:00
Evan Miller
65b3701d67 Fix building utilities with GLib present 2020-08-04 08:02:10 -04:00
Evan Miller
e9f4c6c786 Remove GLib dependency WIP
Add a shim implementing half-assed versions of most of the GLib
functions used by MDB Tools. If GLib is detected at compile-time,
use it, otherwise use the shim.

This work is not complete, as the option-parsing code is not yet
implemented - so most of the command-line tools crash.
2020-08-03 17:19:40 -04:00
Evan Miller
a2fa34c0cb Merge https://github.com/Kaukov/mdbtools 2020-08-03 16:55:40 -04:00
Evan Miller
61d928ea68 Fix warning when compiling without Readline 2020-08-03 15:13:11 -04:00
Peter Kaukov
55858b6fe1 Fix flex library linking 2019-07-13 23:56:32 +03:00
VJ
c8fd67bf84 Fix more warnings as a result of #14 2019-05-31 21:59:37 -04:00
Evan Miller
0e9c1810f1 Improved support for Access 2010, 2013, and 2016
Some Access 2010 files use 0x03 as the version number rather than
0x0103. For this reason I have changed the call to mdb_get_int32 to
mdb_get_byte.

In addition, according to the Library of Congress page:

https://www.loc.gov/preservation/digital/formats/fdd/fdd000463.shtml

Access 2016 uses 0x05 as the version number. I have inferred from the
Wikipedia page that Access 2013 likely uses 0x04.
2018-03-05 06:39:57 -05:00
Cyber Emissary
3a245f13d5 Merge branch 'mdb-count' of https://github.com/kodonnell/mdbtools 2018-02-12 16:22:52 -05:00
Cyber Emissary
278f9ba441 Implemented bulk insert 2018-02-12 15:21:15 -05:00
Bruce Johnson
5bfd423e19 Update mdb_index_hash_text() call to match latest signature 2018-01-19 05:51:00 -05:00
kodonnell
b92f4cc882 added (trivial) mdb-count utility 2017-02-05 08:56:24 +13: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
23bab7c2d6 add support for LIMIT clause in SQL engine 2016-08-30 08:43:34 -04: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
584119e415 Split bash-completion snippet in small ones
/usr/share/bash-completion/completions/ now uses dynamic loading based on file name.
2015-05-30 15:40:58 +02:00
William Rogers
82e3436494 Corrected memory being improperly freed
The memory for sql->bound_values is now freed by mdb_sql_reset, so these values no longer should be freed in dump_results_pp.  Also, this fixes a memory leak that was occurring when results were not being pretty printed.
2015-05-24 17:15:52 -05:00
William Rogers
9276aca347 Consolidated calls to mdb_sql_reset
SQL engine was being reset in both dump_results functions.  Rather than having several different functions responsible for resetting the engine depending on the circumstances, the reset now only occurs in run_query, the same function where the query is executed.
2015-05-24 17:05:41 -05:00
Vladimir Rutsky
3216c8de03 output all non-binary fields as unicode strings and binary fields as MongoDB extended JSON binary field
Now mdb-exportjson output can be successfully imported into MongoDB with
mongoimport even if:

 * columns have unicode names
 * there are fields of binary types (e.g. OLE)
2015-02-19 21:05:49 +03:00
Vladimir Rutsky
f894cc708f add base64 encoding implementation from Wikibooks
Source <https://en.wikibooks.org/wiki/Algorithm_Implementation/Miscellaneous/Base64>.

Licensed probably under CC-BY-SA. Compatibility with mdb-tools GPL
license should be checked.
2015-02-19 21:05:49 +03:00
Vladimir Rutsky
bc1483429d use JSON unicode escape \uUUUU instead \xXX for [0, 0x20) characters
JSON specification doesn't allow `\xXX` escape sequences
2015-02-19 21:05:49 +03:00
Vladimir Rutsky
47c0698609 treat only characters with codes in [0, 0x20) range as non-ascii 2015-02-19 21:05:49 +03:00
Vladimir Rutsky
d8cba08493 fix delimiter outputting when some fields values are missing 2015-02-19 20:51:57 +03:00
Vladimir Rutsky
b842480cd5 don't drop non-ascii characters by default
This corresponds to `-A` option description.
2015-02-19 20:48:44 +03:00
Vladimir Rutsky
1758d99d4d Merge PR #52 - mdb-exportjson added 2015-02-19 20:46:33 +03:00
Nirgal Vourgère
13e339c1a4 Clarify usage of --no-comments in mdb-schema 2015-01-12 18:17:50 +01: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
Nirgal Vourgère
2a70e16a8b Allow CFLGAS="-std=c99 -D_POSIX_C_SOURCE=2"
Use glib function:
strcasecmp -> g_ascii_strcasecmp
bzero -> memset
strdup -> g_strdump

Don't use arithmetic void*+int
2014-12-28 12:36:55 +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
Ugo Di Girolamo
5057419da9 Add new binary util - mdb-exportjson
A new binary util for exporting mdb rows as json lines.
This is very useful for importing mdb data to mongo in combination with mongoimport.

The code is vastly similar to the mdb-export but there are enough dissimilarities and disagreement
about flag values that I thought a separate util is warranted.
2014-05-21 22:35:06 -04: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
d9d58d3cae Added bash-completion snipets 2013-10-22 11:01:15 +02: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
088493d499 Update autoconf/automake standards
Generated files config.guess config.sub depcomp install-sh ltmain.sh missing
and ylwrap have been moved to build-aux/

Ran autoupdate

Replaced AC_TRY_LINK/AC_TRY_COMPILE by AC_LINK_IFELSE/AC_COMPILE_IFELSE

Droped -I$(top_srcdir)/include from CFLAGS since AC_CONFIG_HEADERS already
adds the -I

Fixed bison detection

Added AM_PROG_AR as required by autoreconf -i -Wall

Updated NEWS and .gitignore
2013-07-09 18:39:03 +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
William Rogers
28af8d296a Dynamic allocation of MdbSQL->bound_values
Was previously hardcoded to 256 columns max.
2013-06-27 15:09:15 +02:00
Nirgal Vourgère
37cd3ecd2c Fix SEGV if mdb-array is given a bad filename
See bug repport at:
http://www.forallsecure.com/bug-reports/d256a6f86b05b4ca0a1d7097b64e7c6bcd98de6d/
2013-06-26 21:08:24 +02:00
William Rogers
ecc72f8faf mdb_sql_bind_all already in mdb_sql_run_query 2013-06-26 12:13:44 +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
Nirgal Vourgère
f8a3839c7f Misc fixes in prcat and mdb_dump_catalog
Identation
User ACL entries
Show 6 digits for pages #
2012-07-21 13:22:04 +02:00
Nirgal Vourgère
d02eb47531 mdb-tables -T to show entry type 2012-07-07 23:42:14 +02:00
Nirgal Vourgère
a5573ab6d1 Fixed mdb-prop when there is no properties at all
This was printing "Unknown format"
2012-07-07 23:42:08 +02:00
Nirgal Vourgère
b0fb6a4167 Add basic support for Access 2010
Thanks Jakob Egger:
a928a36804
2012-07-07 21:08:25 +02:00
Jean-Michel Vourgère
c566407eaf Experimental support for JET5 .accdb files
Right now, they are handled like JET4 file.
2012-07-03 00:31:23 +02:00
Jean-Michel Vourgère
212337cfaa Renamed _mdb_put_int* into mdb_put_int*
These were the only symbols exported not starting with mdb_
Old names stay available as aliases
Bumped libmdb version to 2.0.1

Added these prototypes to mdbtools.h: Fixes compilation warning

Added mdb_insert_row prototype to mdbtools.h: Fixes compilation warning
2012-07-02 21:38:26 +02:00
Jean-Michel Vourgère
9c74aae165 Fixed some compiler warnings in prindex
Warn and continue if the field referenced by an index can't be found

Removed obsolete args from check_row
2012-07-02 14:48:34 +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
b7200c9b57 Added tests to quiet -Wall compilation 2012-02-02 20:22:30 +01:00
Nirgal Vourgère
69366e198f Warn about unsupported types in mdb-header
Print error message on stderr and returns 1 on failure.
2012-01-30 21:50:26 +01: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
07f915b3c7 Patch utfsql.diff from Nirgal 2011-08-28 19:49:54 -04:00
Nirgal Vourgre
aee657f603 Patch warnings.diff from Nirgal 2011-08-28 19:48:44 -04:00
Nirgal Vourgre
1f2749cdfc Patch bufferdump.diff from Nirgal 2011-08-28 19:43:52 -04:00
Nirgal Vourgre
3e2407044d Patch prop_abi.diff from Nirgal 2011-08-28 19:42:34 -04:00
Nirgal Vourgre
8ef50c444e Patch nosanitize.diff form Nirgal 2011-08-28 18:56:03 -04:00
Nirgl Vourgère
3f26ec69cf Stop exporting internal libmdbsql symbols 2011-08-10 18:02:51 -04:00
Nirgal
456f261cab Bunch of fixes for compilation warnings, mostly unused vars. 2011-08-10 18:00:18 -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
d794c6e2a1 patch default_values from Nirgal Vourgère 2011-02-16 18:59:25 -05:00
Brian Bruns
39277312d4 patch 'schema2' from Nirgal Vourgère 2011-02-16 18:58:22 -05:00
Brian Bruns
6696edf1f8 patch 'props' from Nirgal Vourgère 2011-02-16 18:58:02 -05:00
Brian Bruns
fa83ed0af0 patch 'ole' from Nirgal Vourgère 2011-02-16 18:57:40 -05:00
Brian Bruns
0eea4c148f patch schema-indexes from Nirgal Vourgère 2011-02-16 18:57:05 -05:00
Brian Bruns
586fdebc5c fix exporting of OLE data, from Nirgal Vourgère 2011-02-07 22:08:08 -05:00
Brian Bruns
3adb7d6bab clean up for kkd / mdb-props, from Nirgal Vourgère 2011-02-07 22:06:48 -05:00
Brian Bruns
037b9bc8fc remove cvsignore and add gitignore per Jeff Smith 2010-11-01 09:30:24 -04:00
Brian Bruns
85be8bbe68 patch 180-slowmap-fallback from Nirgal Vourgère 2010-11-01 09:26:46 -04: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