~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to debian/patches/kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
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)
5
 
@@ -264,7 +264,15 @@
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);
15
 
+        }
16
 
+        else {
17
 
+            columnData[i] = (char*) g_malloc(MDB_BIND_SIZE);
18
 
+        }
19
 
 
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)
26
 
@@ -223,12 +223,19 @@
27
 
                        
28
 
                        char *str;
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,
33
 
                                        col->col_scale);
34
 
+                /*fprintf(stdout,"mdb_num_to_string()=%d '%s'\n", strlen(str), str);*/
35
 
                        } else {
36
 
+                /*fprintf(stdout,"!MDB_NUMERIC : %d len=%d\n", col->col_type, len);*/
37
 
                                str = mdb_col_to_string(mdb, mdb->pg_buf, start,
38
 
                                        col->col_type, len);
39
 
+                /*if (strlen(str) > MDB_BIND_SIZE) {
40
 
+                    fprintf(stdout, "!!!!!!\n");
41
 
+                }
42
 
+                fprintf(stdout,"mdb_col_to_string()=%d '%s'\n", strlen(str), str);*/
43
 
                        }
44
 
                        strcpy(col->bind_ptr, str);
45
 
                        g_free(str);
46
 
@@ -610,9 +617,11 @@
47
 
        gint32 row_start, pg_row;
48
 
        size_t len;
49
 
        void *buf, *pg_buf = mdb->pg_buf;
50
 
-       char *text = (char *) g_malloc(MDB_BIND_SIZE);
51
 
+       char *text = 0;
52
 
 
53
 
+    /*printf("mdb_memo_to_string: size=%d\n", size);*/
54
 
        if (size<MDB_MEMO_OVERHEAD) {
55
 
+               text = (char *) g_malloc(MDB_BIND_SIZE);
56
 
                strcpy(text, "");
57
 
                return text;
58
 
        } 
59
 
@@ -626,13 +635,18 @@
60
 
         * The 32 bit integer at offset 4 contains page and row information.
61
 
         */
62
 
        memo_len = mdb_get_int32(pg_buf, start);
63
 
+    /*printf("memo_len=%d\n", memo_len);*/
64
 
 
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);
71
 
                return text;
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);
77
 
 #if MDB_DEBUG
78
 
@@ -650,6 +664,7 @@
79
 
                mdb_unicode2ascii(mdb, (char*)buf + row_start, len, text, MDB_BIND_SIZE);
80
 
                return text;
81
 
        } else if ((memo_len & 0xff000000) == 0) { /* assume all flags in MSB */
82
 
+        /*printf("MULTI-PAGE MEMO\n");*/
83
 
                /* multi-page memo field */
84
 
                guint32 tmpoff = 0;
85
 
                char *tmp;
86
 
@@ -678,7 +693,9 @@
87
 
                if (tmpoff < memo_len) {
88
 
                        fprintf(stderr, "Warning: incorrect memo length\n");
89
 
                }
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);
94
 
                g_free(tmp);
95
 
                return text;
96
 
        } else {