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
Nyall Dawson
40981d2fc6
Only handle tables in SQLColumns, not other objects
2020-08-19 10:50:12 +10:00
Nyall Dawson
b72ac6b1c0
Don't crash when a table can't be read for some reason
2020-08-19 10:44:17 +10:00
Evan Miller
858e1dff49
Merge pull request #16 from nyalldawson/reentrant
...
Make SQL parser/lexer reentrant
2020-08-18 07:20:35 -04:00
Nyall Dawson
4e3ed3a5fd
Fix LIMIT clause is ignored when executing SQL via ODBC
2020-08-18 14:54:19 +10:00
Nyall Dawson
86741f4614
More thread safety
2020-08-18 12:28:20 +10: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
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
Nyall Dawson
3f278f3996
Correctly return len of character data when SQLColAttributes is called with SQL_COLUMN_TYPE_NAME
2020-08-13 12:40:46 +10:00
Nyall Dawson
1fc6d60dfa
Fix placeholder text used instead of type name in SQLGetData SQLColumns_TYPE_NAME call
2020-08-13 12:12:57 +10:00
Nyall Dawson
8202e38155
Don't automatically add terminators when reading data parts
...
via SQLGetData for OLE fields
if the column type is OLE, then we don't add terminators
see https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlgetdata-function?view=sql-server-ver15
and https://www.ibm.com/support/knowledgecenter/SSEPEK_11.0.0/odbc/src/tpc/db2z_fngetdata.html
"The buffer that the rgbValue argument specifies contains nul-terminated values, unless you retrieve
binary data, or the SQL data type of the column is graphic (DBCS) and the C buffer type is SQL_C_CHAR."
2020-08-13 08:03:00 +10: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
Nyall Dawson
9a749e68fd
Report more accurate field type for OLE fields
2020-08-12 15:33:54 +10:00
Nyall Dawson
68d3104134
pos should finish on data length
2020-08-12 09:51:54 +10:00
Nyall Dawson
2567e57faa
Fix incorrect early free of str when reading ole fields
2020-08-12 09:06:04 +10: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
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
2e1e1ed796
Simplify bounds checking logic with snprintf
2020-08-06 23:58:34 -04:00
Nyall Dawson
3517b0eee6
Implement SQL_COLUMN_TYPE_NAME field identifier in SQLColAttributes
...
Without this use of mdbtools in UnixODBC is broken, as all calls to
SqlFetch error out
2020-08-07 13:48:45 +10:00
Evan Miller
68d3a22e77
Merge branch 'master' into no-glib
2020-08-05 18:49:24 -04:00
Evan Miller
aecee0e594
Provide SQL_DESC_UPDATABLE column attribute brianb/mdbtools#156
2020-08-05 18:19:23 -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
Evan Miller
a2fa34c0cb
Merge https://github.com/Kaukov/mdbtools
2020-08-03 16:55:40 -04:00
Peter Kaukov
55858b6fe1
Fix flex library linking
2019-07-13 23:56:32 +03:00
leecher1337
135f452407
Merge branch 'master' into master
2017-12-03 17:02:15 +01:00
leecher1337
83ee854263
Fixed a severe design flaw in ODBC driver that prevented the driver from using multiple SELECTs at once and instead crashed the driver
2016-08-29 12:14:30 -04:00
leecher1337
786add6537
Fixed bug in ODBC driver causing incomplete data on SQLGetData when doing SQLFetch and SQLGetData for one column in a loop if there was an incomplete fetch of some previous dataset
2016-08-29 12:12:44 -04:00
Dan Villiom Podlaski Christiansen
e22791606f
odbc: support reading OLE entries
...
This adds support for reading OLE objects to the ODBC driver. The APIs
for reading OLE appear somewhat idiosyncratic, so we read the string
fully and stash it in a static variable.
Tested by reading an old Access database, with checking for memory leaks.
2015-09-28 13:56:10 +02:00
Dan Villiom Podlaski Christiansen
1b8c2ca483
odbc: don't assume sizeof(int) == sizeof(long)
...
Most 64-bit environments use 64 bit longs and 32 bit ints; as such,
comparing an int to LONG_MIN/MAX makes no sense. Since SQL LONGs
appear limited to 32 bits, I assume INT_MIN/MAX was intended.
2015-09-28 13:56:09 +02: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
0e508c82d8
Fixed a severe design flaw in ODBC driver that prevented the driver from using multiple SELECTs at once and instead crashed the driver
2015-08-16 11:39:17 +02:00
leecher1337
f1bc697d6a
Fixed bug in ODBC driver causing incomplete data on SQLGetData when doing SQLFetch and SQLGetData for one column in a loop if there was an incomplete fetch of some previous dataset
2015-08-16 00:58:34 +02:00
Nirgal Vourgère
428834bbc4
Merge pull request 78
2015-05-26 17:34:51 +02:00
Nirgal Vourgère
eb7d03187f
Space normalisation
2015-05-26 17:34:34 +02:00
William Rogers
d0472d96ba
Added proper SQL engine termination
...
Since the SQL engine is initialized in _SQLAllocEnv, the engine should be also terminated in SQLFreeEnv.
2015-05-24 17:38:50 -05:00
William Rogers
bcc7ad5a7a
Fixed memory leak in _SQLFreeEnv
...
Memory allocated for the _henv structure was not being freed which caused a small memory leak.
2015-05-24 16:49:44 -05:00
William Rogers
5888c4a52c
Correction to SQLGetData string length handling
...
According to http://download.oracle.com/otn_hosted_doc/timesten/703/TimesTen-Documentation/ms.odbc.pdf and https://msdn.microsoft.com/en-us/library/ms710980(v=vs.85).aspx , the string length should not include the NULL character at the end.
Previous behavior would likely work without problems for any language that uses C-style null terminated strings, but adds a null character in the string when using the driver with a language that does not use C-style strings.
2015-05-22 20:10:10 -05:00
William Rogers
dca7552d8b
Implemented SQL_DESC_UNSIGNED attribute in SQLColAttributes
2015-05-22 16:30:13 -05:00
Nirgal Vourgère
2a70e16a8b
Allow CFLGAS="-std=c99 -D_POSIX_C_SOURCE=2"
...
Use glib function:
strcasecmp -> g_ascii_strcasecmp
bzero -> memset
strdup -> g_strdump
Don't use arithmetic void*+int
2014-12-28 12:36:55 +01:00