From cf19a9f85fdc6205eb12d9e5927f38a3d3cc0e4c Mon Sep 17 00:00:00 2001 From: brianb Date: Tue, 14 Mar 2000 00:53:17 +0000 Subject: [PATCH] patches from Karl and Carl --- README | 30 ++++++++++++++++++------------ TODO | 13 +++++++------ src/include/mdbtools.h | 10 ++++++++-- src/libmdb/table.c | 21 ++++++++++++--------- 4 files changed, 45 insertions(+), 29 deletions(-) diff --git a/README b/README index 8d7e1a7..631b503 100644 --- a/README +++ b/README @@ -1,25 +1,31 @@ -This is mdbtools version 0.002 +This is mdbtools version 0.01 -This software is very, very pre-pre-pre-alpha (did I make my point?), so -unless you know C and probably a little something about databases and reverse -engineering file formats, you're welcome to try it out but don't expect much if anything to work. +This software is very pre-alpha, so don't expect to much unless you know C and +probably a little something about databases and reverse engineering file +formats, you're welcome to try it out but don't expect much if anything to work. For the rest of you, read the HACKERS file for a description of where the code stands and what has been gleened of the file format. The initial goal of these tools is to be able to extract data structures and -data from mdb files. This goal may of course expand over time as the file -format becomes more well understood (if it ever does). +data from mdb files. This goal will of course expand over time as the file +format becomes more well understood. Also in the plans is a Gtk+ browser for +MDB files and a ODBC/SQL frontend. To install type 'make' in the src directory and hope it works :-) -This will build three executables: +This will build some useful utilities: -mdb-dump -- a simple hex dump utility that I've been using to look at mdb files -prcat -- print the catalog table from an mdb file, -prkkd -- prints some info about design view data given the offset to it. -prtable -- prints some info about a table definition. -prdata -- prints a dump of the data given a table name. +mdb-dump -- simple hex dump utility that I've been using to look at mdb files +mdb-schema -- prints DDL for the specified table +mdb-export -- export table to CSV format + +And some utilities useful for debugging: + +prcat -- prints the catalog table from an mdb file, +prkkd -- dump of information about design view data given the offset to it. +prtable -- dump of a table definition. +prdata -- dump of the data given a table name. Check out http://mdbtools.sourceforge.net for CVS, mailing list and similar. diff --git a/TODO b/TODO index 4bf7f20..52fe9cb 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,12 @@ Things to Do ------------ -. Implement code for reading data rows -. Complete list of datatypes -. Figure out how to properly determine fixed of variable length columns +. Complete the list of datatypes +. Figure out how to properly determine fixed or variable length columns . Figure out how NULLs are stored in data rows -. Figure out what happens for varchar columns > 256 -. Write schema-export utility supporting different backend databases -. Write data-export utility supporting different backend databases +. Figure out what happens for varchar columns starting at > 256 +. Modify mdb-schema utility support different backend databases +. Modify mdb-export to handle different delimiters/options . Get autoconf working +. Check out text file unixODBC driver to see if it can be adapted to use + libmdb (it already has a SQL parser). diff --git a/src/include/mdbtools.h b/src/include/mdbtools.h index 3e91f3e..bc9afea 100644 --- a/src/include/mdbtools.h +++ b/src/include/mdbtools.h @@ -49,11 +49,17 @@ enum { }; enum { MDB_BOOL = 0x01, + MDB_BYTE = 0x02, MDB_INT = 0x03, MDB_LONGINT = 0x04, + MDB_MONEY = 0x05, + MDB_FLOAT = 0x06, + MDB_DOUBLE = 0x07, MDB_SDATETIME = 0x08, MDB_TEXT = 0x0a, - MDB_HYPERLINK = 0x0c + MDB_OLE = 0x0b, + MDB_MEMO = 0x0c, + MDB_REPID = 0x0f }; typedef struct { @@ -134,6 +140,6 @@ extern char *mdb_col_to_string(MdbHandle *mdb, int start, int datatype, int size /* dump.c */ -void buffer_dump(const char* buf, int start, int end); +void buffer_dump(const unsigned char* buf, int start, int end); #endif /* _mdbtools_h_ */ diff --git a/src/libmdb/table.c b/src/libmdb/table.c index d4c2f37..a2a99a6 100644 --- a/src/libmdb/table.c +++ b/src/libmdb/table.c @@ -28,21 +28,24 @@ char *mdb_get_coltype_string(int col_type) ** its own mapping. */ static char *type_name[] = {"Unknown 0x00", - "Unknown 0x01", - "Unknown 0x02", + "Boolean", + "Byte", "Integer", "Long Integer", - "Unknown 0x05", - "Unknown 0x06", - "Unknown 0x07", + "Currency", + "Single", + "Double", "DateTime (Short)", "Unknown 0x09", - "Varchar", - "Unknown 0x0b" - "Hyperlink" + "Text", + "OLE", + "Memo/Hyperlink", + "Unknown 0x0d", + "Unknown 0x0e", + "Replication ID" }; - if (col_type > 11) { + if (col_type > 0x0f) { return NULL; } else { return type_name[col_type];