mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-07-15 20:44:28 +08:00
debug statements added, some bind stuff, patch from Karl and Georg, change to AUTHORS file
This commit is contained in:
parent
951838d3e9
commit
fa6c08a08d
2
AUTHORS
2
AUTHORS
@ -1,3 +1,3 @@
|
|||||||
Brian Bruns <camber@ais.org>
|
Brian Bruns <camber@ais.org>
|
||||||
Karl Nyberg <karl@grebyn.com>
|
Karl Nyberg <knyberg@grebyn.com>
|
||||||
Georg Bauer <gb@hugo.westfalen.de>
|
Georg Bauer <gb@hugo.westfalen.de>
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
#include "mdbtools.h"
|
#include "mdbtools.h"
|
||||||
|
|
||||||
|
#define MDB_DEBUG 1
|
||||||
|
|
||||||
char *mdb_col_to_string(MdbHandle *mdb, int start, int datatype, int size);
|
char *mdb_col_to_string(MdbHandle *mdb, int start, int datatype, int size);
|
||||||
|
|
||||||
void mdb_bind_col(MdbColumn *col, void *bind_ptr)
|
void mdb_bind_col(MdbColumn *col, void *bind_ptr)
|
||||||
@ -66,16 +68,22 @@ int delflag, lookupflag;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MDB_DEBUG
|
||||||
buffer_dump(mdb->pg_buf, row_start, row_end);
|
buffer_dump(mdb->pg_buf, row_start, row_end);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* find out all the important stuff about the row */
|
||||||
num_cols = mdb->pg_buf[row_start];
|
num_cols = mdb->pg_buf[row_start];
|
||||||
var_cols = mdb->pg_buf[row_end-1];
|
var_cols = mdb->pg_buf[row_end-1];
|
||||||
fixed_cols = num_cols - var_cols;
|
fixed_cols = num_cols - var_cols;
|
||||||
eod = mdb->pg_buf[row_end-2-var_cols];
|
eod = mdb->pg_buf[row_end-2-var_cols];
|
||||||
|
|
||||||
|
#if MDB_DEBUG
|
||||||
fprintf(stdout,"#cols: %-3d #varcols %-3d EOD %-3d\n",
|
fprintf(stdout,"#cols: %-3d #varcols %-3d EOD %-3d\n",
|
||||||
num_cols, var_cols, eod);
|
num_cols, var_cols, eod);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* data starts at 1 */
|
||||||
col_start = 1;
|
col_start = 1;
|
||||||
fixed_cols_found = 0;
|
fixed_cols_found = 0;
|
||||||
var_cols_found = 0;
|
var_cols_found = 0;
|
||||||
@ -85,6 +93,15 @@ int delflag, lookupflag;
|
|||||||
col = g_array_index(table->columns,MdbColumn,j);
|
col = g_array_index(table->columns,MdbColumn,j);
|
||||||
if (mdb_is_fixed_col(&col) &&
|
if (mdb_is_fixed_col(&col) &&
|
||||||
++fixed_cols_found <= fixed_cols) {
|
++fixed_cols_found <= fixed_cols) {
|
||||||
|
if (col.bind_ptr) {
|
||||||
|
strcpy(col.bind_ptr,
|
||||||
|
mdb_col_to_string(mdb,
|
||||||
|
row_start + col_start,
|
||||||
|
col.col_type,
|
||||||
|
0)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#if MDB_DEBUG
|
||||||
fprintf(stdout,"fixed col %s = %s\n",
|
fprintf(stdout,"fixed col %s = %s\n",
|
||||||
col.name,
|
col.name,
|
||||||
mdb_col_to_string(mdb,
|
mdb_col_to_string(mdb,
|
||||||
@ -92,6 +109,7 @@ int delflag, lookupflag;
|
|||||||
col.col_type,
|
col.col_type,
|
||||||
0));
|
0));
|
||||||
col_start += col.col_size;
|
col_start += col.col_size;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,18 +123,31 @@ int delflag, lookupflag;
|
|||||||
if (var_cols_found==var_cols)
|
if (var_cols_found==var_cols)
|
||||||
len=eod - col_start;
|
len=eod - col_start;
|
||||||
else
|
else
|
||||||
len=col_start - mdb->pg_buf[row_end-1-var_cols_found-1];
|
len=mdb->pg_buf[row_end-1-var_cols_found-1] - col_start;
|
||||||
|
|
||||||
|
#if MDB_DEBUG
|
||||||
fprintf(stdout,"coltype %d colstart %d len %d\n",
|
fprintf(stdout,"coltype %d colstart %d len %d\n",
|
||||||
col.col_type,
|
col.col_type,
|
||||||
col_start,
|
col_start,
|
||||||
len);
|
len);
|
||||||
|
#endif
|
||||||
|
if (col.bind_ptr) {
|
||||||
|
strcpy(col.bind_ptr,
|
||||||
|
mdb_col_to_string(mdb,
|
||||||
|
row_start + col_start,
|
||||||
|
col.col_type,
|
||||||
|
len)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#if MDB_DEBUG
|
||||||
fprintf(stdout,"var col %s = %s\n",
|
fprintf(stdout,"var col %s = %s\n",
|
||||||
col.name,
|
col.name,
|
||||||
mdb_col_to_string(mdb,
|
mdb_col_to_string(mdb,
|
||||||
row_start + col_start,
|
row_start + col_start,
|
||||||
col.col_type,
|
col.col_type,
|
||||||
len));
|
len));
|
||||||
|
#endif
|
||||||
|
|
||||||
col_start += len;
|
col_start += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user