[PATCH] [REVIEW:3-5] fdo#46163 database form listbox only for VARCHAR

Lionel Elie Mamane lionel at mamane.lu
Thu Feb 16 04:57:58 PST 2012


Just reported and fixed fdo#46163. A list box is a control that is
supposed to match two sets of data:

 An entry in the "list content" property is matched to the
 corresponding entry in the "list entries" property (yeah, that's
 rather confusing naming...). The "list entries" entry is shown to the
 user, but the "list content" entry is stored in the database.

The bug: This matching works only if the column is of type
VARCHAR. Even "CHAR" does not work, and in particular integer types do
not work; integer types are a common case: store a reference number in
the database, but show the user a nice textual description.

To understand how stupid this sounds to the user, note that VARCHAR is
the type of variable-length strings and CHAR the type of fixed-length
strings, not "a single character" (unless the length is 1, obviously).

Attached patch 0003-fdo-46163-convert-bound-values-to-bound-column-s-typ.patch
makes sure the values are converted to the right type before being
compared to the value in the database.

Attached patch
0001-ORowSetValue-setTypeKind-correctly-convert-to-C-LOB-.patch
avoids a crash under some conditions that can be triggered after
application of other patch: instead of assuming the ORowSetValue
already contains an Any, construct one if necessary. Note that the
other cases already do type conversion "nicely", e.g. string to int or
8-bit int to 32-bit int.


Please apply both to libreoffice-3-5. I haven't tested 3.4 in any way,
if you feel like it (and the affected code looks unchanged), you can
use your own judgement.


-- 
Lionel


More information about the LibreOffice mailing list