diff --git a/ChangeLog b/ChangeLog index 7ca5cad..19136e0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,10 @@ Sat Feb 14 14:41:00 EST 2004 Brian Bruns * include/.cvsignore: add mdbver.h * include/mdbtools: remove variables for old index algorithm. - * src/libmdb/index.c: missing return in mdb_index_find_next, remove old index algorithm + * src/libmdb/index.c: missing return in mdb_index_find_next, remove old index algorithm. Add mdb_index_pack_bitmap() function and rename unpack routine to match. + * src/libmdb/write.c: port fix from data.c to mdb_crack_row() routines + * src/gmdb2/debug.c: more tdef4 dissector work + * HACKING: column deletion revelation/thoughts. Fri Feb 13 12:51:50 EST 2004 Brian Bruns diff --git a/HACKING b/HACKING index 76b5fde..fd6c6e9 100644 --- a/HACKING +++ b/HACKING @@ -467,7 +467,17 @@ Column Type may be one of the following (not complete): UNKNOWN_0D = 0x0D REPID = 0x0F /* GUID */ +Notes on deleted columns: +If a fixed length column is deleted the offset_F field will contain the values +of the original row definition. Thus is the number of columns on the row does +not match the number in the tdef, the offset_F field could be used to return +the proper data. No idea how multiple column deletions are handled, my instinct +is that Access can only handle a single column deletion event (which may involve +more than one column if new rows have not been added) without touching all the +rows. + +Don't know if variable columns work by the same mechanism yet. Stay tuned. Page Usage Maps --------------- diff --git a/src/gmdb2/debug.c b/src/gmdb2/debug.c index c8bd2e9..b604ae0 100644 --- a/src/gmdb2/debug.c +++ b/src/gmdb2/debug.c @@ -688,6 +688,22 @@ GtkTreeIter *node, *container; gmdb_debug_add_page_ptr(store, NULL, fbuf, "Used Pages Pointer", offset+55); gmdb_debug_add_page_ptr(store, NULL, fbuf, "Pages Freespace Pointer", offset+59); + + container = gmdb_debug_add_item(store, NULL, "Index Entries", -1, -1); + for (i=0;iidx_starts[elem++]; + + while (start) { + len = ipg->idx_starts[elem] - start; + fprintf(stdout, "len is %d\n", len); + for (i=0; i < len; i++) { + mask_bit++; + if (mask_bit==8) { + mask_bit=0; + mdb->pg_buf[mask_pos++] = mask_byte; + mask_byte = 0; + } + /* upon reaching the len, set the bit */ + } + mask_byte = (1 << mask_bit) | mask_byte; + fprintf(stdout, "mask byte is %02x at %d\n", mask_byte, mask_pos); + start = ipg->idx_starts[elem++]; + } + /* flush the last byte if any */ + mdb->pg_buf[mask_pos++] = mask_byte; + /* remember to zero the rest of the bitmap */ + for (i = mask_pos; i < 0xf8; i++) { + mdb->pg_buf[mask_pos++] = 0; + } + return 0; +} /* * unpack the pages bitmap */ int -mdb_index_unpack_page(MdbHandle *mdb, MdbIndexPage *ipg) +mdb_index_unpack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg) { int mask_bit = 0; int mask_pos = 0x16; @@ -364,7 +402,7 @@ mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg) /* if this page has not been unpacked to it */ if (!ipg->idx_starts[0]){ //fprintf(stdout, "Unpacking page %d\n", ipg->pg); - mdb_index_unpack_page(mdb, ipg); + mdb_index_unpack_bitmap(mdb, ipg); } @@ -377,8 +415,6 @@ mdb_index_find_next_on_page(MdbHandle *mdb, MdbIndexPage *ipg) } void mdb_index_page_reset(MdbIndexPage *ipg) { - int i; - ipg->offset = 0xf8; /* start byte of the index entries */ ipg->start_pos=0; ipg->len = 0; diff --git a/src/libmdb/write.c b/src/libmdb/write.c index b10e31b..ee79203 100644 --- a/src/libmdb/write.c +++ b/src/libmdb/write.c @@ -167,7 +167,7 @@ int eod, len; /* end of data */ next_col = mdb_pg_get_int16(mdb, var_entry_pos); len = next_col - col_start; } /* if found==var_cols */ - if (len<0) len+=256; + while (len<0) len+=256; fields[totcols].start = row_start + col_start; fields[totcols].value = &mdb->pg_buf[row_start +col_start]; fields[totcols++].siz = len; @@ -302,7 +302,7 @@ int eod, len; /* end of data */ var_cols_found - 1; len=mdb->pg_buf[var_entry_pos] - mdb->pg_buf[var_entry_pos+1]; } /* if found==var_cols */ - if (len<0) len+=256; + while (len<0) len+=256; fields[totcols].start = row_start + col_start; fields[totcols].value = &mdb->pg_buf[row_start +col_start]; fields[totcols++].siz = len;