Commit Graph

32 Commits

Author SHA1 Message Date
Evan Miller
49ee8272ab Remove _GNU_SOURCE (rely on AC_USE_SYSTEM_EXTENSIONS) 2021-08-20 08:23:24 -04:00
Evan Miller
a44a8ed8ae Postgres-style ILIKE operator (with Unicode support) (#244)
Access's `LIKE` is actually case-insensitive, but to prevent breaking existing
programs that rely on mdbtools' case-sensitive behavior, introduce a new
`ILIKE` operator to perform a case-insensitive match. Use GLib's `g_utf8_casefold`
to make the comparison UTF-8 aware. A "poor man's" version is implemented
in fakeglib, which relies on `towlower`, and won't work with multi-grapheme
case transformations (e.g. German Eszett).

Fixes #233
2021-08-04 14:45:31 -04:00
Jose Hernandez
afc6f4888b Added support for name normalisation when generating code for PostgreSQL so that generated artefact names are consistently exported in lowercase. 2021-08-01 15:26:40 +01:00
Evan Miller
4e969425ac Add (fake) g_unichar_to_utf8 2021-01-22 07:45:47 -05:00
Evan Miller
468502bc87 Terminate string 2021-01-21 23:16:33 -05:00
Evan Miller
0aa3aeee42 Simplify (fake) g_locale_to_utf8
Use mbstowcs and a manual UTF-8 conversion so we don't have to sniff
the locale and require iconv.
2021-01-21 23:08:55 -05:00
Evan Miller
0e3a627ee6 Make command-line arguments locale-aware (#237)
GLib will automatically convert command line options to UTF-8 provided that setlocale(LC_TYPE, "") is called first, and the argument type is STRING (but not FILENAME). Update the CLI tools to take advantage of this behavior, and likewise implement it in fakeglib.

GLib does not automatically convert non-option arguments (i.e. everything remaining in argv after option processing), so manually call g_locale_to_utf8 on these arguments when they represent table names. This should fix the CLI tools when processing non-ASCII table names in non-UTF-8 locales. Also update fakeglib to implement a fast and loose version of g_locale_to_utf8, and factor out some of the code page => iconv name logic in iconv.c so it can be used in our fake g_locale_to_utf8. This adds a new symbol mdb_iconv_name_from_code_page that is not advertised in the main header file. I did not want to include mdbtools.h from fakeglib.c, but maybe that's not important.
2021-01-14 17:34:50 -05:00
Evan Miller
2becb08714 Windows GitHub Action (#231)
* Migrate the Windows Msys2 build from Appveyor to GitHub Actions
* Fix build with newer versions of Msys2 (fix `vasprintf` conflict)
* Enable SQL tests on the Cygwin build on Appveyor
* Fix an error message about Bison not being available when in fact Flex was not available
* Don't fail fast with Mac and Linux GitHub Actions
2020-12-23 09:34:21 -05:00
Evan Miller
6e08ad5ae9 Add copyright info for fakeglib 2020-09-05 10:49:56 -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
277b49f209 More warning fixes 2020-08-12 13:11:52 +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
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
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
7436fa0e0e Yet another attempted cygwin fix 2020-08-05 09:53:41 -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
1d7d3c39d2 Maybe finally fix Windows builds 2020-08-05 08:32:48 -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
4f481000a8 Fix logic error / warning in fake g_list_remove 2020-08-05 00:27:03 -04:00
Evan Miller
6771014c49 Windows portability fixes 2020-08-05 00:20:59 -04:00
Evan Miller
f9a0234cf4 Support long-style options (fake GLib) 2020-08-03 23:58:33 -04:00
Evan Miller
255b38d7fd Implement g_option_context_parse for short options
Use getopt under the hood for old-fashioned argument parsing. Still need
to add support for --long-style-options.
2020-08-03 22:13:13 -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