Commit Graph

177 Commits

Author SHA1 Message Date
Evan Miller
2ee83971fa Clean up mdb_clone_handle 2020-08-20 21:57:25 -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
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
Nyall Dawson
e92f14f9c4 Make SQL parser/lexer reentrant
Provides thread safety for mdbtools ODBC driver
2020-08-18 12:23:04 +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
1639283779 Fix int/guint comparison warnings 2020-08-12 13:04:20 +10:00
Evan Miller
3c7761f965 Support --disable-glib flag with ODBC driver 2020-08-10 15:58:22 -04:00
Evan Miller
99099cdada Remove unnecessary "extern" keywords from header files 2020-08-09 16:14:19 -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
514b74744b Try fixing Linux warnings 2020-08-05 23:17:22 -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
05092351df Don't rely on strdup / cygwin fix 2020-08-05 09:35:19 -04:00
Evan Miller
f1af742ecf Another attempted Cygwin fix 2020-08-05 09:22:26 -04:00
Evan Miller
7dcb42eae3 Try fixing Cygwin 2020-08-05 09:00:38 -04:00
Evan Miller
41c7e01ec7 Even more Windows fixes 2020-08-05 08:41:33 -04:00
Evan Miller
8ef1c6e1c3 Provide vasprintf on Windows 2020-08-05 08:26:40 -04:00
Evan Miller
36ba51db7a More Windows fixes 2020-08-05 00:45:14 -04:00
Evan Miller
6771014c49 Windows portability fixes 2020-08-05 00:20:59 -04:00
Evan Miller
fa01a6fe27 Implement g_option_context_get_help (fake GLib)
This fixes the crashing issues, but the command-line tools are still
useless.
2020-08-03 19:55:03 -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
VJ
c8fd67bf84 Fix more warnings as a result of #14 2019-05-31 21:59:37 -04:00
Evan Miller
cdde7c3268 Enable strict prototypes warnings, and fix warnings
If a host project has -Wstrict-prototypes enabled, the mdbtools header
results in warnings. Turn on -Wstrict-prototypes for the whole project
so that these never occur again.
2018-12-29 10:34:54 -05: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
278f9ba441 Implemented bulk insert 2018-02-12 15:21:15 -05:00
leecher1337
e9ec53f6bd Fixing JET4 Index support via libmswstr. Used as a separate library to do it like MS Jet and to ensure that mdbtools library doesn't get tainted with its source. 2017-12-05 00:13:28 +01:00
leecher1337
c81d35f2ea Optimization: Assuming that the index is sorted, I guess an index search can bail out as soon as target value has been found? 2017-12-03 23:25:35 +01:00
leecher1337
4edb48ed17 Bugfixes for JET4 indices. 2017-12-03 23:20:11 +01:00
leecher1337
135f452407
Merge branch 'master' into master 2017-12-03 17:02:15 +01:00
Brian Bruns
23bab7c2d6 add support for LIMIT clause in SQL engine 2016-08-30 08:43:34 -04: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
leecher1337
e2449c11f3 Added strptime function to SQL parser as a feature. This is needed to i.e. be able to query time-fields in DB and to use dates <1.1.1970 and >19.1.2038. All changes should be backwards-compatible to not break existing queries. 2015-08-30 11:23:57 +02:00
leecher1337
16bf355d6b Added simple support for count(*) to SQL parser to quickly get number of rows in table 2015-08-20 14:35:09 +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
7495034eef Fix FSF address in headers 2013-07-04 13:50:33 +02:00
Nirgal Vourgère
eefddaffcc Don't distribute mdbprivate.h and mdbodbc.h
mdbprivate is.... private.

mdbodbc.h has no reason to be public: People who want to use the plugin
should use the public odbc.h headers. And having this private will permit
hdbc cleanup.
2013-07-03 11:59:28 +02:00
Nirgal Vourgère
0196d34d7b __attribute__ change into macro
Makes it easier to port to another compiler.
Thanks Jimmy Taker
2013-06-28 01:51:52 +02:00
Jimmytaker
46005ae009 MDB_DEPRECATED redefined, Constructor MACRO, generate_table_schema changed to not static, date_fmt to ISODate
__attribute__ does not exist in Visual Studio. Therefore replaced wherever it appeared with a macro:
Redefines MDB_DEPRECATED to support Visual Studio
Define a Constructor MACRO so that __attribute__((constructor/destructor)) behavior is achieved in Visual Studio.

Just using generate_table_schema through mdb_print_schema deletes the purpose of a very good tool. generate_table_schemas is a rewrite of generate_table_schema but sends the data to a char* instead of FILE*. There is NO fmemopen() or similar in Visual Studio, so there is NO way to access memory through a FILE* except for first writing to the disk and then reading from the disk in memory.

I cannot suggest how to handle the case when td == 0 for the dates. The databases I work with often have just 00:00:00 in the DateTime column which is not consistent with the rest of the column either, but I have to deal with it somehow.

Leaving void* where char* is needed as a function parameter returns a compilation error in Visual Studio.
2013-01-14 19:27:53 +01:00
Nirgal Vourgère
a972c1638d merge with master 2013-01-14 14:20:10 +01:00
Nirgal Vourgère
eeadcb54f3 Use macros for depreacated function attributes
This will help porting on compilers that don't support it
2013-01-13 23:50:42 +01: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
Jimmytaker
6df0aa6ce0 Port to Windows and SQLite Extension 2012-12-31 20:40:12 +01:00
Nirgal Vourgère
5f09513c85 Deprecate more mdb_{init|remove}_backends
These functions now use the __attribute__((constructor)) & destructor.
Old names were keep for compatibility

Also put __attribute__((deprecated)) in mdbtools.h for all deprecated
functions.
2012-08-09 14:55:17 +02: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
f587d30995 Remaining gmdb2 info data from properties
New method mdb_get_catalogentry_by_name()
Bumped libmdb version from 2.0.1 to 2.1.0
2012-07-08 02:24:42 +02:00
Nirgal Vourgère
b0fb6a4167 Add basic support for Access 2010
Thanks Jakob Egger:
a928a36804
2012-07-07 21:08:25 +02:00