diff --git a/ChangeLog b/ChangeLog index ef8d2a9..317efd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,16 @@ Sun Jun 20 09:37:58 EDT 2004 Brian Bruns * HACKING: diff --git a/HACKING b/HACKING index 59384a1..e710257 100644 --- a/HACKING +++ b/HACKING @@ -398,9 +398,9 @@ next_pg field. +-------------------------------------------------------------------------+ | ???? | 1 byte | col_type | Column Type (see table below) | | ???? | 4 bytes | unknown | matches first unknown definition block | -| ???? | 2 bytes | col_num | Column Number | -| ???? | 2 bytes | offset_V | Offset for variable length columns | | ???? | 2 bytes | col_num | Column Number (includes deleted columns) | +| ???? | 2 bytes | offset_V | Offset for variable length columns | +| ???? | 2 bytes | col_num | Column Number | | ???? | 4 bytes | ??? | prec/scale? verify | | ???? | 1 byte | bitmask | low order bit indicates variable columns | | ???? | 1 byte | ??? | seems to be 1 when variable len | diff --git a/README b/README index baa03ef..92979eb 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ This is mdbtools version 0.6pre1 Welcome to the exciting world of MDB Tools! In short, MDB Tools is a set of -program to help you use Microsoft Access file in various settings. The major +programs to help you use Microsoft Access file in various settings. The major pieces are: . libmdb - the core library that allows access to MDB files programatically. diff --git a/acinclude.m4 b/acinclude.m4 index d164757..42661b8 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -42,3 +42,70 @@ AC_DEFUN([VL_LIB_READLINE], [ fi ])dnl +dnl From Bruno Haible. + +AC_DEFUN([AM_ICONV], +[ + dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and + dnl those with the standalone portable GNU libiconv installed). + + AC_ARG_WITH([libiconv-prefix], +AC_HELP_STRING([--with-libiconv-prefix=DIR], [search for libiconv in DIR/include and DIR/lib]), [ + for dir in `echo "$withval" | tr : ' '`; do + if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi + if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi + done + ]) + + AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [ + am_cv_func_iconv="no, consider installing GNU libiconv" + am_cv_lib_iconv=no + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_func_iconv=yes) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_TRY_LINK([#include +#include ], + [iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);], + am_cv_lib_iconv=yes + am_cv_func_iconv=yes) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.]) + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL(am_cv_proto_iconv, [ + AC_TRY_COMPILE([ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif +], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const") + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([$]{ac_t:- + }[$]am_cv_proto_iconv) + AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1, + [Define as const if the declaration of iconv() needs const.]) + fi + LIBICONV= + if test "$am_cv_lib_iconv" = yes; then + LIBICONV="-liconv" + fi + AC_SUBST(LIBICONV) +]) diff --git a/configure.in b/configure.in index 2b34fa0..96bc147 100644 --- a/configure.in +++ b/configure.in @@ -20,6 +20,8 @@ AC_C_CONST AC_TYPE_SIZE_T AC_C_BIGENDIAN +AM_ICONV + dnl no optional stuff by default OPTDIRS="" diff --git a/include/mdbtools.h b/include/mdbtools.h index a47f166..5cce386 100644 --- a/include/mdbtools.h +++ b/include/mdbtools.h @@ -31,6 +31,10 @@ #include #include +#ifdef HAVE_ICONV +#include +#endif + #define MDB_DEBUG 0 #define MDB_PGSIZE 4096 @@ -221,6 +225,9 @@ typedef struct { char *backend_name; MdbFormatConstants *fmt; MdbStatistics *stats; +#ifdef HAVE_ICONV + iconv_t iconv_out; +#endif } MdbHandle; typedef struct { diff --git a/src/gmdb2/gladefiles/gmdb-schema.glade b/src/gmdb2/gladefiles/gmdb-schema.glade index 331fc81..559ed3a 100644 --- a/src/gmdb2/gladefiles/gmdb-schema.glade +++ b/src/gmdb2/gladefiles/gmdb-schema.glade @@ -200,7 +200,7 @@ True True 0 - + Access True * False @@ -252,7 +252,7 @@ GTK_SELECTION_BROWSE - + True True Access @@ -260,7 +260,7 @@ - + True True Oracle @@ -268,7 +268,7 @@ - + True True Sybase @@ -276,7 +276,7 @@ - + True True MS SQL Server @@ -284,12 +284,19 @@ - + True True PostgreSQL + + + + True + True + MySQL + diff --git a/src/gmdb2/help/C/gmdb.xml b/src/gmdb2/help/C/gmdb.xml index 82004d0..36cc4e5 100644 --- a/src/gmdb2/help/C/gmdb.xml +++ b/src/gmdb2/help/C/gmdb.xml @@ -302,7 +302,7 @@ Click on the Data button from the right hand side of the Data Export - The Export button creates a text file containing the data from a single data. + The Export button creates a text file containing the data from a single table. To export the table data, perform the following steps diff --git a/src/gmdb2/schema.c b/src/gmdb2/schema.c index 74054c1..071cc22 100644 --- a/src/gmdb2/schema.c +++ b/src/gmdb2/schema.c @@ -137,6 +137,7 @@ GtkWidget *schemawin, *combo, *checkbox, *entry; else if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"Sybase")) strcpy(backend,"sybase"); else if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"MS SQL Server")) strcpy(backend,"sybase"); else if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"PostgreSQL")) strcpy(backend,"postgres"); + else if (!strcmp(gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)),"MySQL")) strcpy(backend,"mysql"); else strcpy(backend,"access"); checkbox = glade_xml_get_widget (schemawin_xml, "rel_checkbox"); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox))) diff --git a/src/libmdb/Makefile.am b/src/libmdb/Makefile.am index 5a9a39d..18919f2 100644 --- a/src/libmdb/Makefile.am +++ b/src/libmdb/Makefile.am @@ -1,4 +1,5 @@ lib_LTLIBRARIES = libmdb.la libmdb_la_SOURCES= catalog.c mem.c file.c kkd.c table.c data.c dump.c backend.c money.c sargs.c index.c like.c write.c stats.c map.c props.c worktable.c options.c iconv.c +libmdb_la_LDFLAGS = -version-info 1:0:0 AM_CPPFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) LIBS = $(GLIB_LIBS) -lm diff --git a/src/libmdb/file.c b/src/libmdb/file.c index 58ff147..9bbad89 100644 --- a/src/libmdb/file.c +++ b/src/libmdb/file.c @@ -54,6 +54,17 @@ MdbFormatConstants MdbJet3Constants = { static size_t _mdb_read_pg(MdbHandle *mdb, unsigned char *pg_buf, unsigned long pg); +/** + * mdb_find_file: + * @filename: path to MDB (database) file + * + * Finds and returns the absolute path to an MDB file. Function will first try + * to fstat file as passed, then search through the $MDBPATH if not found. + * + * Return value: gchar pointer to absolute path. Caller is responsible for + * freeing. + **/ + static gchar *mdb_find_file(char *file_name) { struct stat status; diff --git a/src/sql/Makefile.am b/src/sql/Makefile.am index 9b2419a..c36977c 100644 --- a/src/sql/Makefile.am +++ b/src/sql/Makefile.am @@ -1,5 +1,6 @@ lib_LTLIBRARIES = libmdbsql.la libmdbsql_la_SOURCES= mdbsql.c parser.y lexer.l +libmdbsql_la_LDFLAGS = -version-info 1:0:0 EXTRA_DIST = main.c DISTCLEANFILES = parser.c parser.h lexer.c AM_CPPFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS)