mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-06-28 15:39:02 +08:00
Compare commits
43 Commits
v1.0.0-bet
...
dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c6486ce68c | ||
![]() |
11607108be | ||
![]() |
6ed4188994 | ||
![]() |
b81b1c9271 | ||
![]() |
c5d4d1d4ee | ||
![]() |
7625bfaebf | ||
![]() |
4c4ff13237 | ||
![]() |
2b2ef525c8 | ||
![]() |
3a954c00d4 | ||
![]() |
98d17badc6 | ||
![]() |
997f4ec846 | ||
![]() |
f517db5df0 | ||
![]() |
7e057e3197 | ||
![]() |
bb83142d47 | ||
![]() |
bf77523c1d | ||
![]() |
c423097326 | ||
![]() |
57d9e7a65e | ||
![]() |
6640f9c707 | ||
![]() |
328249a628 | ||
![]() |
0d67eb4c73 | ||
![]() |
633d1c091f | ||
![]() |
1097a48b80 | ||
![]() |
d9025dbf22 | ||
![]() |
0e77b68e76 | ||
![]() |
9aa68a6ba1 | ||
![]() |
f7ae5e3f3c | ||
![]() |
f14fbea093 | ||
![]() |
d54f7b669f | ||
![]() |
0b96ecaff1 | ||
![]() |
9e1ec2a588 | ||
![]() |
ff544c0b76 | ||
![]() |
ab5beff0fa | ||
![]() |
22af793623 | ||
![]() |
ff085816b2 | ||
![]() |
03391fc913 | ||
![]() |
2da65ffdb3 | ||
![]() |
4febc7b5c6 | ||
![]() |
bcad261464 | ||
![]() |
ab9e4088a9 | ||
![]() |
1f88aac676 | ||
![]() |
c3df30837e | ||
![]() |
22c379a611 | ||
![]() |
05cb0449db |
81
.github/workflows/build.yml
vendored
81
.github/workflows/build.yml
vendored
@ -1,20 +1,25 @@
|
|||||||
name: build
|
name: build
|
||||||
on: [ push, pull_request ]
|
on: [ push, pull_request ]
|
||||||
|
env:
|
||||||
|
TEST_DATA_URL: https://github.com/mdbtools/mdbtestdata/archive/refs/heads/master.tar.gz
|
||||||
jobs:
|
jobs:
|
||||||
linux:
|
linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
compiler: [ clang, gcc, gcc-9, gcc-10 ]
|
compiler: [ clang, gcc, gcc-11, gcc-12 ]
|
||||||
iconv: [ enable-iconv, disable-iconv]
|
iconv: [ enable-iconv, disable-iconv]
|
||||||
glib: [ enable-glib, disable-glib ]
|
glib: [ enable-glib, disable-glib ]
|
||||||
steps:
|
steps:
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: sudo apt install gettext
|
run: sudo apt install gettext unixodbc gcc-11 gcc-12
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Fetch test data
|
- name: Fetch test data
|
||||||
run: git clone https://github.com/mdbtools/mdbtestdata.git test
|
run: |
|
||||||
|
rm -rf test
|
||||||
|
mkdir test
|
||||||
|
curl -sSLf "$TEST_DATA_URL" | tar xz --strip-components=1 -C test
|
||||||
- name: Autoconf
|
- name: Autoconf
|
||||||
run: autoreconf -i -f
|
run: autoreconf -i -f
|
||||||
- name: Configure
|
- name: Configure
|
||||||
@ -24,7 +29,7 @@ jobs:
|
|||||||
- name: Make
|
- name: Make
|
||||||
run: make
|
run: make
|
||||||
- name: CLI tests
|
- name: CLI tests
|
||||||
run: bash -e -x ./test_script.sh
|
run: ./test_script.sh --github
|
||||||
- name: SQL tests
|
- name: SQL tests
|
||||||
run: bash -e -x ./test_sql.sh
|
run: bash -e -x ./test_sql.sh
|
||||||
- name: ODBC tests
|
- name: ODBC tests
|
||||||
@ -49,21 +54,24 @@ jobs:
|
|||||||
glib: [ enable-glib, disable-glib ]
|
glib: [ enable-glib, disable-glib ]
|
||||||
steps:
|
steps:
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: brew install bison gawk automake
|
run: brew install bison gawk automake libtool unixodbc
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Fetch test data
|
- name: Fetch test data
|
||||||
run: git clone https://github.com/mdbtools/mdbtestdata.git test
|
run: |
|
||||||
|
rm -rf test
|
||||||
|
mkdir test
|
||||||
|
curl -sSLf "$TEST_DATA_URL" | tar xz --strip-components=1 -C test
|
||||||
- name: Autoconf
|
- name: Autoconf
|
||||||
run: autoreconf -i -f
|
run: autoreconf -i -f -I $(brew --prefix)/share/gettext/m4
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: ./configure --disable-silent-rules --${{ matrix.glib }} --${{ matrix.iconv }} --with-unixodbc=/usr/local/opt
|
run: ./configure --disable-silent-rules --${{ matrix.glib }} --${{ matrix.iconv }} --with-unixodbc=/opt/homebrew/opt/unixodbc
|
||||||
env:
|
env:
|
||||||
CC: ${{ matrix.compiler }}
|
CC: ${{ matrix.compiler }}
|
||||||
YACC: /usr/local/opt/bison/bin/bison
|
YACC: /opt/homebrew/opt/bison/bin/bison
|
||||||
- name: Make
|
- name: Make
|
||||||
run: make
|
run: make
|
||||||
- name: CLI tests
|
- name: CLI tests
|
||||||
run: bash -e -x ./test_script.sh
|
run: ./test_script.sh --github
|
||||||
- name: SQL tests
|
- name: SQL tests
|
||||||
run: bash -e -x ./test_sql.sh
|
run: bash -e -x ./test_sql.sh
|
||||||
- name: ODBC tests
|
- name: ODBC tests
|
||||||
@ -86,20 +94,23 @@ jobs:
|
|||||||
compiler: [ clang, gcc ]
|
compiler: [ clang, gcc ]
|
||||||
glib: [ enable-glib, disable-glib ]
|
glib: [ enable-glib, disable-glib ]
|
||||||
steps:
|
steps:
|
||||||
- name: Remove packages
|
|
||||||
run: brew unlink unixodbc
|
|
||||||
- name: Install packages
|
- name: Install packages
|
||||||
run: brew install libiodbc bison gawk automake
|
run: brew install bison gawk automake libtool libiodbc
|
||||||
|
- name: Add path
|
||||||
|
run: echo /opt/homebrew/opt/libiodbc/bin >> $GITHUB_PATH
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Fetch test data
|
- name: Fetch test data
|
||||||
run: git clone https://github.com/mdbtools/mdbtestdata.git test
|
run: |
|
||||||
|
rm -rf test
|
||||||
|
mkdir test
|
||||||
|
curl -sSLf "$TEST_DATA_URL" | tar xz --strip-components=1 -C test
|
||||||
- name: Autoconf
|
- name: Autoconf
|
||||||
run: autoreconf -i -f
|
run: autoreconf -i -f -I $(brew --prefix)/share/gettext/m4
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: ./configure --disable-silent-rules --${{ matrix.glib }} --with-iodbc=/usr/local/opt
|
run: ./configure --disable-silent-rules --${{ matrix.glib }} --with-iodbc=/opt/homebrew/opt/libiodbc
|
||||||
env:
|
env:
|
||||||
CC: ${{ matrix.compiler }}
|
CC: ${{ matrix.compiler }}
|
||||||
YACC: /usr/local/opt/bison/bin/bison
|
YACC: /opt/homebrew/opt/bison/bin/bison
|
||||||
- name: Make
|
- name: Make
|
||||||
run: make
|
run: make
|
||||||
- name: ODBC tests
|
- name: ODBC tests
|
||||||
@ -108,19 +119,37 @@ jobs:
|
|||||||
MDBPATH: test/data
|
MDBPATH: test/data
|
||||||
windows:
|
windows:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
env:
|
strategy:
|
||||||
MSYSTEM: MINGW64
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
iconv: [ enable-iconv, disable-iconv]
|
||||||
|
glib: [ enable-glib, disable-glib ]
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: msys2 {0}
|
||||||
steps:
|
steps:
|
||||||
|
- uses: msys2/setup-msys2@v2
|
||||||
|
with:
|
||||||
|
update: true
|
||||||
|
install: >-
|
||||||
|
autotools
|
||||||
|
base-devel
|
||||||
|
gcc
|
||||||
|
git
|
||||||
|
glib2-devel
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Check out test data
|
- name: Fetch test data
|
||||||
run: git clone https://github.com/mdbtools/mdbtestdata.git test
|
run: |
|
||||||
|
rm -rf test
|
||||||
|
mkdir test
|
||||||
|
curl -sSLf "$TEST_DATA_URL" | tar xz --strip-components=1 -C test
|
||||||
- name: Autoconf
|
- name: Autoconf
|
||||||
run: C:\msys64\usr\bin\bash -c -l 'cd "$GITHUB_WORKSPACE" && autoreconf -i -f'
|
run: autoreconf -i -f
|
||||||
- name: Configure
|
- name: Configure
|
||||||
run: C:\msys64\usr\bin\bash -c -l 'cd "$GITHUB_WORKSPACE" && ./configure'
|
run: ./configure --${{ matrix.glib }} --${{ matrix.iconv }}
|
||||||
- name: Make
|
- name: Make
|
||||||
run: C:\msys64\usr\bin\bash -c -l 'cd "$GITHUB_WORKSPACE" && make'
|
run: make
|
||||||
- name: Test
|
- name: Test
|
||||||
run: C:\msys64\usr\bin\bash -c -l 'cd "$GITHUB_WORKSPACE" && bash -e -x ./test_script.sh'
|
run: ./test_script.sh --github
|
||||||
- name: SQL Test
|
- name: SQL Test
|
||||||
run: C:\msys64\usr\bin\bash -c -l 'cd "$GITHUB_WORKSPACE" && bash -e -x ./test_sql.sh'
|
run: bash -e -x ./test_sql.sh
|
||||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@ -17,6 +17,7 @@ m4/
|
|||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
configure
|
configure
|
||||||
|
/configure~
|
||||||
Makefile.in
|
Makefile.in
|
||||||
Makefile
|
Makefile
|
||||||
doc/*.1
|
doc/*.1
|
||||||
@ -26,6 +27,8 @@ include/mdbtools.h
|
|||||||
libmdb.pc
|
libmdb.pc
|
||||||
libmdbsql.pc
|
libmdbsql.pc
|
||||||
libtool
|
libtool
|
||||||
|
mdbtools-*.tar.gz
|
||||||
|
mdbtools-*.zip
|
||||||
src/extras/mdb-hexdump
|
src/extras/mdb-hexdump
|
||||||
src/odbc/unittest
|
src/odbc/unittest
|
||||||
src/sql/lexer.c
|
src/sql/lexer.c
|
||||||
@ -52,9 +55,10 @@ src/util/prkkd
|
|||||||
src/util/prole
|
src/util/prole
|
||||||
src/util/prtable
|
src/util/prtable
|
||||||
src/util/updrow
|
src/util/updrow
|
||||||
|
/test/
|
||||||
|
/.vscode/
|
||||||
## apidocs docs related
|
## apidocs docs related
|
||||||
public/
|
public/
|
||||||
.sass-cache/
|
.sass-cache/
|
||||||
|
*.css.map
|
||||||
temp-man-pages/
|
temp-man-pages/
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ offset_start of memo = (int16*) LVAL_page[offset_num_rows + (row_id * 2) + 2]
|
|||||||
if (row_id = 0)
|
if (row_id = 0)
|
||||||
offset_stop of memo = 2048(jet3) or 4096(jet4)
|
offset_stop of memo = 2048(jet3) or 4096(jet4)
|
||||||
else
|
else
|
||||||
offset_stop of memo = (int16*) LVAL_page[offset_num_row + (row_id * 2)]
|
offset_stop of memo = (int16*) LVAL_page[offset_num_row + (row_id * 2)] & offset_mask // offset_mask = 0x1fff
|
||||||
```
|
```
|
||||||
|
|
||||||
The length (partial if type 2) for the memo is:
|
The length (partial if type 2) for the memo is:
|
||||||
|
122
NEWS
122
NEWS
@ -1,108 +1,62 @@
|
|||||||
Version 1.0.0 (Beta 7)
|
Version 1.0.0
|
||||||
=============
|
=============
|
||||||
|
|
||||||
mdb-export:
|
MDB Tools 1.0 includes a number of new features compared to the 0.9 series. The
|
||||||
|
most significant change is that mdbtools.h is now generated at build time, and
|
||||||
|
its internal HAVE_ macros have been removed. This means that it is now safe for
|
||||||
|
clients to compile against mdbtools.h without needing to provide the same
|
||||||
|
HAVE_ICONV and HAVE_GLIB flags that were present when the library was first
|
||||||
|
compiled. For most users, MDB Tools 1.0 will be ABI and API compatible with the
|
||||||
|
0.9 series but see the notes in the "Install" section below.
|
||||||
|
|
||||||
* Fix issue where byte columns with values > 127 were exported as negative numbers (regression introduced in v0.9.3-beta1) #350
|
The SQL engine has two new operators: ILIKE (case-insensitive pattern matching)
|
||||||
|
and <> (not equals).
|
||||||
|
|
||||||
Version 1.0.0 (Beta 6)
|
Changes since 0.9.4:
|
||||||
=============
|
|
||||||
|
Build:
|
||||||
|
* Generate platform-specific `mdbtools.h` at configure-time #316
|
||||||
|
* Ensure compiler supports thread-local storage
|
||||||
|
* Fix `AC_PROG_LEX` warning with autoconf 2.70
|
||||||
|
* Rely on autoconf to define appropriate values of `_XOPEN_SOURCE` and friends
|
||||||
|
* New `--disable-iconv` configure option (falls back to `wcstombs` where possible)
|
||||||
|
* Fix a build error when `./configure` detected iconv, but thought it was not working
|
||||||
|
* Generating the configure script now requires autoconf 2.64 or later
|
||||||
|
|
||||||
|
Install:
|
||||||
|
* Install `libmdbodbc.so` and `libmdbodbcW.so` into ${libdir}/odbc #315
|
||||||
|
* Do not install `mdb-sql` if SQL support was not built #276
|
||||||
|
* Do not install `libmdbsql.pc` if SQL support was not built
|
||||||
|
|
||||||
|
`pkg-config`:
|
||||||
|
* Simplify `--cflags` for libmdb
|
||||||
|
* Provide correct `--cflags` for libmdbsql
|
||||||
|
|
||||||
libmdb:
|
libmdb:
|
||||||
|
* Copy date formats when cloning handles #326
|
||||||
* Improved support for pre-C11 compilers
|
|
||||||
|
|
||||||
ODBC:
|
|
||||||
|
|
||||||
* Remove `SQLFetchW` (introduced in Beta 5) in favor of the `SQL_C_WCHAR` return type
|
|
||||||
* Fix an issue where Chinese characters were returned instead of ASCII using the Unicode driver on some platforms
|
|
||||||
* Add support for older iODBC installations lacking odbcinst.h
|
|
||||||
* Improved bounds checking
|
|
||||||
|
|
||||||
Version 1.0.0 (Beta 5)
|
|
||||||
=============
|
|
||||||
|
|
||||||
libmdb:
|
|
||||||
|
|
||||||
* Fix incorrect reading of double values #339 #342
|
* Fix incorrect reading of double values #339 #342
|
||||||
* Fix accidental reads of non-index data #335 #343
|
* Fix accidental reads of non-index data #335 #343
|
||||||
* New `mdb_set_repid_fmt()` for setting the format of Rep IDs (UUIDs) #344
|
* New `mdb_set_repid_fmt()` for setting the format of Rep IDs (UUIDs) #344
|
||||||
|
|
||||||
SQL:
|
SQL:
|
||||||
|
* New case-insensitive, Unicode-aware `ILIKE` operator #244
|
||||||
|
* New `<>` (not equal) operator #329
|
||||||
* Improved support for comparing floating-point values to integers
|
* Improved support for comparing floating-point values to integers
|
||||||
* Improved support for floating point literals with no fractional digits (e.g. "3.")
|
* Improved support for floating point literals with no fractional digits (e.g. "3.")
|
||||||
* Add support for querying Rep IDs
|
* Add support for querying Rep IDs
|
||||||
|
|
||||||
ODBC:
|
ODBC:
|
||||||
|
* Format boolean values correctly as `SQL_C_CHAR` #327
|
||||||
* Implement `SQLFetchW` in the Unicode driver #347 #348
|
* Add support for the `SQL_C_WCHAR` (UTF-16) return type #347 #348
|
||||||
|
|
||||||
Version 1.0.0 (Beta 4)
|
|
||||||
=============
|
|
||||||
|
|
||||||
Build:
|
|
||||||
* New `--disable-iconv` configure option (falls back to `wcstombs` where possible)
|
|
||||||
* Fix a build error when `./configure` detected iconv, but thought it was not working
|
|
||||||
* Generating the configure script now requires autoconf 2.64 or later
|
|
||||||
|
|
||||||
ODBC:
|
|
||||||
* The Unicode driver (`libmdbodbcW.so`) no longer uses iconv #332 #333
|
* The Unicode driver (`libmdbodbcW.so`) no longer uses iconv #332 #333
|
||||||
|
* Add support for older iODBC installations lacking `odbcinst.h`
|
||||||
|
|
||||||
SQL:
|
`mdb-export`:
|
||||||
* New `<>` (not equal) operator #329
|
|
||||||
|
|
||||||
Version 1.0.0 (Beta 3)
|
|
||||||
=============
|
|
||||||
|
|
||||||
Build:
|
|
||||||
* Fix warning with autoconf 2.70
|
|
||||||
* Rely on autoconf to define appropriate values of `_XOPEN_SOURCE` and friends
|
|
||||||
* Simplify configure script
|
|
||||||
|
|
||||||
libmdb:
|
|
||||||
* Restore previous `MdbHandle` struct layout
|
|
||||||
* Simplify `pkg-config --cflags`
|
|
||||||
|
|
||||||
libmdbsql:
|
|
||||||
* Provide correct `pkg-config --cflags`
|
|
||||||
|
|
||||||
ODBC:
|
|
||||||
* Format boolean values correctly as SQL_C_CHAR #327
|
|
||||||
|
|
||||||
mdb-schema:
|
|
||||||
* Fix incorrect treatment of CREATE TABLE and DROP TABLE #328 (Bug introduced in Beta 2)
|
|
||||||
|
|
||||||
Version 1.0.0 (Beta 2)
|
|
||||||
=============
|
|
||||||
|
|
||||||
Build:
|
|
||||||
* Ensure compiler supports thread-local storage
|
|
||||||
|
|
||||||
libmdb:
|
|
||||||
* Copy date formats when cloning handles #326
|
|
||||||
* Restore previous `mdb_register_backend` API
|
|
||||||
* Restore previous `MdbBackend` struct layout
|
|
||||||
|
|
||||||
Version 1.0.0 (Beta 1)
|
|
||||||
=============
|
|
||||||
|
|
||||||
libmdb:
|
|
||||||
* Generate platform-specific `mdbtools.h` at configure-time #316
|
|
||||||
|
|
||||||
SQL:
|
|
||||||
* New case-insensitive, Unicode-aware `ILIKE` operator #244
|
|
||||||
* Do not install `mdb-sql` if SQL support was not built #276
|
|
||||||
* Do not install `libmdbsql.pc` if SQL support was not built
|
|
||||||
|
|
||||||
ODBC:
|
|
||||||
* Install libmdbodbc.so and libmdbodbcW.so into ${libdir}/odbc #315
|
|
||||||
|
|
||||||
mdb-export:
|
|
||||||
* Convert table names to lower case when exporting to PostgreSQL #322
|
* Convert table names to lower case when exporting to PostgreSQL #322
|
||||||
* Use `CREATE IF NOT EXISTS` when exporting to PostgreSQL #321
|
* Use `CREATE IF NOT EXISTS` when exporting to PostgreSQL #321
|
||||||
|
* Fix issue where byte columns with values > 127 were exported as negative numbers (regression introduced in v0.9.3-beta1) #350
|
||||||
|
|
||||||
mdb-hexdump:
|
`mdb-hexdump`:
|
||||||
* Deprecate tool
|
* Deprecate tool
|
||||||
|
|
||||||
Version 0.9.4
|
Version 0.9.4
|
||||||
|
22
README.md
22
README.md
@ -116,19 +116,26 @@ If you have cloned the Git repository, you will first need to generate the
|
|||||||
`configure` file (skip this step if you have downloaded a formal release):
|
`configure` file (skip this step if you have downloaded a formal release):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ autoreconf -i -f
|
autoreconf -i -f
|
||||||
```
|
```
|
||||||
|
|
||||||
Then:
|
Then:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./configure
|
./configure
|
||||||
```
|
```
|
||||||
|
|
||||||
|
OR with mingw32 (--disable-shared --enable-static are optional as you knew):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./configure --host=x86_64-w64-mingw32 --disable-shared --enable-static
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
OR for a complete install (requires bison, flex, and unixODBC):
|
OR for a complete install (requires bison, flex, and unixODBC):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ./configure --with-unixodbc=/usr/local
|
./configure --with-unixodbc=/usr/local
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, MDB Tools is linked against the copy of
|
By default, MDB Tools is linked against the copy of
|
||||||
@ -152,11 +159,10 @@ mutually exclusive.
|
|||||||
By default, the ODBC driver will be installed as /usr/local/lib/odbc/libmdbodbc.so,
|
By default, the ODBC driver will be installed as /usr/local/lib/odbc/libmdbodbc.so,
|
||||||
with a Unicode-capable driver at /usr/local/lib/odbc/libmdbodbcW.so.
|
with a Unicode-capable driver at /usr/local/lib/odbc/libmdbodbcW.so.
|
||||||
|
|
||||||
A list of general options is available in the [INSTALL](./INSTALL) file, and
|
The command `configure --help` will give you the list of mdbtools specific options.
|
||||||
`configure --help` will give you the list of mdbtools specific options.
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
Once MDB Tools has been compiled, libmdb.[so|a] will be in the src/libmdb
|
Once MDB Tools has been compiled, libmdb.[so|a] will be in the src/libmdb
|
||||||
@ -165,14 +171,14 @@ directory and the utility programs will be in the src/util directory.
|
|||||||
You can then install (to /usr/local by default) by running the following as root:
|
You can then install (to /usr/local by default) by running the following as root:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
Some systems will also need the ld cache to be updated after installation;
|
Some systems will also need the ld cache to be updated after installation;
|
||||||
You can do that running:
|
You can do that running:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ldconfig
|
ldconfig
|
||||||
```
|
```
|
||||||
|
|
||||||
## Hacking
|
## Hacking
|
||||||
|
32
TODO.md
32
TODO.md
@ -1,34 +1,4 @@
|
|||||||
TODO
|
TODO
|
||||||
----
|
----
|
||||||
|
|
||||||
### file format:
|
See the list of [open issues tagged "enhancement"](https://github.com/mdbtools/mdbtools/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement).
|
||||||
|
|
||||||
- export VBA script
|
|
||||||
- re-examine KKD records for form design (OLE streams?)
|
|
||||||
- write support (understood, not coded)
|
|
||||||
|
|
||||||
### libmdb:
|
|
||||||
|
|
||||||
- Complete the list of datatypes
|
|
||||||
- Straighten out which functions in libmdb are meant to be used and which
|
|
||||||
ones should be static.
|
|
||||||
- Create an API reference for libmdb (maybe some man pages).
|
|
||||||
- Sargs need to support all datatypes
|
|
||||||
- Add support for index scanning when using sargs (partial)
|
|
||||||
- write support
|
|
||||||
|
|
||||||
### utils:
|
|
||||||
|
|
||||||
- need program to unpack VBA script to file (see prole)
|
|
||||||
- Access forms to glade converter ?
|
|
||||||
- need --version flag (done using -M flag on mdb-ver)
|
|
||||||
|
|
||||||
### SQL Engine:
|
|
||||||
|
|
||||||
- Joins
|
|
||||||
- insert/updates
|
|
||||||
- bogus column name in where clause not caught
|
|
||||||
|
|
||||||
### ODBC:
|
|
||||||
|
|
||||||
- many unimplemented funtions
|
|
||||||
|
File diff suppressed because one or more lines are too long
@ -17,8 +17,10 @@ clone_folder: c:\projects\mdbtools
|
|||||||
|
|
||||||
skip_tags: true
|
skip_tags: true
|
||||||
|
|
||||||
|
# Installing packages leads to the error:
|
||||||
|
# Can't locate threads.pm in @INC (you may need to install the threads module)
|
||||||
|
# So disable the SQL tests on this platform for now
|
||||||
build_script:
|
build_script:
|
||||||
- C:\cygwin64\setup-x86_64.exe -q -P bison -P flex -P libiconv-devel
|
|
||||||
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && git clone https://github.com/mdbtools/mdbtestdata.git test"
|
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && git clone https://github.com/mdbtools/mdbtestdata.git test"
|
||||||
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && autoreconf -i -f"
|
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && autoreconf -i -f"
|
||||||
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && ./configure --disable-man --disable-silent-rules"
|
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && ./configure --disable-man --disable-silent-rules"
|
||||||
@ -26,4 +28,3 @@ build_script:
|
|||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && ./test_script.sh"
|
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && ./test_script.sh"
|
||||||
- C:\cygwin64\bin\sh -lc "cd /cygdrive/c/projects/mdbtools && ./test_sql.sh"
|
|
||||||
|
15
configure.ac
15
configure.ac
@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
AC_INIT([mdbtools],[1.0.0-beta7],[https://github.com/mdbtools/mdbtools/issues],[],[https://github.com/mdbtools/mdbtools])
|
AC_INIT([mdbtools],[1.0.1],[https://github.com/mdbtools/mdbtools/issues],[],[https://github.com/mdbtools/mdbtools])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_AUX_DIR([build-aux])
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
AC_CONFIG_SRCDIR(src/extras/mdb-dump.c)
|
AC_CONFIG_SRCDIR(src/extras/mdb-dump.c)
|
||||||
@ -7,11 +7,11 @@ AM_INIT_AUTOMAKE([foreign dist-zip])
|
|||||||
|
|
||||||
MDBTOOLS_VERSION_MAJOR=1
|
MDBTOOLS_VERSION_MAJOR=1
|
||||||
MDBTOOLS_VERSION_MINOR=0
|
MDBTOOLS_VERSION_MINOR=0
|
||||||
MDBTOOLS_VERSION_MICRO=0
|
MDBTOOLS_VERSION_MICRO=1
|
||||||
|
|
||||||
# Update these numbers with every release
|
# Update these numbers with every release
|
||||||
# See https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
# See https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
||||||
VERSION_INFO=4:0:1
|
VERSION_INFO=4:1:1
|
||||||
AC_SUBST(VERSION_INFO)
|
AC_SUBST(VERSION_INFO)
|
||||||
|
|
||||||
AM_MAINTAINER_MODE([enable])
|
AM_MAINTAINER_MODE([enable])
|
||||||
@ -83,10 +83,10 @@ AM_CONDITIONAL(SQL, test x$sql = xtrue)
|
|||||||
AC_SUBST(SQL)
|
AC_SUBST(SQL)
|
||||||
AC_SUBST(LFLAGS)
|
AC_SUBST(LFLAGS)
|
||||||
|
|
||||||
CFLAGS="$CFLAGS -Wall -Werror"
|
CFLAGS="$CFLAGS -Wall"
|
||||||
LOCALE_T=locale_t
|
LOCALE_T=locale_t
|
||||||
AS_CASE([$host],
|
AS_CASE([$host],
|
||||||
[*mingw*|*cygwin*], [LDFLAGS="$LDFLAGS -no-undefined" LOCALE_T=_locale_t], [])
|
[*mingw*], [LDFLAGS="$LDFLAGS -no-undefined" CFLAGS="$CFLAGS -D_spawnv=_spawnv"], [])
|
||||||
AC_SUBST(LOCALE_T)
|
AC_SUBST(LOCALE_T)
|
||||||
|
|
||||||
dnl See if iconv is present and wanted
|
dnl See if iconv is present and wanted
|
||||||
@ -167,7 +167,7 @@ AC_ARG_WITH(unixodbc,
|
|||||||
if test "$with_unixodbc"; then
|
if test "$with_unixodbc"; then
|
||||||
HAVE_ODBC=true
|
HAVE_ODBC=true
|
||||||
ODBC_CFLAGS="-I$with_unixodbc/include"
|
ODBC_CFLAGS="-I$with_unixodbc/include"
|
||||||
ODBC_LIBS="-L$with_unixodbc/$libdir"
|
ODBC_LIBS="-L$with_unixodbc/lib"
|
||||||
|
|
||||||
dnl SIZEOF_LONG_INT and HAVE_LONG_LONG are required by some versions of unixODBC
|
dnl SIZEOF_LONG_INT and HAVE_LONG_LONG are required by some versions of unixODBC
|
||||||
dnl https://github.com/lurcher/unixODBC/issues/40
|
dnl https://github.com/lurcher/unixODBC/issues/40
|
||||||
@ -226,10 +226,9 @@ AC_ARG_ENABLE(glib,
|
|||||||
|
|
||||||
if test "$enable_glib" = "yes"; then
|
if test "$enable_glib" = "yes"; then
|
||||||
GLIB_PACKAGE=glib-2.0
|
GLIB_PACKAGE=glib-2.0
|
||||||
PKG_CHECK_MODULES([GLIB], [$GLIB_PACKAGE], HAVE_GLIB=true, HAVE_GLIB=false)
|
PKG_CHECK_MODULES([GLIB], [$GLIB_PACKAGE >= 2.68], HAVE_GLIB=true, HAVE_GLIB=false)
|
||||||
if test "x$HAVE_GLIB" = "xtrue"; then
|
if test "x$HAVE_GLIB" = "xtrue"; then
|
||||||
GLIB_CFLAGS="$GLIB_CFLAGS -DHAVE_GLIB=1"
|
GLIB_CFLAGS="$GLIB_CFLAGS -DHAVE_GLIB=1"
|
||||||
AC_CHECK_LIB($GLIB_PACKAGE, g_memdup2, [GLIB_CFLAGS="$GLIB_CFLAGS -DHAVE_G_MEMDUP2=1"])
|
|
||||||
AC_SUBST(GLIB_PACKAGE)
|
AC_SUBST(GLIB_PACKAGE)
|
||||||
else
|
else
|
||||||
enable_glib=no
|
enable_glib=no
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
SHELL = /bin/sh
|
SHELL = /bin/sh
|
||||||
TXT2MAN = ./txt2man
|
TXT2MAN = $(srcdir)/txt2man
|
||||||
PRODUCT = MDBTools
|
PRODUCT = MDBTools
|
||||||
|
|
||||||
dist_man_MANS =
|
dist_man_MANS =
|
||||||
|
@ -9,7 +9,7 @@ SYNOPSIS
|
|||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
mdb-json is a utility program distributed with MDB Tools.
|
mdb-json is a utility program distributed with MDB Tools.
|
||||||
|
|
||||||
It produces a CSV (comma separated value) output for the given table. Such output is suitable for importation into databases or spreadsheets.
|
It produces JSON output for the given table. Such output is suitable for parsing in a variety of languages.
|
||||||
|
|
||||||
OPTIONS
|
OPTIONS
|
||||||
-D, --date-format fmt Set the date format (see strftime(3) for details).
|
-D, --date-format fmt Set the date format (see strftime(3) for details).
|
||||||
|
@ -117,6 +117,7 @@ typedef struct GOptionContext {
|
|||||||
#define g_malloc malloc
|
#define g_malloc malloc
|
||||||
#define g_free free
|
#define g_free free
|
||||||
#define g_realloc realloc
|
#define g_realloc realloc
|
||||||
|
#define g_memdup2 g_memdup
|
||||||
|
|
||||||
#define G_STR_DELIMITERS "_-|> <."
|
#define G_STR_DELIMITERS "_-|> <."
|
||||||
|
|
||||||
|
@ -26,10 +26,6 @@
|
|||||||
* used within mdbtools so they won't be exported to calling programs.
|
* used within mdbtools so they won't be exported to calling programs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef HAVE_G_MEMDUP2
|
|
||||||
#define g_memdup2 g_memdup
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,9 +21,6 @@
|
|||||||
#define MDBTOOLS_H_HAVE_ICONV_H @HAVE_ICONV_H@
|
#define MDBTOOLS_H_HAVE_ICONV_H @HAVE_ICONV_H@
|
||||||
#define MDBTOOLS_H_HAVE_XLOCALE_H @HAVE_XLOCALE_H@
|
#define MDBTOOLS_H_HAVE_XLOCALE_H @HAVE_XLOCALE_H@
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@ -48,6 +45,10 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \addtogroup mdbtools
|
/** \addtogroup mdbtools
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
@ -67,6 +68,13 @@
|
|||||||
// M$VC see http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc
|
// M$VC see http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc
|
||||||
#define MDB_DEPRECATED(type, funcname) type __attribute__((deprecated)) funcname
|
#define MDB_DEPRECATED(type, funcname) type __attribute__((deprecated)) funcname
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifndef locale_t
|
||||||
|
typedef _locale_t locale_t;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef @LOCALE_T@ mdb_locale_t;
|
typedef @LOCALE_T@ mdb_locale_t;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -111,7 +111,7 @@ static const MdbBackendType mdb_mysql_types[] = {
|
|||||||
[MDB_LONGINT] = { .name = "int" },
|
[MDB_LONGINT] = { .name = "int" },
|
||||||
[MDB_MONEY] = { .name = "float" },
|
[MDB_MONEY] = { .name = "float" },
|
||||||
[MDB_FLOAT] = { .name = "float" },
|
[MDB_FLOAT] = { .name = "float" },
|
||||||
[MDB_DOUBLE] = { .name = "float" },
|
[MDB_DOUBLE] = { .name = "double" },
|
||||||
[MDB_DATETIME] = { .name = "datetime" },
|
[MDB_DATETIME] = { .name = "datetime" },
|
||||||
[MDB_BINARY] = { .name = "blob" },
|
[MDB_BINARY] = { .name = "blob" },
|
||||||
[MDB_TEXT] = { .name = "varchar", .needs_char_length = 1 },
|
[MDB_TEXT] = { .name = "varchar", .needs_char_length = 1 },
|
||||||
@ -401,7 +401,7 @@ void mdb_init_backends(MdbHandle *mdb)
|
|||||||
"COMMENT %s",
|
"COMMENT %s",
|
||||||
quote_schema_name_rquotes_merge);
|
quote_schema_name_rquotes_merge);
|
||||||
mdb_register_backend(mdb, "sqlite",
|
mdb_register_backend(mdb, "sqlite",
|
||||||
MDB_SHEXP_DROPTABLE|MDB_SHEXP_DEFVALUES|MDB_SHEXP_BULK_INSERT,
|
MDB_SHEXP_DROPTABLE|MDB_SHEXP_DEFVALUES|MDB_SHEXP_BULK_INSERT|MDB_SHEXP_INDEXES|MDB_SHEXP_CST_NOTNULL,
|
||||||
mdb_sqlite_types, NULL, NULL,
|
mdb_sqlite_types, NULL, NULL,
|
||||||
"date('now')", "date('now')",
|
"date('now')", "date('now')",
|
||||||
"%Y-%m-%d %H:%M:%S",
|
"%Y-%m-%d %H:%M:%S",
|
||||||
@ -571,7 +571,47 @@ mdb_get_index_name(int backend, MdbTableDef *table, MdbIndex *idx)
|
|||||||
|
|
||||||
return index_name;
|
return index_name;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* mdb_print_pk - print primary key constraint
|
||||||
|
* @output: Where to print the sql
|
||||||
|
* @table: Table to process
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
mdb_print_pk_if_sqlite(FILE *outfile, MdbTableDef *table)
|
||||||
|
{
|
||||||
|
unsigned int i, j;
|
||||||
|
MdbHandle *mdb = table->entry->mdb;
|
||||||
|
MdbIndex *idx;
|
||||||
|
MdbColumn *col;
|
||||||
|
char *quoted_name;
|
||||||
|
// this is only necessary for sqlite
|
||||||
|
if (strcmp(mdb->backend_name, "sqlite") != 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (table->indices==NULL)
|
||||||
|
mdb_read_indices(table);
|
||||||
|
|
||||||
|
for (i = 0; i < table->num_idxs; i++) {
|
||||||
|
idx = g_ptr_array_index(table->indices, i);
|
||||||
|
if (idx->index_type == 1) {
|
||||||
|
fprintf(outfile, "\t, PRIMARY KEY (");
|
||||||
|
for (j = 0; j < idx->num_keys; j++) {
|
||||||
|
if (j)
|
||||||
|
fprintf(outfile, ", ");
|
||||||
|
col = g_ptr_array_index(table->columns, idx->key_col_num[j] - 1);
|
||||||
|
quoted_name = mdb->default_backend->quote_schema_name(NULL, col->name);
|
||||||
|
quoted_name = mdb_normalise_and_replace(mdb, "ed_name);
|
||||||
|
fprintf(outfile, "%s", quoted_name);
|
||||||
|
if (idx->index_type != 1 && idx->key_col_order[j])
|
||||||
|
/* no DESC for primary keys */
|
||||||
|
fprintf(outfile, " DESC");
|
||||||
|
|
||||||
|
g_free(quoted_name);
|
||||||
|
}
|
||||||
|
fprintf(outfile, ")\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* mdb_print_indexes
|
* mdb_print_indexes
|
||||||
* @output: Where to print the sql
|
* @output: Where to print the sql
|
||||||
@ -596,13 +636,16 @@ mdb_print_indexes(FILE* outfile, MdbTableDef *table, char *dbnamespace)
|
|||||||
backend = MDB_BACKEND_MYSQL;
|
backend = MDB_BACKEND_MYSQL;
|
||||||
} else if (!strcmp(mdb->backend_name, "oracle")) {
|
} else if (!strcmp(mdb->backend_name, "oracle")) {
|
||||||
backend = MDB_BACKEND_ORACLE;
|
backend = MDB_BACKEND_ORACLE;
|
||||||
|
} else if (!strcmp(mdb->backend_name, "sqlite")) {
|
||||||
|
backend = MDB_BACKEND_SQLITE;
|
||||||
} else {
|
} else {
|
||||||
fprintf(outfile, "-- Indexes are not implemented for %s\n\n", mdb->backend_name);
|
fprintf(outfile, "-- Indexes are not implemented for %s\n\n", mdb->backend_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read indexes */
|
/* read indexes */
|
||||||
mdb_read_indices(table);
|
if (table->indices==NULL)
|
||||||
|
mdb_read_indices(table);
|
||||||
|
|
||||||
fprintf (outfile, "-- CREATE INDEXES ...\n");
|
fprintf (outfile, "-- CREATE INDEXES ...\n");
|
||||||
|
|
||||||
@ -613,6 +656,9 @@ mdb_print_indexes(FILE* outfile, MdbTableDef *table, char *dbnamespace)
|
|||||||
idx = g_ptr_array_index (table->indices, i);
|
idx = g_ptr_array_index (table->indices, i);
|
||||||
if (idx->index_type==2)
|
if (idx->index_type==2)
|
||||||
continue;
|
continue;
|
||||||
|
/* Sqlite3 primary keys have to be issued as a table constraint */
|
||||||
|
if (idx->index_type == 1 && backend == MDB_BACKEND_SQLITE)
|
||||||
|
continue;
|
||||||
|
|
||||||
index_name = mdb_get_index_name(backend, table, idx);
|
index_name = mdb_get_index_name(backend, table, idx);
|
||||||
switch (backend) {
|
switch (backend) {
|
||||||
@ -630,7 +676,10 @@ mdb_print_indexes(FILE* outfile, MdbTableDef *table, char *dbnamespace)
|
|||||||
}
|
}
|
||||||
|
|
||||||
quoted_name = mdb_normalise_and_replace(mdb, "ed_name);
|
quoted_name = mdb_normalise_and_replace(mdb, "ed_name);
|
||||||
|
if (idx->num_keys == 0) {
|
||||||
|
fprintf(outfile, "-- WARNING: found no keys for index %s - ignored\n", quoted_name);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (idx->index_type==1) {
|
if (idx->index_type==1) {
|
||||||
switch (backend) {
|
switch (backend) {
|
||||||
case MDB_BACKEND_ORACLE:
|
case MDB_BACKEND_ORACLE:
|
||||||
@ -645,6 +694,7 @@ mdb_print_indexes(FILE* outfile, MdbTableDef *table, char *dbnamespace)
|
|||||||
switch (backend) {
|
switch (backend) {
|
||||||
case MDB_BACKEND_ORACLE:
|
case MDB_BACKEND_ORACLE:
|
||||||
case MDB_BACKEND_POSTGRES:
|
case MDB_BACKEND_POSTGRES:
|
||||||
|
case MDB_BACKEND_SQLITE:
|
||||||
fprintf(outfile, "CREATE");
|
fprintf(outfile, "CREATE");
|
||||||
if (idx->flags & MDB_IDX_UNIQUE)
|
if (idx->flags & MDB_IDX_UNIQUE)
|
||||||
fprintf (outfile, " UNIQUE");
|
fprintf (outfile, " UNIQUE");
|
||||||
@ -872,6 +922,10 @@ generate_table_schema(FILE *outfile, MdbCatalogEntry *entry, char *dbnamespace,
|
|||||||
fprintf (outfile, " (\n");
|
fprintf (outfile, " (\n");
|
||||||
|
|
||||||
table = mdb_read_table (entry);
|
table = mdb_read_table (entry);
|
||||||
|
if (!table) {
|
||||||
|
fprintf(stderr, "Error: Table %s does not exist\n", entry->object_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* get the columns */
|
/* get the columns */
|
||||||
mdb_read_columns(table);
|
mdb_read_columns(table);
|
||||||
@ -964,6 +1018,11 @@ generate_table_schema(FILE *outfile, MdbCatalogEntry *entry, char *dbnamespace,
|
|||||||
fputs("\n", outfile);
|
fputs("\n", outfile);
|
||||||
} /* for */
|
} /* for */
|
||||||
|
|
||||||
|
if (export_options & MDB_SHEXP_INDEXES) {
|
||||||
|
// sqlite does not support ALTER TABLE PRIMARY KEY, so we need to place it directly into CREATE TABLE
|
||||||
|
mdb_print_pk_if_sqlite(outfile, table);
|
||||||
|
}
|
||||||
|
|
||||||
fputs(")", outfile);
|
fputs(")", outfile);
|
||||||
if (mdb->default_backend->per_table_comment_statement && export_options & MDB_SHEXP_COMMENTS) {
|
if (mdb->default_backend->per_table_comment_statement && export_options & MDB_SHEXP_COMMENTS) {
|
||||||
prop_value = mdb_table_get_prop(table, "Description");
|
prop_value = mdb_table_get_prop(table, "Description");
|
||||||
|
@ -193,7 +193,7 @@ mdb_dump_catalog(MdbHandle *mdb, int obj_type)
|
|||||||
entry = g_ptr_array_index(mdb->catalog,i);
|
entry = g_ptr_array_index(mdb->catalog,i);
|
||||||
if (obj_type==MDB_ANY || entry->object_type==obj_type) {
|
if (obj_type==MDB_ANY || entry->object_type==obj_type) {
|
||||||
printf("Type: %-12s Name: %-48s Page: %06lx\n",
|
printf("Type: %-12s Name: %-48s Page: %06lx\n",
|
||||||
mdb_get_objtype_string(entry->object_type),
|
mdb_get_objtype_string(entry->object_type) ?: "Unknown",
|
||||||
entry->object_name,
|
entry->object_name,
|
||||||
entry->table_pg);
|
entry->table_pg);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,8 @@ gchar *g_locale_to_utf8(const gchar *opsysstring, size_t len,
|
|||||||
mbstowcs(utf16, opsysstring, wlen+1);
|
mbstowcs(utf16, opsysstring, wlen+1);
|
||||||
gchar *utf8 = malloc(3*len+1);
|
gchar *utf8 = malloc(3*len+1);
|
||||||
gchar *dst = utf8;
|
gchar *dst = utf8;
|
||||||
for (size_t i=0; i<len; i++) {
|
size_t i;
|
||||||
|
for (i=0; i<len; i++) {
|
||||||
// u >= 0x10000 requires surrogate pairs, ignore
|
// u >= 0x10000 requires surrogate pairs, ignore
|
||||||
dst += g_unichar_to_utf8(utf16[i], dst);
|
dst += g_unichar_to_utf8(utf16[i], dst);
|
||||||
}
|
}
|
||||||
@ -332,7 +333,8 @@ void g_hash_table_insert(GHashTable *table, void *key, void *value) {
|
|||||||
|
|
||||||
gboolean g_hash_table_remove(GHashTable *table, gconstpointer key) {
|
gboolean g_hash_table_remove(GHashTable *table, gconstpointer key) {
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (guint i=0; i<table->array->len; i++) {
|
guint i;
|
||||||
|
for (i=0; i<table->array->len; i++) {
|
||||||
MyNode *node = g_ptr_array_index(table->array, i);
|
MyNode *node = g_ptr_array_index(table->array, i);
|
||||||
if (found) {
|
if (found) {
|
||||||
table->array->pdata[i-1] = table->array->pdata[i];
|
table->array->pdata[i-1] = table->array->pdata[i];
|
||||||
@ -398,7 +400,8 @@ void g_ptr_array_add(GPtrArray *array, void *entry) {
|
|||||||
|
|
||||||
gboolean g_ptr_array_remove(GPtrArray *array, gpointer data) {
|
gboolean g_ptr_array_remove(GPtrArray *array, gpointer data) {
|
||||||
int found = 0;
|
int found = 0;
|
||||||
for (guint i=0; i<array->len; i++) {
|
guint i;
|
||||||
|
for (i=0; i<array->len; i++) {
|
||||||
if (found) {
|
if (found) {
|
||||||
array->pdata[i-1] = array->pdata[i];
|
array->pdata[i-1] = array->pdata[i];
|
||||||
} else if (!found && array->pdata[i] == data) {
|
} else if (!found && array->pdata[i] == data) {
|
||||||
|
@ -275,6 +275,8 @@ static const char *mdb_iconv_name_from_code_page(int code_page) {
|
|||||||
case 860: jet3_iconv_code="IBM860"; break;
|
case 860: jet3_iconv_code="IBM860"; break;
|
||||||
case 861: jet3_iconv_code="IBM861"; break;
|
case 861: jet3_iconv_code="IBM861"; break;
|
||||||
case 862: jet3_iconv_code="IBM862"; break;
|
case 862: jet3_iconv_code="IBM862"; break;
|
||||||
|
case 863: jet3_iconv_code="IBM863"; break;
|
||||||
|
case 864: jet3_iconv_code="IBM864"; break;
|
||||||
case 865: jet3_iconv_code="IBM865"; break;
|
case 865: jet3_iconv_code="IBM865"; break;
|
||||||
case 866: jet3_iconv_code="IBM866"; break;
|
case 866: jet3_iconv_code="IBM866"; break;
|
||||||
case 869: jet3_iconv_code="IBM869"; break;
|
case 869: jet3_iconv_code="IBM869"; break;
|
||||||
|
@ -92,6 +92,12 @@ MdbTableDef *mdb_read_table(MdbCatalogEntry *entry)
|
|||||||
mdb_free_tabledef(table);
|
mdb_free_tabledef(table);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
/* First byte of usage_map is the map-type and must always be present */
|
||||||
|
if (table->map_sz < 1) {
|
||||||
|
fprintf(stderr, "mdb_read_table: invalid map-size: %zu\n", table->map_sz);
|
||||||
|
mdb_free_tabledef(table);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
table->usage_map = g_memdup2((char*)buf + row_start, table->map_sz);
|
table->usage_map = g_memdup2((char*)buf + row_start, table->map_sz);
|
||||||
if (mdb_get_option(MDB_DEBUG_USAGE))
|
if (mdb_get_option(MDB_DEBUG_USAGE))
|
||||||
mdb_buffer_dump(buf, row_start, table->map_sz);
|
mdb_buffer_dump(buf, row_start, table->map_sz);
|
||||||
@ -355,6 +361,9 @@ unsigned int i, bitn;
|
|||||||
guint32 pgnum;
|
guint32 pgnum;
|
||||||
|
|
||||||
table = mdb_read_table(entry);
|
table = mdb_read_table(entry);
|
||||||
|
if (!table)
|
||||||
|
return;
|
||||||
|
|
||||||
fprintf(stdout,"definition page = %lu\n",entry->table_pg);
|
fprintf(stdout,"definition page = %lu\n",entry->table_pg);
|
||||||
fprintf(stdout,"number of datarows = %d\n",table->num_rows);
|
fprintf(stdout,"number of datarows = %d\n",table->num_rows);
|
||||||
fprintf(stdout,"number of columns = %d\n",table->num_cols);
|
fprintf(stdout,"number of columns = %d\n",table->num_cols);
|
||||||
|
@ -213,7 +213,7 @@ gchar* ExtractDSN (ConnectParams* params, const gchar* connectString)
|
|||||||
/*
|
/*
|
||||||
* Position ourselves to the beginning of "DSN"
|
* Position ourselves to the beginning of "DSN"
|
||||||
*/
|
*/
|
||||||
p = strstr (connectString, "DSN");
|
p = strcasestr (connectString, "DSN");
|
||||||
if (!p) return NULL;
|
if (!p) return NULL;
|
||||||
/*
|
/*
|
||||||
* Position ourselves to the "="
|
* Position ourselves to the "="
|
||||||
@ -243,9 +243,9 @@ gchar* ExtractDBQ (ConnectParams* params, const gchar* connectString)
|
|||||||
if (!params)
|
if (!params)
|
||||||
return NULL;
|
return NULL;
|
||||||
/*
|
/*
|
||||||
* Position ourselves to the beginning of "DSN"
|
* Position ourselves to the beginning of "DBQ"
|
||||||
*/
|
*/
|
||||||
p = strstr (connectString, "DBQ");
|
p = strcasestr (connectString, "DBQ");
|
||||||
if (!p) return NULL;
|
if (!p) return NULL;
|
||||||
/*
|
/*
|
||||||
* Position ourselves to the "="
|
* Position ourselves to the "="
|
||||||
|
@ -72,8 +72,8 @@ struct _hstmt {
|
|||||||
struct _sql_bind_info {
|
struct _sql_bind_info {
|
||||||
int column_number;
|
int column_number;
|
||||||
int column_bindtype; /* type/conversion required */
|
int column_bindtype; /* type/conversion required */
|
||||||
int column_bindlen; /* size of varaddr buffer */
|
SQLLEN column_bindlen; /* size of varaddr buffer */
|
||||||
int *column_lenbind; /* where to store length of varaddr used */
|
SQLLEN *column_lenbind; /* where to store length of varaddr used */
|
||||||
char *varaddr;
|
char *varaddr;
|
||||||
struct _sql_bind_info *next;
|
struct _sql_bind_info *next;
|
||||||
};
|
};
|
||||||
|
@ -513,7 +513,7 @@ SQLRETURN SQL_API SQLBindCol(
|
|||||||
/* if this is a repeat */
|
/* if this is a repeat */
|
||||||
if (cur) {
|
if (cur) {
|
||||||
cur->column_bindtype = fCType;
|
cur->column_bindtype = fCType;
|
||||||
cur->column_lenbind = (int *)pcbValue;
|
cur->column_lenbind = pcbValue;
|
||||||
cur->column_bindlen = cbValueMax;
|
cur->column_bindlen = cbValueMax;
|
||||||
cur->varaddr = (char *) rgbValue;
|
cur->varaddr = (char *) rgbValue;
|
||||||
} else {
|
} else {
|
||||||
@ -522,7 +522,7 @@ SQLRETURN SQL_API SQLBindCol(
|
|||||||
newitem->column_number = icol;
|
newitem->column_number = icol;
|
||||||
newitem->column_bindtype = fCType;
|
newitem->column_bindtype = fCType;
|
||||||
newitem->column_bindlen = cbValueMax;
|
newitem->column_bindlen = cbValueMax;
|
||||||
newitem->column_lenbind = (int *)pcbValue;
|
newitem->column_lenbind = pcbValue;
|
||||||
newitem->varaddr = (char *) rgbValue;
|
newitem->varaddr = (char *) rgbValue;
|
||||||
/* if there's no head yet */
|
/* if there's no head yet */
|
||||||
if (! stmt->bind_head) {
|
if (! stmt->bind_head) {
|
||||||
@ -1360,14 +1360,85 @@ SQLRETURN SQL_API SQLGetData(
|
|||||||
break;
|
break;
|
||||||
// case MDB_MONEY: TODO
|
// case MDB_MONEY: TODO
|
||||||
case MDB_FLOAT:
|
case MDB_FLOAT:
|
||||||
*(float*)rgbValue = mdb_get_single(mdb->pg_buf, col->cur_value_start);
|
switch (fCType) {
|
||||||
if (pcbValue)
|
case SQL_C_FLOAT:
|
||||||
*pcbValue = sizeof(float);
|
*(float*)rgbValue = mdb_get_single(mdb->pg_buf, col->cur_value_start);
|
||||||
|
if (pcbValue)
|
||||||
|
*pcbValue = sizeof(float);
|
||||||
|
break;
|
||||||
|
case SQL_C_DOUBLE:
|
||||||
|
*(double*)rgbValue = (double)mdb_get_single(mdb->pg_buf, col->cur_value_start);
|
||||||
|
if (pcbValue)
|
||||||
|
*pcbValue = sizeof(double);
|
||||||
|
break;
|
||||||
|
case SQL_C_CHAR:
|
||||||
|
case SQL_C_WCHAR:
|
||||||
|
case SQL_C_STINYINT:
|
||||||
|
case SQL_C_UTINYINT:
|
||||||
|
case SQL_C_TINYINT:
|
||||||
|
case SQL_C_SBIGINT:
|
||||||
|
case SQL_C_UBIGINT:
|
||||||
|
case SQL_C_SSHORT:
|
||||||
|
case SQL_C_USHORT:
|
||||||
|
case SQL_C_SHORT:
|
||||||
|
case SQL_C_SLONG:
|
||||||
|
case SQL_C_ULONG:
|
||||||
|
case SQL_C_LONG:
|
||||||
|
case SQL_C_NUMERIC:
|
||||||
|
// case SQL_C_FLOAT:
|
||||||
|
// case SQL_C_DOUBLE:
|
||||||
|
case SQL_C_BIT:
|
||||||
|
case SQL_C_BINARY:
|
||||||
|
case SQL_C_INTERVAL_YEAR_TO_MONTH:
|
||||||
|
case SQL_C_INTERVAL_DAY_TO_HOUR:
|
||||||
|
case SQL_C_INTERVAL_DAY_TO_MINUTE:
|
||||||
|
case SQL_C_INTERVAL_DAY_TO_SECOND:
|
||||||
|
case SQL_C_INTERVAL_HOUR_TO_MINUTE:
|
||||||
|
case SQL_C_INTERVAL_HOUR_TO_SECOND:
|
||||||
|
strcpy(stmt->sqlState, "HYC00"); // Not implemented
|
||||||
|
return SQL_ERROR;
|
||||||
|
default:
|
||||||
|
strcpy(stmt->sqlState, "07006"); // Not allowed
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case MDB_DOUBLE:
|
case MDB_DOUBLE:
|
||||||
*(double*)rgbValue = mdb_get_double(mdb->pg_buf, col->cur_value_start);
|
switch (fCType) {
|
||||||
if (pcbValue)
|
case SQL_C_DOUBLE:
|
||||||
*pcbValue = sizeof(double);
|
*(double*)rgbValue = mdb_get_double(mdb->pg_buf, col->cur_value_start);
|
||||||
|
if (pcbValue)
|
||||||
|
*pcbValue = sizeof(double);
|
||||||
|
break;
|
||||||
|
case SQL_C_CHAR:
|
||||||
|
case SQL_C_WCHAR:
|
||||||
|
case SQL_C_STINYINT:
|
||||||
|
case SQL_C_UTINYINT:
|
||||||
|
case SQL_C_TINYINT:
|
||||||
|
case SQL_C_SBIGINT:
|
||||||
|
case SQL_C_UBIGINT:
|
||||||
|
case SQL_C_SSHORT:
|
||||||
|
case SQL_C_USHORT:
|
||||||
|
case SQL_C_SHORT:
|
||||||
|
case SQL_C_SLONG:
|
||||||
|
case SQL_C_ULONG:
|
||||||
|
case SQL_C_LONG:
|
||||||
|
case SQL_C_NUMERIC:
|
||||||
|
case SQL_C_FLOAT:
|
||||||
|
// case SQL_C_DOUBLE:
|
||||||
|
case SQL_C_BIT:
|
||||||
|
case SQL_C_BINARY:
|
||||||
|
case SQL_C_INTERVAL_YEAR_TO_MONTH:
|
||||||
|
case SQL_C_INTERVAL_DAY_TO_HOUR:
|
||||||
|
case SQL_C_INTERVAL_DAY_TO_MINUTE:
|
||||||
|
case SQL_C_INTERVAL_DAY_TO_SECOND:
|
||||||
|
case SQL_C_INTERVAL_HOUR_TO_MINUTE:
|
||||||
|
case SQL_C_INTERVAL_HOUR_TO_SECOND:
|
||||||
|
strcpy(stmt->sqlState, "HYC00"); // Not implemented
|
||||||
|
return SQL_ERROR;
|
||||||
|
default:
|
||||||
|
strcpy(stmt->sqlState, "07006"); // Not allowed
|
||||||
|
return SQL_ERROR;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
#if ODBCVER >= 0x0300
|
#if ODBCVER >= 0x0300
|
||||||
// returns text if old odbc
|
// returns text if old odbc
|
||||||
@ -1987,7 +2058,7 @@ static int _odbc_fix_literals(struct _hstmt *stmt)
|
|||||||
char tmp[4096];
|
char tmp[4096];
|
||||||
char *s, *d, *p;
|
char *s, *d, *p;
|
||||||
int i, quoted = 0, find_end = 0;
|
int i, quoted = 0, find_end = 0;
|
||||||
char quote_char;
|
char quote_char = '\0';
|
||||||
|
|
||||||
s=stmt->query;
|
s=stmt->query;
|
||||||
d=tmp;
|
d=tmp;
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
if ENABLE_BASH_COMPLETION
|
if ENABLE_BASH_COMPLETION
|
||||||
bashcompletiondir = $(BASH_COMPLETION_DIR)
|
bashcompletiondir = $(BASH_COMPLETION_DIR)
|
||||||
dist_bashcompletion_DATA = mdb-count mdb-export mdb-hexdump mdb-import mdb-json mdb-parsecsv mdb-prop mdb-queries mdb-schema mdb-sql mdb-tables mdb-ver
|
dist_bashcompletion_DATA = mdb-count mdb-export mdb-hexdump mdb-import mdb-json mdb-parsecsv mdb-prop mdb-queries mdb-schema mdb-tables mdb-ver
|
||||||
|
if SQL
|
||||||
|
dist_bashcompletion_DATA += mdb-sql
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
@ -92,6 +92,11 @@ FILE *cfile;
|
|||||||
entry->object_name, entry->object_name);
|
entry->object_name, entry->object_name);
|
||||||
fprintf (cfile, "\tfprintf (stdout, \"**************** %s ****************\\n\");\n", entry->object_name);
|
fprintf (cfile, "\tfprintf (stdout, \"**************** %s ****************\\n\");\n", entry->object_name);
|
||||||
table = mdb_read_table (entry);
|
table = mdb_read_table (entry);
|
||||||
|
if (!table) {
|
||||||
|
fprintf(stderr, "Error: Table %s does not exist in this database.\n", entry->object_name);
|
||||||
|
/* Don't bother clean up memory before exit */
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
/* get the columns */
|
/* get the columns */
|
||||||
mdb_read_columns (table);
|
mdb_read_columns (table);
|
||||||
|
@ -97,9 +97,9 @@ main(int argc, char **argv)
|
|||||||
g_free(buf);
|
g_free(buf);
|
||||||
mdb_free_tabledef(table);
|
mdb_free_tabledef(table);
|
||||||
g_free(table_name);
|
g_free(table_name);
|
||||||
g_free(propColName);
|
|
||||||
mdb_close(mdb);
|
mdb_close(mdb);
|
||||||
printf("Column %s not found in MSysObjects!\n", propColName);
|
printf("Column %s not found in MSysObjects!\n", propColName);
|
||||||
|
g_free(propColName);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ find_sql_terminator(char *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
sp = &s[len-1];
|
sp = &s[len-1];
|
||||||
while (sp > s && isspace(*sp)) {
|
while (sp > s && isspace((int)*sp)) {
|
||||||
sp--;
|
sp--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ main(int argc, char **argv)
|
|||||||
char prompt[20];
|
char prompt[20];
|
||||||
int line = 0;
|
int line = 0;
|
||||||
char *mybuf;
|
char *mybuf;
|
||||||
unsigned int bufsz;
|
size_t bufsz;
|
||||||
MdbSQL *sql;
|
MdbSQL *sql;
|
||||||
FILE *in = NULL, *out = NULL;
|
FILE *in = NULL, *out = NULL;
|
||||||
char *filename_in=NULL, *filename_out=NULL;
|
char *filename_in=NULL, *filename_out=NULL;
|
||||||
@ -408,7 +408,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* give the buffer an initial size */
|
/* give the buffer an initial size */
|
||||||
bufsz = 4096;
|
bufsz = 4096;
|
||||||
mybuf = g_malloc(bufsz);
|
mybuf = malloc(bufsz);
|
||||||
mybuf[0]='\0';
|
mybuf[0]='\0';
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -420,7 +420,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
s=calloc(bufsz, 1);
|
s=calloc(bufsz, 1);
|
||||||
if (!fgets(s, bufsz, in)) {
|
if (!fgets(s, (int)bufsz, in)) {
|
||||||
// Backwards compatibility with older MDBTools
|
// Backwards compatibility with older MDBTools
|
||||||
// Files read from the command line had an
|
// Files read from the command line had an
|
||||||
// implicit "go" at the end
|
// implicit "go" at the end
|
||||||
@ -464,7 +464,7 @@ main(int argc, char **argv)
|
|||||||
if (in) {
|
if (in) {
|
||||||
fprintf(stderr, "Can not handle nested opens\n");
|
fprintf(stderr, "Can not handle nested opens\n");
|
||||||
} else {
|
} else {
|
||||||
while (*fname && isspace(*fname))
|
while (*fname && isspace((int)*fname))
|
||||||
fname++;
|
fname++;
|
||||||
if (!(in = fopen(fname, "r"))) {
|
if (!(in = fopen(fname, "r"))) {
|
||||||
fprintf(stderr,"Unable to open file %s\n", fname);
|
fprintf(stderr,"Unable to open file %s\n", fname);
|
||||||
@ -478,7 +478,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
while (strlen(mybuf) + strlen(s) > bufsz) {
|
while (strlen(mybuf) + strlen(s) > bufsz) {
|
||||||
bufsz *= 2;
|
bufsz *= 2;
|
||||||
mybuf = (char *) g_realloc(mybuf, bufsz);
|
mybuf = realloc(mybuf, bufsz);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_READLINE_HISTORY
|
#ifdef HAVE_READLINE_HISTORY
|
||||||
/* don't record blank lines, or lines read from files
|
/* don't record blank lines, or lines read from files
|
||||||
@ -500,7 +500,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
mdb_sql_exit(sql);
|
mdb_sql_exit(sql);
|
||||||
|
|
||||||
g_free(mybuf);
|
free(mybuf);
|
||||||
if (s) free(s);
|
if (s) free(s);
|
||||||
if (out) fclose(out);
|
if (out) fclose(out);
|
||||||
if ((in) && (in != stdin)) fclose(in);
|
if ((in) && (in != stdin)) fclose(in);
|
||||||
|
143
test_script.sh
143
test_script.sh
@ -1,18 +1,131 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
# Simple test script; run after performing
|
# Simple test script; run after performing
|
||||||
# git clone https://github.com/mdbtools/mdbtestdata.git test
|
# git clone https://github.com/mdbtools/mdbtestdata.git test
|
||||||
./src/util/mdb-json test/data/ASampleDatabase.accdb "Asset Items"
|
|
||||||
./src/util/mdb-json test/data/nwind.mdb "Umsätze"
|
set -o errexit
|
||||||
./src/util/mdb-count test/data/ASampleDatabase.accdb "Asset Items"
|
set -o nounset
|
||||||
./src/util/mdb-count test/data/nwind.mdb "Umsätze"
|
|
||||||
./src/util/mdb-prop test/data/ASampleDatabase.accdb "Asset Items"
|
LANG=C.UTF-8
|
||||||
./src/util/mdb-prop test/data/nwind.mdb "Umsätze"
|
CDPATH= cd -- "$(dirname -- "$0")"
|
||||||
./src/util/mdb-schema test/data/ASampleDatabase.accdb
|
|
||||||
./src/util/mdb-schema test/data/nwind.mdb
|
parseArgs() {
|
||||||
./src/util/mdb-schema test/data/nwind.mdb -T "Umsätze" postgres
|
MT_OUTPUT_KIND=verbose
|
||||||
./src/util/mdb-tables test/data/ASampleDatabase.accdb
|
while :; do
|
||||||
./src/util/mdb-tables test/data/nwind.mdb
|
if test $# -lt 1; then
|
||||||
./src/util/mdb-ver test/data/ASampleDatabase.accdb
|
break
|
||||||
./src/util/mdb-ver test/data/nwind.mdb
|
fi
|
||||||
./src/util/mdb-queries test/data/ASampleDatabase.accdb qryCostsSummedByOwner
|
case "$1" in
|
||||||
|
-q | --quiet)
|
||||||
|
MT_OUTPUT_KIND=quiet
|
||||||
|
;;
|
||||||
|
-g | --github)
|
||||||
|
MT_OUTPUT_KIND=github
|
||||||
|
;;
|
||||||
|
-h | --help)
|
||||||
|
printf 'Syntax:\n%s [-q|--quiet|-g|--github] [-h|--help]\n' "$0"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf 'Unrecognized option: "%s"\n' "$1"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
testCommand() {
|
||||||
|
testCommand_name="$1"
|
||||||
|
shift
|
||||||
|
case $MT_OUTPUT_KIND in
|
||||||
|
verbose)
|
||||||
|
printf '# Running %s (%s)\n' "$testCommand_name" "$*"
|
||||||
|
if "./src/util/$testCommand_name" "$@"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
quiet)
|
||||||
|
printf 'Testing %s (%s)... ' "$testCommand_name" "$*"
|
||||||
|
if "./src/util/$testCommand_name" "$@" >/dev/null; then
|
||||||
|
printf 'passed.\n'
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
github)
|
||||||
|
testCommand_tempFile="$(mktemp)"
|
||||||
|
printf 'Testing %s (%s)... ' "$testCommand_name" "$*"
|
||||||
|
if "./src/util/$testCommand_name" "$@" 2>&1 >"$testCommand_tempFile"; then
|
||||||
|
printf 'passed.\n'
|
||||||
|
testCommand_rc=0
|
||||||
|
else
|
||||||
|
printf 'failed.\n'
|
||||||
|
testCommand_rc=1
|
||||||
|
fi
|
||||||
|
echo '::group::Output'
|
||||||
|
cat "$testCommand_tempFile"
|
||||||
|
echo '::endgroup::'
|
||||||
|
unlink "$testCommand_tempFile"
|
||||||
|
return $testCommand_rc
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf 'Unrecognized MT_OUTPUT_KIND (%s)\n' "$MT_OUTPUT_KIND"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
parseArgs "$@"
|
||||||
|
|
||||||
|
rc=0
|
||||||
|
if ! testCommand mdb-json test/data/ASampleDatabase.accdb "Asset Items"; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-json test/data/nwind.mdb "Umsätze"; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-count test/data/ASampleDatabase.accdb "Asset Items"; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-count test/data/nwind.mdb "Umsätze"; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-prop test/data/ASampleDatabase.accdb "Asset Items"; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-prop test/data/nwind.mdb "Umsätze"; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-schema test/data/ASampleDatabase.accdb; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-schema test/data/nwind.mdb; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-schema test/data/nwind.mdb -T "Umsätze" postgres; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-tables test/data/ASampleDatabase.accdb; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-tables test/data/nwind.mdb; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-ver test/data/ASampleDatabase.accdb; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-ver test/data/nwind.mdb; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
if ! testCommand mdb-queries test/data/ASampleDatabase.accdb qryCostsSummedByOwner; then
|
||||||
|
rc=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $rc = 0 ]; then
|
||||||
|
printf -- '\n%s passed.\n' "$0"
|
||||||
|
else
|
||||||
|
printf -- '\n%s failed!\n' "$0"
|
||||||
|
fi
|
||||||
|
exit $rc
|
||||||
|
Loading…
Reference in New Issue
Block a user