Add basic support for Access 2010

Thanks Jakob Egger:
a928a36804
This commit is contained in:
Nirgal Vourgère
2012-07-07 21:08:25 +02:00
parent 88ff1c023e
commit b0fb6a4167
6 changed files with 33 additions and 20 deletions

View File

@@ -8,14 +8,14 @@ SYNOPSIS
DESCRIPTION
mdb-ver is a utility program distributed with MDB Tools.
It will return a single line of output with either 'JET3' for those files produced in Access 97 format or 'JET4' for those produced by Access 2000 and XP.
It will return a single line of output with 'JET3' for those files produced in Access 97 format, 'JET4' for those produced by Access 2000, XP and 2003, 'ACE12' for those produced by Access 2007, or 'ACE14' for those produced by Access 2010.
OPTIONS
-M Prints the version of MDB Tools itself instead of the MDB file.
NOTES
Access changed its format between Jet 3 used in Access 97 and Jet 4 used for Access 2000 and XP. The nature of the changes included moving the page size from 2K to 4K and added support for unicode. MDB Tools actively supports both formats.
Access changed its format between Jet 3 used in Access 97 and Jet 4 used for Access 2000 and XP. The nature of the changes included moving the page size from 2K to 4K and added support for unicode. MDB Tools actively supports both formats. Newer version are very much like Jet4.
ENVIRONMENT
MDB_JET3_CHARSET Defines the charset of the input JET3 (access 97) file. Default is CP1252. See iconv(1).
@@ -44,4 +44,4 @@ AUTHORS
BUGS
mdb-ver does minimal checking on the validity of a file. It is possbile for it to misidentify a non-MDB file.
mdb-ver does not recognize Access 2.0 (Jet 2) or the newer MSDE format files.
mdb-ver does not recognize Access 2.0 (Jet 2).

View File

@@ -59,7 +59,8 @@ enum {
enum {
MDB_VER_JET3 = 0,
MDB_VER_JET4 = 1,
MDB_VER_JET5 = 2
MDB_VER_ACCDB_2007 = 0x02,
MDB_VER_ACCDB_2010 = 0x0103
};
enum {
MDB_FORM = 0,
@@ -167,8 +168,7 @@ enum {
};
#define MDB_SHEXP_DEFAULT (MDB_SHEXP_CST_NOTNULL | MDB_SHEXP_COMMENTS | MDB_SHEXP_INDEXES | MDB_SHEXP_RELATIONS)
#define IS_JET5(mdb) (mdb->f->jet_version==MDB_VER_JET5)
#define IS_JET4(mdb) (mdb->f->jet_version==MDB_VER_JET4)
#define IS_JET4(mdb) (mdb->f->jet_version==MDB_VER_JET4) /* obsolete */
#define IS_JET3(mdb) (mdb->f->jet_version==MDB_VER_JET3)
/* forward declarations */

View File

@@ -60,8 +60,10 @@ char* version;
version = "3 (Access 97)";
else if (mdb->f->jet_version == MDB_VER_JET4)
version = "4 (Access 2000/XP/2003)";
else if (mdb->f->jet_version == MDB_VER_JET5)
version = "5 (Access 2007)";
else if (mdb->f->jet_version == MDB_VER_ACCDB_2007)
version = "ACE 12 (Access 2007)";
else if (mdb->f->jet_version == MDB_VER_ACCDB_2010)
version = "ACE 14 (Access 2010)";
else
version = "Unknown";
gtk_label_set_text(GTK_LABEL(label), version);

View File

@@ -67,7 +67,7 @@ GdkPixbuf *pixbuf=NULL;
"authors", authors,
"comments", _("GNOME MDB Viewer is a grapical interface to "
"MDB Tools. It lets you view and export data and schema "
"from MDB files produced by MS Access 97/2000/XP/2003/2007."),
"from MDB files produced by MS Access 97/2000/XP/2003/2007/2010."),
"copyright", _("Copyright 2002-2012 Brian Bruns and others"),
"documenters", documenters,
"logo", pixbuf,

View File

@@ -217,13 +217,16 @@ MdbHandle *mdb_open(const char *filename, MdbFileFlags flags)
return NULL;
}
mdb->f->jet_version = mdb_get_int32(mdb->pg_buf, 0x14);
if (IS_JET5(mdb)) {
mdb->fmt = &MdbJet4Constants;
} else if (IS_JET4(mdb)) {
mdb->fmt = &MdbJet4Constants;
} else if (IS_JET3(mdb)) {
switch(mdb->f->jet_version) {
case MDB_VER_JET3:
mdb->fmt = &MdbJet3Constants;
} else {
break;
case MDB_VER_JET4:
case MDB_VER_ACCDB_2007:
case MDB_VER_ACCDB_2010:
mdb->fmt = &MdbJet4Constants;
break;
default:
fprintf(stderr,"Unknown Jet version.\n");
mdb_close(mdb);
return NULL;

View File

@@ -66,14 +66,22 @@ main(int argc, char **argv)
mdb_exit();
exit(1);
}
if (IS_JET3(mdb)) {
switch(mdb->f->jet_version) {
case MDB_VER_JET3:
printf("JET3\n");
} else if (IS_JET4(mdb)) {
break;
case MDB_VER_JET4:
printf("JET4\n");
} else if (IS_JET5(mdb)) {
printf("JET5\n");
} else {
break;
case MDB_VER_ACCDB_2007:
printf("ACE12\n");
break;
case MDB_VER_ACCDB_2010:
printf("ACE14\n");
break;
default:
printf(_("unknown database version\n"));
break;
}
mdb_close(mdb);