Commit Graph

562 Commits

Author SHA1 Message Date
Evan Miller
f0d435ecdb Use TLS macro for cross-platform thread-local storage 2021-09-08 09:09:03 -04:00
Evan Miller
16b2970931
Merge pull request #344 from nyalldawson/repid_odbc_str2
Customizable UUID format with mdb_uuid_to_string_fmt()
2021-08-30 09:17:25 -04:00
Nyall Dawson
98ef4a1663 [odbc] Ensure repid field formatting matching Microsoft Access ODBC
driver formatting of these fields (i.e. without surrounding {} braces)
2021-08-30 09:34:29 +10:00
Evan Miller
92dc91bfe8
Merge pull request #343 from nyalldawson/fix_index_read_errors
Fix accidental reads of non-index data as indices
2021-08-29 07:20:27 -04:00
Nyall Dawson
d94796d79b Fix accidental reads of non-index data as indices
Follow up be2a287f5c - it's hard to be sure from the commit message,
but I suspect the intention here was to reduce the number of indices
read in that particular situation, instead of allowing replacing
the number of real indices read direct from the table definition
with a larger number.

In any case, omitting a possible index definition which exists
is a safer approach then trying to read an index from non-index data.

Fixes #335
2021-08-29 16:22:34 +10:00
Nyall Dawson
dccc88b722 Fix incorrect conversion of double values
Fixes #339
2021-08-29 15:31:00 +10:00
Nyall Dawson
036f9b95c6 Handle sql queries where a double column is compared to an int
eg "my_double_column" = 123
2021-08-26 23:54:06 -04:00
Nyall Dawson
f4ca6b9e57 Handle sql queries where an integer column is compared to a double value
(e.g. "my_int_column" = 123.0)
2021-08-26 23:54:06 -04:00
Nyall Dawson
fa336fd325 Handle sql queries using REP_ID columns 2021-08-26 20:17:39 -04:00
Evan Miller
d3eea5f38e Simplify some locale_t code 2021-08-22 12:20:13 -04:00
Nyall Dawson
fadd536e2e
Add support for <> SQL operator (#329) 2021-08-22 00:28:29 -04:00
Evan Miller
49ee8272ab Remove _GNU_SOURCE (rely on AC_USE_SYSTEM_EXTENSIONS) 2021-08-20 08:23:24 -04:00
Evan Miller
89c7aa27b4 Fix create/drop incorrect argument order
Fixes #328
2021-08-20 08:03:44 -04:00
Evan Miller
7fb7660b09 Restore previous mdb_register_backend API
Add new mdbi_register_backend2 function with the features introduced in
PRs #321 and #322. The purpose is to prevent API/ABI breakage in the
1.0 release.
2021-08-19 06:23:16 -04:00
Nyall Dawson
cfbca2af03
Copy date formats when cloning handle (#326)
Fix date format for odbc handles get reset to default date format
for backend when handle is cloned
2021-08-18 22:08:07 -04:00
Evan Miller
a803abe1cf Change #if to #ifdef in a couple places 2021-08-04 15:55:20 -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
4b5ff01a59 Corrected the name of generated PostgreSQL boolean data type (https://www.postgresql.org/docs/13/datatype-boolean.html) 2021-08-01 18:00:28 +01:00
Jose Hernandez
f7b13bd4a7 Changed the definition of gssize and fixed some memory leaks following code review. 2021-08-01 17:49:21 +01: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
Jose Hernandez
cec507b967 Introduced customised "create table" DDL statements per database type and made table creation statement in PostgreSQL idempotent so that the DDL generated by mdbtools works nicely with database versioning tools such as flyway or liquibase. 2021-07-31 13:34:08 +01:00
Evan Miller
f79f942d1f Fix RC4 decryption on big-endian platforms 2021-07-17 10:13:24 -04:00
Evan Miller
fe77bc5c8e Remove uses of ntohl 2021-07-14 09:33:24 -04:00
Evan Miller
2be2ab711e Remove tautological comparison
Fixes warnings with some versions of GCC
2021-06-10 09:50:51 -04:00
Evan Miller
d72e6381fe Fix build on some ancient systems 2021-06-03 10:05:18 -04:00
Evan Miller
a31a95056d Simplify logic 2021-06-02 09:16:55 -04:00
Benedikt Reinartz
9401d3cd84 Rename function to mdbi_rc4 to prevent it from being exported 2021-05-19 07:45:43 +02:00
Benedikt Reinartz
ee5789ebc7 Review comments 2021-05-18 12:22:51 +02:00
Benedikt Reinartz
5fb273fb60
Fix accidental include 2021-05-17 15:47:59 +02:00
Benedikt Reinartz
89ce71637c Re-encrypt pages on write 2021-05-17 07:27:49 +02:00
Benedikt Reinartz
873c6a027e Extract RC4 code to separate file 2021-05-17 07:21:44 +02:00
Evan Miller
31a075e08b Remove function pointer casts 2021-04-25 11:23:38 -04:00
Benedikt Reinartz
e2b722ed46
Adjust loop callback signatures
`GFunc` is `void (gpointer, gpointer)` and `GHFunc` is `void (gpointer, gpointer, gpointer)`,
so the respective callback functions should have the same signature.
2021-04-25 12:47:33 +02:00
Evan Miller
05bee0c69f Remove unnecessary _XOPEN_SOURCE
This was originally intended to expose strptime, which is no longer
(never?) used  by data.c
2021-04-16 13:04:40 -04:00
Evan Miller
ceb65d6ece Conditionally define _XOPEN_SOURCE
Fixes #298
2021-04-13 07:19:19 -04:00
Evan Miller
fe0175aa63
Migrate to g_memdup2 (#288)
With fakeglib and older versions of GLib, fall back to g_memdup with
a #define inside mdbprivate.h.

Fixes #287
2021-04-05 09:04:29 -04:00
Evan Miller
d8a81c49a3
Merge pull request #277 from mdbtools/access-2019
Support Access 2019
2021-03-24 09:28:00 -04:00
Ulrich Weber
970023c4e6 fix segfault in SQLGetTypeInfo due pyodbc
dont access pages in mdb_fetch_row when pdata is not initialized.

Happens when a client, e.g. pyodbc, queries for an unsupported type,
e.g. SQL_WVARCHAR, temp_table is empty and further access to it will crash.

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff70fe3df in mdb_fetch_row (table=0xa74610) at data.c:467
467				rows = mdb_get_int16(

Backtrace:
0  0x00007ffff70fe3df in mdb_fetch_row (table=0xa74610) at data.c:467
1  0x00007ffff77f8746 in SQLFetch (hstmt=0xa70500) at odbc.c:1074
2  0x00007ffff7729b43 in SQLFetch () from /lib/x86_64-linux-gnu/libodbc.so.2
3  0x00007ffff778d545 in GetColumnSize (cnxn=0x7ffff77eb1f0, cnxn=0x7ffff77eb1f0, psize=0x7ffff77bde00, sqltype=-9) at src/cnxninfo.cpp:81
4  CnxnInfo_New (cnxn=0x7ffff77eb1f0) at src/cnxninfo.cpp:145

Signed-off-by: Ulrich Weber <ulrich.weber@gmail.com>
2021-03-24 13:09:48 +00:00
Evan Miller
8f1f080e3f Support Access 2019
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.
2021-03-23 15:56:39 -04:00
HenriHakonen
d8a0d279e4
Update write.c
This way fwrite returns length. mdb_crack_row takes size instead of end.
2021-03-23 17:17:35 +02:00
Evan Miller
735351d0cb Fix signed-unsigned comparison
Fixes #269
2021-03-15 17:32:47 -04:00
Evan Miller
ad8c80892b Fix compilation error 2021-03-07 14:36:07 -05:00
Evan Miller
46a65b9789 Fix warning when reading binary properties
Also fix some type-size issues in mdb_col_to_string.

See #262
2021-03-07 09:03:39 -05:00
James Woodcock
2be45a3a0b Implement MySQL relations for schema exports 2021-02-16 19:39:00 +00:00
James Woodcock
8bf8806d4f Implement a MySQL serial type for schema exports 2021-02-16 19:32:27 +00:00
Evan Miller
1bfce353d4 Move mdb_col_to_string warning 2021-02-15 21:25:53 -05:00
Evan Miller
e655cba907 Fix handling of numeric types in ODBC driver
Fixes #255 and supersedes #256
2021-02-15 19:50:15 -05:00
kalpha2
25c39f38d0
Update write.c
added table name and column number to fprintf when invalid data location detected in mdb_crack_row
2021-02-10 15:33:33 +00:00
James Woodcock
a980d73447
mdb-export: handle MySQL blobs (#250)
* 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.
2021-02-03 14:48:56 -05:00
Evan Miller
763716ecc6 Fix unused function warning without iconv 2021-02-02 18:40:40 -05:00