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
* Add [brackets] around mdb-query table names
* Allow column and table names to be in brackets
Column and table names can have whitespace in them. The traditional way
to indicate that is with bracket characters, like so:
```sql
SELECT [column name] FROM [table name]
```
This change updates the parser to allow bracket format -- similar to
double-quoted format -- in all NAME contexts, i.e., column names, table
names, and database names.
Co-authored-by: Patrick Reynolds <patrick.reynolds@github.com>
Per #260 I am assuming that the internal version 6 refers to files
created with Access 2019. I can't find any documentation on this format,
so I am calling it ACE17. Testing welcome.
* Refactor code so BLOBs are always correctly exported
Previously, BLOBs weren't exported from mdb-export correctly if the
backend had MDB_SHEXP_BULK_INSERT set.
* Export MySQL BLOBs correctly
MySQL BLOBs should be in the form 0x[hex values] when inserting them
with the mysql command line tool.
* MySQL needs a BLOB to store exported MDB_OLE values
MDB_OLE size always comes out as 256 bytes, but varbinary(256) is insufficient
to hold all possible OLE data.
By default this will be set to the C locale, but set it to the user's
locale when string comparisons are performed from mdb-sql. Note that
this can be overridden with the LC_COLLATE environment variable.
We could infer the collation locale from the file itself, but this will
likely require a big ball of glue between the Windows locales and Unix
ones.
* MDBOPTS=no_memo is not used anywhere; mark deprecated and print a
warning if enabled
* Mark MDBOPTS=use_index as experimental in the man pages
* MDBOPTS need to be colon separated
* Document new long forms of mdb-queries options
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.
Other programs (e.g. gmdb2) use mdb_print_col, so restore the old enum
names and values. MDB_EXPORT_ESCAPE_INVISIBLE can be OR'ed into the
last argument to enable C-style escaping of text fields.
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
Updated the SQL parser to support "SELECT TOP n [PERCENT]... " queries,
matching the Mocrosoft Access SQL language.
Export these queries from databases with mdb-queries.
* 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