precision and scale were used other way around. Flipped their usage

in all places
This commit is contained in:
Cyber Emissary
2018-02-06 12:51:53 -05:00
parent 702ce2b7cd
commit fd230f68f2
4 changed files with 6 additions and 6 deletions

View File

@@ -769,7 +769,7 @@ generate_table_schema(FILE *outfile, MdbCatalogEntry *entry, char *dbnamespace,
if (col->col_size == 0)
fputs(" (255)", outfile);
else if (col->col_scale != 0)
fprintf(outfile, " (%d, %d)", col->col_prec, col->col_scale);
fprintf(outfile, " (%d, %d)", col->col_scale, col->col_prec);
else
fprintf(outfile, " (%d)", col->col_size);
}

View File

@@ -247,7 +247,7 @@ int ret;
//fprintf(stdout,"len %d size %d\n",len, col->col_size);
char *str;
if (col->col_type == MDB_NUMERIC) {
str = mdb_numeric_to_string(mdb, start, col->col_prec, col->col_scale);
str = mdb_numeric_to_string(mdb, start, col->col_scale, col->col_prec);
} else {
str = mdb_col_to_string(mdb, mdb->pg_buf, start, col->col_type, len);
}

View File

@@ -79,7 +79,7 @@ char *mdb_money_to_string(MdbHandle *mdb, int start)
}
char *mdb_numeric_to_string(MdbHandle *mdb, int start, int prec, int scale) {
char *mdb_numeric_to_string(MdbHandle *mdb, int start, int scale, int prec) {
const int num_bytes = 16;
int i;
int neg=0;
@@ -103,7 +103,7 @@ char *mdb_numeric_to_string(MdbHandle *mdb, int start, int prec, int scale) {
memset(multiplier, 0, MAX_NUMERIC_PRECISION);
multiply_byte(multiplier, 256, temp);
}
return array_to_string(product, scale, neg);
return array_to_string(product, prec, neg);
}
static int multiply_byte(unsigned char *product, int num, unsigned char *multiplier)

View File

@@ -266,8 +266,8 @@ GPtrArray *mdb_read_columns(MdbTableDef *table)
/* FIXME: can this be right in Jet3 and Jet4? */
if (pcol->col_type == MDB_NUMERIC) {
pcol->col_prec = col[11];
pcol->col_scale = col[12];
pcol->col_scale = col[11];
pcol->col_prec = col[12];
}
// col_flags_offset == 13 or 15