bool and money fixes

This commit is contained in:
brianb
2002-03-16 02:24:53 +00:00
parent 1a96e241d0
commit 2f3d61c133
4 changed files with 24 additions and 9 deletions

View File

@@ -1,3 +1,9 @@
2002-03-15 Brian Bruns <camber@ais.org>
* src/libmdb/money.c: Two's complement fix from
* src/libmdb/data.c: BOOL fixes from Mike Finger and Ben McKeegan
* src/libmdb/table.c: BOOL fixes from Mike Finger
2001-09-29 Brian Bruns <camber@ais.org> 2001-09-29 Brian Bruns <camber@ais.org>
* src/odbc/odbc.c: * src/odbc/odbc.c:

View File

@@ -193,7 +193,8 @@ unsigned char isnull;
rc = _mdb_attempt_bind(mdb, col, isnull, rc = _mdb_attempt_bind(mdb, col, isnull,
row_start + col_start, col->col_size); row_start + col_start, col->col_size);
if (!rc) return 0; if (!rc) return 0;
col_start += col->col_size; if (col->col_type != MDB_BOOL)
col_start += col->col_size;
} }
} }
@@ -245,6 +246,8 @@ unsigned char isnull;
len=mdb->pg_buf[row_end - bitmask_sz - var_cols_found len=mdb->pg_buf[row_end - bitmask_sz - var_cols_found
- 1 - num_of_jumps ] - col_start; - 1 - num_of_jumps ] - col_start;
} }
if (len<0)
len+=256;
} }
isnull = mdb_is_null(null_mask, j+1); isnull = mdb_is_null(null_mask, j+1);

View File

@@ -45,17 +45,20 @@ int neg=0;
multiplier[0]=1; multiplier[0]=1;
money = &mdb->pg_buf[start]; money = &mdb->pg_buf[start];
if (money[7] && 0x01) { if (money[7] && 0x01) {
/* negative number -- preform two's complement */ /* negative number -- preform two's complement */
neg = 1; neg = 1;
for (i=0;i<8;i++) { for (i=0;i<num_bytes;i++) {
money[i] = ~money[i]; money[i] = ~money[i];
} }
for (i=7; i>=0; i--) { for (i=0; i<num_bytes; i++) {
money[7] += 1; money[i] += 1;
if (money[i]!=0) break; if (money[i]!=0) break;
} }
} }
money[7]=0;
for (pos=0;pos<num_bytes;pos++) { for (pos=0;pos<num_bytes;pos++) {
multiply_byte(product, money[pos], multiplier); multiply_byte(product, money[pos], multiplier);

View File

@@ -105,11 +105,14 @@ GSList *slist = NULL;
read_pg_if(mdb, &cur_col, 13); read_pg_if(mdb, &cur_col, 13);
col.is_fixed = mdb->pg_buf[cur_col + mdb->col_fixed_offset] & col.is_fixed = mdb->pg_buf[cur_col + mdb->col_fixed_offset] &
0x01 ? 1 : 0; 0x01 ? 1 : 0;
read_pg_if(mdb, &cur_col, 17); if (col.col_type != MDB_BOOL) {
low_byte = mdb->pg_buf[cur_col + mdb->col_size_offset]; read_pg_if(mdb, &cur_col, 17);
read_pg_if(mdb, &cur_col, 18); low_byte = mdb->pg_buf[cur_col + mdb->col_size_offset];
high_byte = mdb->pg_buf[cur_col + mdb->col_size_offset + 1]; read_pg_if(mdb, &cur_col, 18);
col.col_size += high_byte * 256 + low_byte; high_byte = mdb->pg_buf[cur_col + mdb->col_size_offset + 1];
col.col_size += high_byte * 256 + low_byte;
} else
col.col_size=0;
pcol = g_memdup(&col, sizeof(MdbColumn)); pcol = g_memdup(&col, sizeof(MdbColumn));
slist = g_slist_insert_sorted(slist,pcol,(GCompareFunc)mdb_col_comparer); slist = g_slist_insert_sorted(slist,pcol,(GCompareFunc)mdb_col_comparer);