mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-06-28 15:39:02 +08:00
support routine for index writes
port fix from data.c to mdb_crack_row?() more tdef4 dissector work in gmdb2
This commit is contained in:
parent
feba3eece6
commit
eb2b863b35
@ -1,7 +1,10 @@
|
|||||||
Sat Feb 14 14:41:00 EST 2004 Brian Bruns <brian@bruns.com>
|
Sat Feb 14 14:41:00 EST 2004 Brian Bruns <brian@bruns.com>
|
||||||
* include/.cvsignore: add mdbver.h
|
* include/.cvsignore: add mdbver.h
|
||||||
* include/mdbtools: remove variables for old index algorithm.
|
* 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 <brian@bruns.com>
|
Fri Feb 13 12:51:50 EST 2004 Brian Bruns <brian@bruns.com>
|
||||||
|
|
||||||
|
10
HACKING
10
HACKING
@ -467,7 +467,17 @@ Column Type may be one of the following (not complete):
|
|||||||
UNKNOWN_0D = 0x0D
|
UNKNOWN_0D = 0x0D
|
||||||
REPID = 0x0F /* GUID */
|
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
|
Page Usage Maps
|
||||||
---------------
|
---------------
|
||||||
|
@ -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, "Used Pages Pointer", offset+55);
|
||||||
gmdb_debug_add_page_ptr(store, NULL, fbuf, "Pages Freespace Pointer", offset+59);
|
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;i<num_idx;i++) {
|
||||||
|
snprintf(str, 100, "Index %d", i+1);
|
||||||
|
node = gmdb_debug_add_item(store, container, str, offset+63+(12*i), offset+63+(12*i)+11);
|
||||||
|
//gmdb_debug_dissect_index1(store, node, fbuf, offset+63+(12*i));
|
||||||
|
}
|
||||||
|
newbase = offset + 63 + (12*i);
|
||||||
|
|
||||||
|
container = gmdb_debug_add_item(store, NULL, "Column Data", -1, -1);
|
||||||
|
for (i=0;i<num_cols;i++) {
|
||||||
|
snprintf(str, 100, "Column %d", i+1);
|
||||||
|
node = gmdb_debug_add_item(store, container, str, newbase + (25*i), newbase + (25*i) + 24);
|
||||||
|
//gmdb_debug_dissect_column(store, node, fbuf, newbase + (25*i));
|
||||||
|
}
|
||||||
|
newbase += 25*num_cols;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
gmdb_debug_dissect_tabledef_pg3(GtkTreeStore *store, char *fbuf, int offset, int len)
|
gmdb_debug_dissect_tabledef_pg3(GtkTreeStore *store, char *fbuf, int offset, int len)
|
||||||
|
@ -313,11 +313,49 @@ mdb_index_test_sargs(MdbHandle *mdb, MdbIndex *idx, unsigned char *buf, int len)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* pack the pages bitmap
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
mdb_index_pack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
|
||||||
|
{
|
||||||
|
int mask_bit = 0;
|
||||||
|
int mask_pos = 0x16;
|
||||||
|
int mask_byte;
|
||||||
|
int elem = 0;
|
||||||
|
int len, start, i;
|
||||||
|
|
||||||
|
start = ipg->idx_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
|
* unpack the pages bitmap
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
mdb_index_unpack_page(MdbHandle *mdb, MdbIndexPage *ipg)
|
mdb_index_unpack_bitmap(MdbHandle *mdb, MdbIndexPage *ipg)
|
||||||
{
|
{
|
||||||
int mask_bit = 0;
|
int mask_bit = 0;
|
||||||
int mask_pos = 0x16;
|
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 this page has not been unpacked to it */
|
||||||
if (!ipg->idx_starts[0]){
|
if (!ipg->idx_starts[0]){
|
||||||
//fprintf(stdout, "Unpacking page %d\n", ipg->pg);
|
//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)
|
void mdb_index_page_reset(MdbIndexPage *ipg)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
ipg->offset = 0xf8; /* start byte of the index entries */
|
ipg->offset = 0xf8; /* start byte of the index entries */
|
||||||
ipg->start_pos=0;
|
ipg->start_pos=0;
|
||||||
ipg->len = 0;
|
ipg->len = 0;
|
||||||
|
@ -167,7 +167,7 @@ int eod, len; /* end of data */
|
|||||||
next_col = mdb_pg_get_int16(mdb, var_entry_pos);
|
next_col = mdb_pg_get_int16(mdb, var_entry_pos);
|
||||||
len = next_col - col_start;
|
len = next_col - col_start;
|
||||||
} /* if found==var_cols */
|
} /* if found==var_cols */
|
||||||
if (len<0) len+=256;
|
while (len<0) len+=256;
|
||||||
fields[totcols].start = row_start + col_start;
|
fields[totcols].start = row_start + col_start;
|
||||||
fields[totcols].value = &mdb->pg_buf[row_start +col_start];
|
fields[totcols].value = &mdb->pg_buf[row_start +col_start];
|
||||||
fields[totcols++].siz = len;
|
fields[totcols++].siz = len;
|
||||||
@ -302,7 +302,7 @@ int eod, len; /* end of data */
|
|||||||
var_cols_found - 1;
|
var_cols_found - 1;
|
||||||
len=mdb->pg_buf[var_entry_pos] - mdb->pg_buf[var_entry_pos+1];
|
len=mdb->pg_buf[var_entry_pos] - mdb->pg_buf[var_entry_pos+1];
|
||||||
} /* if found==var_cols */
|
} /* if found==var_cols */
|
||||||
if (len<0) len+=256;
|
while (len<0) len+=256;
|
||||||
fields[totcols].start = row_start + col_start;
|
fields[totcols].start = row_start + col_start;
|
||||||
fields[totcols].value = &mdb->pg_buf[row_start +col_start];
|
fields[totcols].value = &mdb->pg_buf[row_start +col_start];
|
||||||
fields[totcols++].siz = len;
|
fields[totcols++].siz = len;
|
||||||
|
Loading…
Reference in New Issue
Block a user