1
Index: kexi/migration/mdb/src/keximdb/mdbmigrate.cpp
2
===================================================================
3
--- koffice/kexi/migration/mdb/src/keximdb/mdbmigrate.cpp (revision 1151353)
4
+++ koffice/kexi/migration/mdb/src/keximdb/mdbmigrate.cpp (revision 1151354)
6
//! Bind + allocate the DB columns to columnData and columnDataLength arrays
7
mdb_read_columns(tableDef); // mdb_bind_column dies without this
8
for (unsigned int i = 0; i < tableDef->num_cols; i++) {
9
- columnData[i] = (char*) g_malloc(MDB_BIND_SIZE);
10
+ MdbColumn *col = (MdbColumn*) g_ptr_array_index(tableDef->columns, i);
11
+ if (col->col_type == MDB_MEMO) {
12
+//! @todo supporting 1GB (possible to insert programmatically) of MEMO field needs changes in mdbtools API;
13
+//! for now 65,535 is supported (maximum when entering data through the user interface)
14
+ columnData[i] = (char*) g_malloc(0x10000);
17
+ columnData[i] = (char*) g_malloc(MDB_BIND_SIZE);
20
// Columns are numbered from 1
21
// and why aren't these unsigned ints?
22
Index: kexi/migration/mdb/src/mdbtools/libmdb/data.c
23
===================================================================
24
--- koffice/kexi/migration/mdb/src/mdbtools/libmdb/data.c (revision 1151353)
25
+++ koffice/kexi/migration/mdb/src/mdbtools/libmdb/data.c (revision 1151354)
29
if (col->col_type == MDB_NUMERIC) {
30
+ /*fprintf(stdout,"MDB_NUMERIC\n");*/
31
str = mdb_num_to_string(mdb, start,
32
col->col_type, col->col_prec,
34
+ /*fprintf(stdout,"mdb_num_to_string()=%d '%s'\n", strlen(str), str);*/
36
+ /*fprintf(stdout,"!MDB_NUMERIC : %d len=%d\n", col->col_type, len);*/
37
str = mdb_col_to_string(mdb, mdb->pg_buf, start,
39
+ /*if (strlen(str) > MDB_BIND_SIZE) {
40
+ fprintf(stdout, "!!!!!!\n");
42
+ fprintf(stdout,"mdb_col_to_string()=%d '%s'\n", strlen(str), str);*/
44
strcpy(col->bind_ptr, str);
47
gint32 row_start, pg_row;
49
void *buf, *pg_buf = mdb->pg_buf;
50
- char *text = (char *) g_malloc(MDB_BIND_SIZE);
53
+ /*printf("mdb_memo_to_string: size=%d\n", size);*/
54
if (size<MDB_MEMO_OVERHEAD) {
55
+ text = (char *) g_malloc(MDB_BIND_SIZE);
60
* The 32 bit integer at offset 4 contains page and row information.
62
memo_len = mdb_get_int32(pg_buf, start);
63
+ /*printf("memo_len=%d\n", memo_len);*/
65
if (memo_len & 0x80000000) {
66
+ text = (char *) g_malloc(MDB_BIND_SIZE);
67
+ /*printf("INLINE MEMO\n");*/
68
/* inline memo field */
69
mdb_unicode2ascii(mdb, (char*)pg_buf + start + MDB_MEMO_OVERHEAD,
70
size - MDB_MEMO_OVERHEAD, text, MDB_BIND_SIZE);
72
} else if (memo_len & 0x40000000) {
73
+ text = (char *) g_malloc(MDB_BIND_SIZE);
74
+ /*printf("SINGLE-PAGE MEMO\n");*/
75
/* single-page memo field */
76
pg_row = mdb_get_int32(pg_buf, start+4);
79
mdb_unicode2ascii(mdb, (char*)buf + row_start, len, text, MDB_BIND_SIZE);
81
} else if ((memo_len & 0xff000000) == 0) { /* assume all flags in MSB */
82
+ /*printf("MULTI-PAGE MEMO\n");*/
83
/* multi-page memo field */
87
if (tmpoff < memo_len) {
88
fprintf(stderr, "Warning: incorrect memo length\n");
90
- mdb_unicode2ascii(mdb, tmp, tmpoff, text, MDB_BIND_SIZE);
91
+ /*printf("ALLOCATING tmpoff *2: %d\n", tmpoff * 2);*/
92
+ text = (char *) g_malloc(tmpoff);
93
+ mdb_unicode2ascii(mdb, tmp, tmpoff, text, tmpoff);