2000-03-01 11:34:33 +08:00
|
|
|
/* MDB Tools - A library for reading MS Access database file
|
|
|
|
* Copyright (C) 2000 Brian Bruns
|
|
|
|
*
|
2011-08-29 07:53:29 +08:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
2000-03-05 01:31:07 +08:00
|
|
|
*
|
2011-08-29 07:53:29 +08:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2000-03-01 11:34:33 +08:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-08-29 07:53:29 +08:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2000-03-01 11:34:33 +08:00
|
|
|
*
|
2011-08-29 07:53:29 +08:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2000-03-01 11:34:33 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mdbtools.h"
|
|
|
|
|
2003-01-21 00:04:24 +08:00
|
|
|
int
|
2000-03-01 11:34:33 +08:00
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
2004-07-09 20:47:04 +08:00
|
|
|
unsigned int i;
|
2000-03-01 11:34:33 +08:00
|
|
|
MdbHandle *mdb;
|
2002-03-27 21:00:00 +08:00
|
|
|
MdbCatalogEntry *entry;
|
2002-04-21 11:09:26 +08:00
|
|
|
int found = 0;
|
2000-03-01 11:34:33 +08:00
|
|
|
|
|
|
|
|
2000-04-03 01:08:30 +08:00
|
|
|
if (argc<3) {
|
2000-03-16 20:05:47 +08:00
|
|
|
fprintf(stderr,"Usage: %s <file> <table>\n",argv[0]);
|
2000-03-01 11:34:33 +08:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2004-04-14 04:06:04 +08:00
|
|
|
mdb = mdb_open(argv[1], MDB_NOFLAGS);
|
2000-03-01 11:34:33 +08:00
|
|
|
|
2000-03-05 01:31:07 +08:00
|
|
|
mdb_read_catalog(mdb, MDB_TABLE);
|
2000-03-01 11:34:33 +08:00
|
|
|
|
2000-03-05 21:10:42 +08:00
|
|
|
for (i=0;i<mdb->num_catalog;i++) {
|
2002-03-27 21:00:00 +08:00
|
|
|
entry = g_ptr_array_index(mdb->catalog,i);
|
|
|
|
if (entry->object_type == MDB_TABLE &&
|
|
|
|
!strcmp(entry->object_name,argv[2])) {
|
|
|
|
mdb_table_dump(entry);
|
2002-04-21 11:09:26 +08:00
|
|
|
found++;
|
2000-03-01 11:34:33 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-04-21 11:09:26 +08:00
|
|
|
if (!found) {
|
|
|
|
fprintf(stderr,"No table named %s found.\n", argv[2]);
|
|
|
|
}
|
2004-04-14 13:58:52 +08:00
|
|
|
mdb_close(mdb);
|
2012-07-22 08:29:04 +08:00
|
|
|
return 0;
|
2000-03-01 11:34:33 +08:00
|
|
|
}
|
|
|
|
|