Commit Graph
173 Commits
Author SHA1 Message Date
Evan Miller d5a42d9fed Bump _XOPEN_SOURCE to 700
This allows locale_t to be defined on Linux.
2021-08-04 16:06:47 -04:00
Evan Miller c866b04b74 Fix Linux build 2021-08-04 15:59:17 -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
bob620 cf0f5f249c sql: fix arbitrary path parentheses placement interfering with functions 2021-07-13 16:25:32 -05:00
bob620 f7662e18ea sql: fix function arbitrary length requirement 2021-07-13 14:41:31 -05:00
Patrick ReynoldsandPatrick Reynolds 246f854b99 Add backticks around table names in mdb-query output (#307)
* 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>
2021-06-02 10:34:35 -04:00
Evan Miller 3e11f6dc26 Set _XOPEN_SOURCE to 600. Fixes #301
Some platforms including RHEL need _XOPEN_SOURCE to be defined as a
particular value. 600 seems to be a popular choice.
2021-05-18 14:01:01 -04:00
Evan Miller ceb65d6ece Conditionally define _XOPEN_SOURCE
Fixes #298
2021-04-13 07:19:19 -04:00
Evan Miller c494f0d746 SQL: Allow spaces in DB names (remove wordexp.h)
Fixes #292
2021-04-04 22:07:31 -04:00
bob620 b6bf27d6b3 sql: allow double quoted (") database names 2021-04-04 19:42:34 -05:00
Evan Miller 5992a1cc66 Merge pull request #285 from Bob620/issue-283
sql: correctly parse 'inverse' operators
2021-03-25 22:38:09 -04:00
bob620 bd76027e67 sql: correctly parse 'inverse' operators 2021-03-25 20:36:44 -05:00
bob620 5d27e2008d libmdbsql: remove valid character * 2021-03-24 17:58:29 -05:00
bob620 d05c86fa3d libmdbsql: Allow all special characters from valid URIs in paths 2021-03-24 17:50:33 -05:00
Evan Miller 05a1492eef Merge pull request #280 from mdbtools/issue-275
libmdbsql: Allow dashes in paths
2021-03-24 18:36:09 -04:00
Evan Miller 8c2f8221b5 Allow dashes in paths #275
This is not a complete fix, but should address the immediate reported issue.
2021-03-24 09:57:41 -04:00
Evan Miller 58e4fe281d libmdbsql: Support negative floating point literals
Fixes #274
2021-03-24 09:47:52 -04:00
Evan Miller f1eac042b5 Fix misuse of "%*s" in sprintf strings
%*s takes the output length, not the input length. The intended
specifier was %.*s in several places. Bug(s) introduced in
2bb31f05ee
2021-01-21 18:27:20 -05:00
Evan Miller 615b625d79 Let LC_COLLATE influence string-comparison operations
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.
2021-01-19 21:24:31 -05:00
pedromorgan da730d3696 apidocs with doxygen 2021-01-16 16:05:28 +00:00
Evan Miller c31daeb2c4 Improved bounds and return value checking (oss-fuzz/29329) 2021-01-07 19:59:45 -05:00
Evan Miller 538711e450 Remove unnecessary casts 2020-12-28 22:30:20 -05:00
Evan Miller 2bb31f05ee Improve bounds checking
No particular crashes, but replace strcpy / strncpy with snprintf
and GLib functions wherever possible.
2020-12-28 20:12:39 -05:00
Evan Miller e7d5125e2b Fix libmdbsql build on Windows 2020-12-17 11:04:54 -05:00
Evan Miller 1efe8fc709 Merge pull request #194 from evanmiller/bounds-check-mdb-sql-bind-column
[Updated] Bounds check mdb_sql_bind_column()
2020-11-14 08:16:53 -05:00
Evan Miller 1bef1b1dca Use re-entrant functions in a couple of places
Replace strtok and gmtime with their re-entrant versions. More to come.
2020-11-12 11:20:05 -05:00
Evan Miller 12de22459a Fix indentation warning on GCC 2020-11-08 09:39:59 -05:00
Evan Miller cdc0d184f2 Fix syntax error 2020-11-08 09:25:26 -05:00
Evan Miller bbc53dfade Bounds check mdb_sql_bind_column()
Return -1 if the bounds check fails, otherwise the result of
mdb_bind_column_by_name.

Update other places in the code to check the return value.
2020-11-08 08:50:17 -05:00
Evan Miller 8b7162ded3 Merge branch 'dev' of github.com:mdbtools/mdbtools into merge-166 2020-11-01 07:55:53 -05:00
Nyall Dawson 3ac497c6ff Fix crash when a missing file is accessed via ODBC 2020-10-12 13:47:11 +10:00
James Woodcock eb5dd4d0b7 Support "SELECT TOP n [PERCENT]... " queries.
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.
2020-09-26 11:28:34 +01:00
Evan Miller 9f41e03278 Fix up libtool version-info logic 2020-09-05 10:50:24 -04:00
Evan Miller f915a4f601 Fix double free (merge error) 2020-09-02 16:18:34 -04:00
Evan Miller 55e39b6ba9 Fix merge errors 2020-09-02 15:53:21 -04:00
Evan Miller e30b8a395a Merge branch 'sql_dynamic_bound_length' of github.com:mdbtools/mdbtools into merge-166 2020-09-02 15:33:20 -04:00
Evan Miller cea7553e00 Export fakeglib symbols from main library 2020-08-31 13:27:08 -04:00
Evan Miller 8b40423f65 Merge pull request #36 from nyalldawson/precedence
Setup operator precedence for parser to avoid ambiguity and fix shift/reduce warnings
2020-08-22 18:28:23 -04:00
Nyall Dawson 83104b7b69 Setup operator precedence for parser to avoid ambiguity and fix shift/reduce warnings 2020-08-23 07:57:17 +10:00
Nyall Dawson 88e2ffa34a const correctness (fixes warning) 2020-08-23 07:56:26 +10:00
Evan Miller 90ee7bfcb5 Remove references to dmalloc
There are more modern tools for memory debugging, get rid of DMALLOC
crap in the source code.

I've left one reference in backend.c to prevent a merge conflict but
this can be removed later.
2020-08-20 08:59:08 -04:00
Nyall Dawson 333f4712b9 Fix empty table results
Fixes #19
2020-08-19 10:28:01 +10:00
Evan Miller 5758cd6861 Try fixing Mac build with explicit Yacc output file 2020-08-18 09:06:17 -04:00
Evan Miller 78707f7aa3 Remove second -d flag 2020-08-18 07:48:54 -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
Nyall Dawson 083ec7f9e4 SELECT ... LIMIT 0 should return no rows, not all rows 2020-08-18 14:54:38 +10:00
Nyall Dawson e82c1e9e1b Fix another leak 2020-08-18 14:36:44 +10:00
Nyall Dawson e8ab7e7ea6 Fix leak after running "SELECT COUNT(*)..." sql query 2020-08-18 12:36:29 +10:00
Nyall Dawson c65b402348 Fix leak after running "SELECT COUNT(*)..." sql query 2020-08-18 12:31:38 +10:00