Fix numeric scale/precision on Jet3 databases

This commit is contained in:
Evan Miller 2021-01-19 15:23:28 -05:00
parent d089c4072d
commit aec667a033
3 changed files with 8 additions and 3 deletions

View File

@ -275,6 +275,8 @@ typedef struct {
guint16 tab_col_offset_var;
guint16 tab_col_offset_fixed;
guint16 tab_row_col_num_offset;
guint16 col_scale_offset;
guint16 col_prec_offset;
} MdbFormatConstants;
typedef struct {

View File

@ -31,6 +31,8 @@ MdbFormatConstants MdbJet4Constants = {
.tab_first_dpg_offset = 56,
.tab_cols_start_offset = 63,
.tab_ridx_entry_size = 12,
.col_scale_offset = 11,
.col_prec_offset = 12,
.col_flags_offset = 15,
.col_size_offset = 23,
.col_num_offset = 5,
@ -51,6 +53,8 @@ MdbFormatConstants MdbJet3Constants = {
.tab_first_dpg_offset = 36,
.tab_cols_start_offset = 43,
.tab_ridx_entry_size = 8,
.col_scale_offset = 9,
.col_prec_offset = 10,
.col_flags_offset = 13,
.col_size_offset = 16,
.col_num_offset = 1,

View File

@ -279,10 +279,9 @@ GPtrArray *mdb_read_columns(MdbTableDef *table)
pcol->row_col_num = mdb_get_int16(col, fmt->tab_row_col_num_offset);
//fprintf(stdout,"row column num %d\n",pcol->row_col_num);
/* FIXME: can this be right in Jet3 and Jet4? */
if (pcol->col_type == MDB_NUMERIC) {
pcol->col_scale = col[11];
pcol->col_prec = col[12];
pcol->col_scale = col[fmt->col_scale_offset];
pcol->col_prec = col[fmt->col_prec_offset];
}
// col_flags_offset == 13 or 15