Commit Graph

445 Commits

Author SHA1 Message Date
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
a13936bd77 Support comparisons with MDB_FLOAT and MDB_DOUBLE
See https://github.com/mdbtools/mdbtools/issues/105
2020-09-02 21:24:24 -04:00
Evan Miller
aa0ce8fb3e Consolidate print_col functions into backend.c 2020-09-02 20:38:15 -04:00
Evan Miller
7b5d547acf Merge branch 'mysql-comments' of github.com:mdbtools/mdbtools into merge-164 2020-09-02 15:48:29 -04:00
Evan Miller
0fb33c2eb6 Fix prototype error with GCC 2020-09-02 15:07:13 -04:00
Evan Miller
9f23385a8c New mdb_get_version() function
See https://github.com/mdbtools/mdbtools/issues/138
2020-09-02 14:55:32 -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
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
a08dab706e Fix crash in previous commit 2020-08-21 08:53:05 -04:00
Evan Miller
2ee83971fa Clean up mdb_clone_handle 2020-08-20 21:57:25 -04:00
Evan Miller
4d443840cb Try to fix a crash 2020-08-20 21:31:38 -04:00
Evan Miller
09c497bffd Fix double free with backend dictionary 2020-08-20 20:10:51 -04:00
Evan Miller
6d7a5c79af Merge branch 'master' into backend-thread-safety 2020-08-20 19:53:29 -04:00
Evan Miller
e743949e47 Change char * to const char * 2020-08-20 15:46:06 -04:00
Evan Miller
f668f25d99 Use GCC struct initializers for clarity 2020-08-20 15:37:05 -04:00
Evan Miller
b36f2bff1d Merge branch 'master' into backend-thread-safety 2020-08-20 15:22:52 -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
452cd29343 Get rid of more static memory
* Replace backend_is_init (formerly is_init) with relationships_table

* Remove deprecated functions that used static variables

* Move static "bound" variable to MdbHandle as relationships_values
2020-08-20 08:47:13 -04:00
Evan Miller
588663675e Move backend dictionary and state to MdbHandle
Attempt to make the backend handling logic thread-safe. This removes the
last MDB_CONSTRUCTOR. Also get rid of some JAVA junk and make the
remaining static variables in backend.c constant. Finally remove some
obsolete fields from MdbFile.
2020-08-20 07:58:53 -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
7b51824c89 Consolidate / fix UUID formatting 2020-08-19 20:53:35 -04:00
Evan Miller
9020ca9a1e Attempt to make the ODBC driver thread-safe
I'm not sure if this is a complete solution - some of the global state
has been moved to thread-local storage. So passing an ODBC handle across
threads may have unexpected results. But at least it's not global state.

Each ODBC handle now has its own iconv_t object.

See #23
2020-08-19 15:35:02 -04:00
Evan Miller
1ad0dd2d8b Simplify code 2020-08-18 21:20:40 -04:00
Nyall Dawson
6085a89e1d Use ICONV_CONST 2020-08-13 12:42:32 +10:00
Nyall Dawson
1846fab4e6 Const correctness on src char pointers for unicode/ascii conversion 2020-08-13 12:12:52 +10:00
Nyall Dawson
277b49f209 More warning fixes 2020-08-12 13:11:52 +10:00
Nyall Dawson
1639283779 Fix int/guint comparison warnings 2020-08-12 13:04:20 +10:00
Evan Miller
4ca16b8edf Fix bug in fake g_strsplit
Lack of NULL termination caused an occasional crash
2020-08-10 16:58:11 -04:00
Evan Miller
3c7761f965 Support --disable-glib flag with ODBC driver 2020-08-10 15:58:22 -04:00
Evan Miller
82bbc0cef7 Improved bounds checking 2020-08-09 16:38:25 -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
e7782f7821 Remove debugging comments from mdb-schema 2020-08-06 23:18:05 -04:00
Evan Miller
2e6e88b96f Improve bounds and return-value checking
Fixes a memory leak and a number of buffer overruns
2020-08-06 15:17:04 -04:00
Evan Miller
b01c4b8941 Check result of mdb_find_pg_row / fix crash 2020-08-06 14:14:32 -04:00
Evan Miller
4682ec0f8a Fix crash 2020-08-06 14:08:30 -04:00
Evan Miller
272bd191bc Merge branch 'master' into no-glib 2020-08-06 12:51:52 -04:00
Evan Miller
9b6b52cc8c Fix buffer overflow in mdb_numeric_to_string brianb/mdbtools#124 2020-08-06 12:34:09 -04:00
Evan Miller
c67a92f459 Provide NUMERIC type in Postgres backend brianb/mdbtools#129 2020-08-06 08:20:11 -04:00
Evan Miller
edc20bcc39 Merge branch 'master' into no-glib 2020-08-06 08:16:06 -04:00
Evan Miller
c17aeb0826 Remove length specifier from MySQL TEXT types brianb/mdbtools#133 2020-08-06 08:15:06 -04:00
Evan Miller
d0d3060223 Fix program_invocation_short_name on Cygwin 2020-08-05 23:59:58 -04:00
Evan Miller
7c324a9cb4 Fix warnings 2020-08-05 23:48:49 -04:00
Evan Miller
8bacbf1678 Fix unused result warning 2020-08-05 23:27:19 -04:00
Evan Miller
04b736c9ff Fix indentation warnings 2020-08-05 23:22:08 -04:00
Evan Miller
514b74744b Try fixing Linux warnings 2020-08-05 23:17:22 -04:00
Evan Miller
fe28ce8d25 Fix vasprintf warning with GCC 2020-08-05 23:07:13 -04:00
Evan Miller
cb7bd54c92 Merge branch 'master' into no-glib 2020-08-05 23:03:49 -04:00
Evan Miller
0407fc3a8d Fix type-pun warning 2020-08-05 23:03:10 -04:00