1
/* MDB Tools - A library for reading MS Access database file
2
* Copyright (C) 2000 Brian Bruns
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public
15
* License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
28
** Note: This code is mostly garbage right now...just a test to parse out the
32
GArray *mdb_get_column_props(MdbCatalogEntry *entry, int start)
37
MdbHandle *mdb = entry->mdb;
39
entry->props = g_array_new(FALSE,FALSE,sizeof(MdbColumnProp));
40
len = mdb_pg_get_int16(mdb,start);
42
while (pos < start+len) {
43
tmp = mdb_pg_get_int16(mdb,pos); /* length of string */
45
cplen = tmp > MDB_MAX_OBJ_NAME ? MDB_MAX_OBJ_NAME : tmp;
46
g_memmove(prop.name,&mdb->pg_buf[pos],cplen);
47
prop.name[cplen]='\0';
49
g_array_append_val(entry->props, prop.name);
52
entry->num_props = cnt;
56
GHashTable *mdb_get_column_def(MdbCatalogEntry *entry, int start)
59
MdbHandle *mdb = entry->mdb;
61
int tmp, pos, col_num, val_len, i;
66
fprintf(stdout,"\n data\n");
67
fprintf(stdout,"-------\n");
68
len = mdb_pg_get_int16(mdb,start);
69
fprintf(stdout,"length = %3d\n",len);
73
fprintf(stdout,"pos = %3d\n",pos);
75
tmp = mdb_pg_get_int16(mdb,pos); /* length of field */
77
col_type = mdb_pg_get_int16(mdb,pos); /* ??? */
81
col_num = mdb_pg_get_int16(mdb,pos);
84
val_len = mdb_pg_get_int16(mdb,pos);
86
fprintf(stdout,"length = %3d %04x %2d %2d ",tmp, col_type, col_num, val_len);
87
for (i=0;i<val_len;i++) {
88
c = mdb->pg_buf[pos+i];
90
fprintf(stdout," %c",c);
92
fprintf(stdout," %02x",c);
96
prop = g_array_index(entry->props,MdbColumnProp,col_num);
97
fprintf(stdout," Property %s",prop.name);
102
void mdb_kkd_dump(MdbCatalogEntry *entry)
105
int kkd_start, kkd_end;
106
int i, tmp, pos, row_type, datapos=0;
108
MdbHandle *mdb = entry->mdb;
109
int rowid = entry->kkd_rowid;
112
mdb_read_pg(mdb, entry->kkd_pg);
113
rows = mdb_pg_get_int16(mdb,8);
114
fprintf(stdout,"number of rows = %d\n",rows);
115
kkd_start = mdb_pg_get_int16(mdb,10+rowid*2);
116
fprintf(stdout,"kkd start = %d %04x\n",kkd_start,kkd_start);
117
kkd_end = mdb->fmt->pg_size;
118
for (i=0;i<rows;i++) {
119
tmp = mdb_pg_get_int16(mdb, 10+i*2);
120
if (tmp < mdb->fmt->pg_size &&
126
fprintf(stdout,"kkd end = %d %04x\n",kkd_end,kkd_end);
127
pos = kkd_start + 4; /* 4 = K K D \0 */
128
while (pos < kkd_end) {
129
tmp = mdb_pg_get_int16(mdb,pos);
130
row_type = mdb_pg_get_int16(mdb,pos+4);
131
fprintf(stdout,"row size = %3d type = 0x%02x\n",tmp,row_type);
132
if (row_type==0x80) {
133
fprintf(stdout,"\nColumn Properties\n");
134
fprintf(stdout,"-----------------\n");
135
mdb_get_column_props(entry,pos);
136
for (i=0;i<entry->num_props;i++) {
137
prop = g_array_index(entry->props,MdbColumnProp,i);
138
fprintf(stdout,"%3d %s\n",i,prop.name);
141
if (row_type==0x01) datapos = pos;
146
mdb_get_column_def(entry, datapos);