Commit Graph

342 Commits

Author SHA1 Message Date
leecher1337
f8aa3f1104 Let debug hexdump-function output as unsigned hex value properly 2017-12-03 17:57:24 +01:00
leecher1337
5c32359f3e Fixed severe double-free bug on mdb_clone_handle with immediate mdb_close() afterwards leading to memory corruption 2017-12-03 17:53:41 +01:00
leecher1337
135f452407 Merge branch 'master' into master 2017-12-03 17:02:15 +01:00
Brian Bruns
9d56b0c3d8 bug fix for 'bad' data with odd number of UCS-2 bytes 2016-08-30 08:52:32 -04:00
leecher1337
2355aec912 At least for me IS NULL and IS NOT NULL are the wrong way round in SQL, fixed it. 2016-08-29 12:14:51 -04:00
Brian Bruns
15230b5b73 Merge pull request #94 from ewen-naos-nz/boolean_data_as_words
mdb-export: Add boolean words option (TRUE/FALSE)
2016-08-29 09:40:51 -04:00
Brian Bruns
1c04bcb308 Merge pull request #95 from ewen-naos-nz/jet4_index_flags
JET 4: index flags (eg, UNIQUE) 4 bytes later
2016-08-29 09:39:17 -04:00
Ewen McNeill
999f6f5f10 JET 4: index flags (eg, UNIQUE) 4 bytes later
Re-reverse engineered index meta information layout in JET 4
file format, based particularly on jackcess (Java) JET/Access
database library (https://github.com/jahlborn/jackcess), and
hexdumps of JET 4 database index meta information.  Based both
on byte counting of jackcess reading of index definitions and
also expected flag values (0x80, 0x89, etc), the flags of JET 4
index definition are 4 bytes later than mdbtools previously thought.

See IndexData.read() and private static class Jet4Format in
src/main/java/com/healthmarketscience/jackcess/impl/IndexData.java
src/main/java/com/healthmarketscience/jackcess/impl/JetFormat.java
in jackcess source for layout reference.

Now appears to get sensible "CREATE INDEX"/"CREATE UNIQUE INDEX"
behaviour on export to PostgreSQL schema.

Also added extensive index definition byte layout reference to top
of src/libmdb/index.c for ease of reference, plus more debugging
assistance (and comments of phases reading index for readability).
2016-04-08 10:23:10 +12:00
Ewen McNeill
8b1db6c08e mdb-export: Add boolean words option (TRUE/FALSE)
Adds "-B" (--boolean-words) option to mdb-export, which will reconfigure
mdb/data.c to export TRUE/FALSE for boolean values instead of 1/0.  The
option is needed to support BOOLEAN fields on PostgreSQL, which will not
implicitly cast bare 1/0 into a BOOLEAN value.  Value literals are the
SQL TRUE/FALSE, and _quoted_ words meaning true/false and _quoted_
'1'/'0'.  With this flag the SQL TRUE/FALSE values are output, which should
work with several SQL databases.

PostgreSQL Reference:

http://www.postgresql.org/docs/current/static/datatype-boolean.html
2016-04-07 08:45:06 +12:00
Sam Shaw
ffccc9d1cf Oracle Foreign Keys
Oracle doesn't support the "ON UPDATE" clause for foreign keys.
2016-01-12 09:58:17 +08:00
Sam Shaw
7f21d4e030 Oracle BLOB & CLOB
BLOB and CLOB do not have a size constraint in Oracle
2015-12-23 13:46:31 +08:00
Sam Shaw
ffbc492a8b Oracle Indexes
Add syntax for creating indexes in oracle (it's the same as PostgreSQL)
2015-12-23 13:31:05 +08: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
5ce4cc5528 At least for me IS NULL and IS NOT NULL are the wrong way round in SQL, fixed it. 2015-08-21 14:50:34 +02:00
Vladimir Rutsky
772b5675dd fix typo: "popluated" 2015-03-05 16:20:12 +03:00
Vladimir Rutsky
9fb36c0f07 fix typo: "enought" 2015-03-04 13:23:23 +03:00
Jimmytaker
a5e1ab8a2e Fix not being able to handle blobs > 16 MB. Limit now at 256 MB 2014-12-29 14:54:25 +01:00
Nirgal Vourgère
9b4d5e624b Avoid dynamic array allocation on stack.
This might help some non C99 compliant compilers, while being a trivial change.
2014-12-29 13:14:45 +01: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
Jimmytaker
850d9e169d Fix not being able to handle blobs > 16 MB. Limit now at 256 MB 2014-12-22 20:14:40 +01:00
Jimmytaker
49bc1e3c40 New useful function (generate_table_schemas) for Windows but not only 2014-12-22 20:13:31 +01:00
Jimmytaker
cb65d4f3dd Compiles with VC++ as a .dll. Set up to use static glib, libiconv, libintl for ease of use. 2014-12-22 20:09:43 +01:00
Jimmytaker
aab7a561f1 VS2012 Build project and gitignore update 2014-12-22 19:55:11 +01:00
Shane Mc Cormack
a3ab6c7969 Fix for dates in mdb-props 2014-10-18 06:25:54 +02:00
Maurus Cuelenaere
e2c46bad8b Add MySQL support to mdb_print_indexes() 2014-10-17 22:18:34 +02:00
Maurus Cuelenaere
97ddfcf8b2 Introduce MDB_BACKEND_* enum 2014-10-17 22:16:49 +02:00
tyzhaoqi
9ab40e83e6 Fix binary outout
Closes issue #44
2014-07-24 08:10:49 +02:00
lovelytwo
a89baeacf5 Segfault fix on memo zero length multiple page
While converting memo field to string, stop processing on zero length multiple
page.
2014-05-02 15:12:16 +02:00
Maurus Cuelenaere
65b573637e Add MySQL support to mdb_print_indexes() 2014-03-17 13:30:40 +01:00
Maurus Cuelenaere
cce6cfead2 Introduce MDB_BACKEND_* enum 2014-03-17 13:30:28 +01:00
Nirgal Vourgère
4a3f3492cd Prints "file not found" when that happens
... rather than the obscure "Can't alloc filename"
2013-07-18 15:21:14 +02:00
Nirgal Vourgère
7841d30d43 Revert use of config.h
Revert
7162e8db74
088493d499

And drop AC_CONFIG_HEADERS so that config goes though the command line.
No longer generating config.h, update .gitignore
2013-07-15 02:42:12 +02:00
Nirgal Vourgère
088493d499 Update autoconf/automake standards
Generated files config.guess config.sub depcomp install-sh ltmain.sh missing
and ylwrap have been moved to build-aux/

Ran autoupdate

Replaced AC_TRY_LINK/AC_TRY_COMPILE by AC_LINK_IFELSE/AC_COMPILE_IFELSE

Droped -I$(top_srcdir)/include from CFLAGS since AC_CONFIG_HEADERS already
adds the -I

Fixed bison detection

Added AM_PROG_AR as required by autoreconf -i -Wall

Updated NEWS and .gitignore
2013-07-09 18:39:03 +02:00
Nirgal Vourgère
7162e8db74 Include config.h in all .c files
Need to be the first file since it may define large files support
and other options.
2013-07-04 10:53:13 +02:00
Nirgal Vourgère
6ef7da0597 Disabled schema comments for mysql backend
They were using an incorrect syntax
2013-06-29 12:13:09 +02:00
Nirgal Vourgère
8f0f167ab2 Memory leak fix
Free temporary variable in mdb_print_indexes
2013-06-28 17:54:30 +02:00
Nirgal Vourgère
687eeebe78 Memory leak fix
Need to free previous backend name when changing it.
2013-06-28 16:41:29 +02:00
Nirgal Vourgère
0196d34d7b __attribute__ change into macro
Makes it easier to port to another compiler.
Thanks Jimmy Taker
2013-06-28 01:51:52 +02:00
Nirgal Vourgère
365f7959ed Fixed password decoding
Thanks Jimmy Taker compilation warning.
2013-06-27 23:46:46 +02:00
William Rogers
0bbe5d3ee6 Memory leak fix
Free the col->sargs
2013-06-27 20:58:43 +02:00
William Rogers
1d39126de6 Memory leak wrong fix
Free col->sargs
Note this patch causes SEGV
2013-06-27 16:09:53 +02:00
William Rogers
fd6e52f9bd Fixed MDBProps memory leaks 2013-06-25 21:33:38 +02:00
tyzhaoqi
9cd05ffdcc Added missing break in switch/case
That missing break is not just a memory leak:
It results in incorrect call to mdb_unicode2ascii for binary data!
I suspect that is what is causing segfault on some db as repported on
https://github.com/brianb/mdbtools/issues/19
2013-06-23 17:56:53 +02:00
Jimmytaker
46005ae009 MDB_DEPRECATED redefined, Constructor MACRO, generate_table_schema changed to not static, date_fmt to ISODate
__attribute__ does not exist in Visual Studio. Therefore replaced wherever it appeared with a macro:
Redefines MDB_DEPRECATED to support Visual Studio
Define a Constructor MACRO so that __attribute__((constructor/destructor)) behavior is achieved in Visual Studio.

Just using generate_table_schema through mdb_print_schema deletes the purpose of a very good tool. generate_table_schemas is a rewrite of generate_table_schema but sends the data to a char* instead of FILE*. There is NO fmemopen() or similar in Visual Studio, so there is NO way to access memory through a FILE* except for first writing to the disk and then reading from the disk in memory.

I cannot suggest how to handle the case when td == 0 for the dates. The databases I work with often have just 00:00:00 in the DateTime column which is not consistent with the rest of the column either, but I have to deal with it somehow.

Leaving void* where char* is needed as a function parameter returns a compilation error in Visual Studio.
2013-01-14 19:27:53 +01:00
Nirgal Vourgère
a972c1638d merge with master 2013-01-14 14:20:10 +01:00
Nirgal Vourgère
eeadcb54f3 Use macros for depreacated function attributes
This will help porting on compilers that don't support it
2013-01-13 23:50:42 +01:00
Jimmytaker
c9f602480b Code cleanup
Enforce consistency g_malloc - g_free and malloc - free
Move var declarations on top of functions
2013-01-13 23:17:07 +01:00
Jimmytaker
70c6fb7551 Added support for sqlite 2013-01-13 22:32:31 +01:00
Jimmytaker
9d81bdde56 t 2012-12-31 21:30:35 +01:00
Jimmytaker
6df0aa6ce0 Port to Windows and SQLite Extension 2012-12-31 20:40:12 +01:00