Commit Graph
100 Commits
Author SHA1 Message Date
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 c2087a95cc Merge pull request #30 from nyalldawson/fix_28
ODBC requires dates formatted in ISO standards
2020-08-20 06:26:17 -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 2887fa49ed Merge pull request #24 from evanmiller/odbc-thread-safety
Make the ODBC driver thread-safe. Multiple simultaneous handles should work fine now, but individual handles should only be used by one thread at at time.
2020-08-19 19:55:29 -04:00
Evan Miller 673c7700b9 Store OLE strings on the statement object
Also cut MDB_OLE out into its own code path. This removes the last of
the global / thread-local storage in the ODBC driver, I think.
2020-08-19 19:24:40 -04:00
Evan Miller 55e0d4ff07 Store sqlState separtely on ODBC env / handle / stmts
Also fix the fact that "08001" was always returned by SQLError instead
of the actual SQL state.
2020-08-19 17:34:57 -04:00
Evan Miller 00b3ab9571 Store statement and handle errors separately 2020-08-19 17:22:54 -04:00
Evan Miller a84c07980f Make lastError thread-safe 2020-08-19 17:03:06 -04:00
Evan Miller e67c8e6d52 Remove obsolete comment about thread safety 2020-08-19 16:32:13 -04:00
Evan Miller 3d63f16fc0 Fix errors
It helps to enable ODBC when testing ODBC :-P
2020-08-19 16:16:25 -04:00
Evan Miller 684fa55781 Fix unused variable warning 2020-08-19 15:50:57 -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
Evan Miller 008b3b462b Merge pull request #22 from nyalldawson/no_crash
Don't crash when a table can't be read for some reason
2020-08-18 21:10:52 -04:00
Evan Miller ab1a253f45 Merge pull request #21 from nyalldawson/fix_19
Fix empty table results
2020-08-18 21:10:11 -04:00
Evan Miller 463fd0af11 Make thread-safety a goal, why not 2020-08-18 12:59:56 -04:00
Evan Miller ea368bc0e3 Require Bison 3.0+ at configure time for SQL features 2020-08-18 10:02:56 -04:00
Evan Miller 2a808d8d05 Fix Travis Mac GCC configurations 2020-08-18 09:34:39 -04:00
Evan Miller 5758cd6861 Try fixing Mac build with explicit Yacc output file 2020-08-18 09:06:17 -04:00
Evan Miller 60c820245d Only set -Wno-yacc if $YACC supports it 2020-08-18 09:05:33 -04:00
Evan Miller 83666459d2 Add test coverage for mdb-sql 2020-08-18 09:04:20 -04:00
Evan Miller 78707f7aa3 Remove second -d flag 2020-08-18 07:48:54 -04:00
Evan Miller ec8492f1ee Try fixing Travis and Appveyor
The new re-entrant parser requires Bison 3, which is not installed
on macOS by default. It also appears to require -Wno-yacc.
2020-08-18 07:32:15 -04:00
Evan Miller 858e1dff49 Merge pull request #16 from nyalldawson/reentrant
Make SQL parser/lexer reentrant
2020-08-18 07:20:35 -04:00
Evan Miller 1e983c70f1 Merge pull request #18 from nyalldawson/fix_limit
Fix LIMIT clause is ignored when executing SQL via ODBC, incorrect behavior with LIMIT 0
2020-08-18 07:02:00 -04:00
Evan Miller 91c6d3048c Merge pull request #17 from nyalldawson/fix_leak
Fix leak after running "SELECT COUNT(*)..." sql query
2020-08-18 06:56:21 -04:00
Evan Miller 4cc7999022 Replace obsolete AC_TRY_LINK with AC_LINK_IFELSE 2020-08-14 07:18:23 -04:00
Evan Miller 6171472411 Change -Bsymbolic-functions to -Wl,-Bsymbolic-functions 2020-08-14 00:12:07 -04:00
Evan Miller dfd41f2283 Try fixing unixODBC deadlock with -Bsymbolic-functions
This flag compels the dynamic library to prefer its own function symbols
to those in the global symbol table. This behavior should let us
directly call SQL* functions from inside other SQL* functions without
fear of interference by the host program.
2020-08-13 21:52:03 -04:00
Evan Miller 4f330ea6be Enable GCC 10 on Travis 2020-08-13 06:44:05 -04:00
Evan Miller 2629ce5136 Appveyor fix 2020-08-13 06:44:00 -04:00
Evan Miller 3c6c8e07db Make mdb-count case-insensitive to table names
This matches the behavior of mdb-export. Thanks to Nicholas Crookston.
2020-08-13 06:32:41 -04:00
Evan Miller 4bde3609c1 Remove ODBC from appveyor for now
Nothing seems to be working :-(
2020-08-13 06:31:20 -04:00
Evan Miller 085c6cc96e Appveyor debugging 2020-08-13 06:22:31 -04:00
Evan Miller 70467dfd64 Merge branch 'master' of github.com:evanmiller/mdbtools 2020-08-12 23:40:25 -04:00
Evan Miller 093c6f1774 Try setting --no-undefined on Linux 2020-08-12 23:39:57 -04:00
Evan Miller cca922562f Merge pull request #13 from nyalldawson/fix_placeholder
Fix placeholder text used instead of type name in SQLGetData SQLColumns_TYPE_NAME call
2020-08-12 22:48:41 -04:00
Evan Miller 0a72c5407b Merge pull request #14 from nyalldawson/char_len
Correctly return len of character data when SQLColAttributes is called with SQL_COLUMN_TYPE_NAME
2020-08-12 22:46:52 -04:00
Evan Miller fde72aa3b6 Merge pull request #12 from nyalldawson/needs_term2
Don't automatically add terminators when reading data parts via SQLGetData for OLE fields
2020-08-12 18:22:53 -04:00
Evan Miller 3a164c7709 More appveyor tweaks 2020-08-12 18:19:26 -04:00
Evan Miller 24111d4a7c Tweak Appveyor 2020-08-12 18:09:26 -04:00
Evan Miller 130a122c54 Build ODBC on Appveyor 2020-08-12 17:55:45 -04:00
Evan Miller 362938f17c ODBC build fixes
* Require SQLGetPrivateProfileString in ODBC libraries

* Attempt to fix reported deadlock with unixODBC by rearranging
functions
2020-08-12 15:05:25 -04:00
Evan Miller acbace242c Add Travis targets with --enable-glib 2020-08-12 06:38:57 -04:00
Evan Miller bd6aa50f73 Merge pull request #11 from nyalldawson/binary_type
Report more accurate field type for OLE fields
2020-08-12 06:26:00 -04:00
Evan Miller 1c20f688e3 Merge pull request #10 from nyalldawson/guint_warn
Fix int/guint comparison warnings
2020-08-12 06:17:50 -04:00
Evan Miller ef3a9f99a8 Merge pull request #9 from nyalldawson/free_str
Fix incorrect early free of str when reading ole fields
2020-08-11 20:03:01 -04:00
Evan Miller b25eb73648 Merge pull request #8 from evanmiller/odbc-fix
Fix for variable-length fields using SQLGetData
2020-08-11 15:14:00 -04:00
Evan Miller 953375ead0 Define separate Travis targets for iODBC and unixODBC 2020-08-11 12:23:59 -04:00
Evan Miller f7e863b8e4 Put unixODBC under basic build / test coverage 2020-08-11 11:56:08 -04:00
Evan Miller 71e10395fd Try another SQLGetData fix
Set the length of the return value to include the NUL termination
charaacter.
2020-08-11 07:30:33 -04:00
Evan Miller e330feebd6 Fix for variable-length fields using SQLGetData
See:

brianb/mdbtools#130
brianb/mdbtools#131
evanmiller/mdbtools#6
2020-08-10 21:38:08 -04:00
Evan Miller 02c5544c14 Syntax fix 2020-08-10 19:19:19 -04:00
Evan Miller a712dfef65 Get rid of indirection in ODBC driver 2020-08-10 19:15:03 -04:00
Evan Miller 05b1e2229a Fix unittest exit code 2020-08-10 17:08:55 -04:00
Evan Miller c471570d16 Fix __attribute__ syntax 2020-08-10 17:07:54 -04:00
Evan Miller 280075a3e2 Fix unused function warnings 2020-08-10 17:04:11 -04:00
Evan Miller abe7ebcb74 Add ODBC unittest to Travis 2020-08-10 16:59:15 -04: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 cc292b3f0d Improved ODBC error messages 2020-08-10 16:57:43 -04:00
Evan Miller 3c7761f965 Support --disable-glib flag with ODBC driver 2020-08-10 15:58:22 -04:00
Evan Miller d4f7bd6ec5 Remove mdb-check
This program is not built by default, and its functionality is covered
by the other utilties.
2020-08-10 06:58:05 -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 99099cdada Remove unnecessary "extern" keywords from header files 2020-08-09 16:14:19 -04:00
Evan Miller de46410a8e Tweak README 2020-08-09 15:23:38 -04:00
Evan Miller 98381e83a5 Merge pull request #7 from evanmiller/update-iconv-m4
Update iconv.m4
2020-08-07 13:28:09 -04:00
Evan Miller 5c3cc98447 Update iconv.m4
The existing iconv.m4 warns against using a serial version, but adding
an empty config.rpath to build-aux/ should make it work just fine.
The new version should work better on various less-popular platforms.
2020-08-07 13:02:06 -04:00
Evan Miller 2e1e1ed796 Simplify bounds checking logic with snprintf 2020-08-06 23:58:34 -04:00
Evan Miller 47724e50c9 Merge pull request #5 from nyalldawson/fix_SQL_COLUMN_TYPE_NAME
Implement SQL_COLUMN_TYPE_NAME field identifier in SQLColAttributes
2020-08-06 23:57:15 -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 63e8cb54ac Merge pull request #1 from evanmiller/no-glib
Remove GLib dependency
2020-08-06 13:19:25 -04:00
Evan Miller 272bd191bc Merge branch 'master' into no-glib 2020-08-06 12:51:52 -04:00
Evan Miller 2117195fac Update README 2020-08-06 12:51:45 -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 0b6809be82 Fix program_invocation_short_name on Linux 2020-08-05 23:54:25 -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 783304c164 Turn on -Werror 2020-08-05 23:07:48 -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
Evan Miller 921fb77ecd Merge branch 'master' into no-glib 2020-08-05 22:54:16 -04:00
Evan Miller 8bda9bd8ee Fix misleading indentation warnings 2020-08-05 22:53:57 -04:00
Evan Miller 1e339cb967 Merge branch 'master' into no-glib 2020-08-05 22:38:28 -04:00
Evan Miller 1d289a65b3 Fix buffer overruns and NULL pointer deferences 2020-08-05 22:35:56 -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 12ba8a424a Merge branch 'master' into no-glib 2020-08-05 19:49:25 -04:00