Re: [gnome-db] Boolean columns with gda/gnomedb and MySQL



On 7/21/05, Pablo Acosta-Serafini <pmacosta yahoo com> wrote:
> I am coding a simple glade 2.6.8/gda 1.21/gnomedb
> 1.2.1 application, using MySQL 4.1.11 as the
> underlying database. I'd like to have a boolean
> column, where a true value would be displayed with a
> check mark (or something like that), and a false value
> with nothing. I have created a TINYINT(1) column in
> the database, but the problem that I'm having is that
> the values are displayed as (presumably integers),
> with 1s and 0s. My two questions are:
> 
> a) Is the check mark functionality (or similar) for
> boolean columns implemented in gnomedb?

It is not in the 1.2.x versions of libgnomedb, but it is in the CVS
version (versions 1.3.x) so I recommend you to use either the CVS
version of version 1.3.4 which Rodrigo has released a few days ago.
Note that you'll need to use the same versions for libgda and
libgnomedb.

To see how data types are displayed, you can run the
testing/test-handlers program.

> b) If so, what do I have to do to have the column
> recognized as boolean?
> 

The TINYINT data type is identified as a kind of integer so you'll
always get the 0/1s. If you want the check marks, then there are two
possibilities (provided of course you have switched to 1.3.4 or CVS
version of libgda/libgnomedb):

1) create a data dictionnary if you don't have one yet for the
connection (it will be in ~/.libgda/DICT_<your DNS name>_default.xml
and edit the beginning where data types are defined and change the
GNOME_DB_DATATYPE tag's gdatype attribute to "boolean" for the tag
corresponding to the TINYINT data type. The problem is that you'll
lose that modification every time the dictionnary is re-generated or
updated.

2) add a plugin="InternalBoolean" as a new attribute to the
GNOME_DB_FIELD tag corresponding to the TINYINT field definition in
the GNOME_DB_TABLE tag for the table it belongs to.

3) change the data type from TINYINT to BOOL

Tell me if it solves your problems,

Vivien



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]