Re: Invalid variant type conversion
From: Maarten Wiltink (maarten_at_kittensandcats.net)
Date: 01/21/04
- Previous message: Maarten Wiltink: "Re: [OT] Danger of using FillMem() on a string? Speed of Abs()?"
- In reply to: Bjørge Sæther: "Re: Invalid variant type conversion"
- Next in thread: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Bjørge Sæther: "Re: Invalid variant type conversion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 21 Jan 2004 21:21:55 +0100
"Bjørge Sæther" <bjorge@hahaha_itte.no> wrote in message
news:K7sPb.2888$Ed.46110@news4.e.nsc.no...
> The NULL value of a database may be used for this purpose, but you can't
> reflect this in application programming unless you limit your coding to
> types that have a NULL value.
Not true. Just change TAnyType to PAnyType.
> BTW, using database fields for holding CSS data would normally be done
> in a BLOB/MEMO field text, rather than putting CSS' properties in
> dedicated fields. There is no such thing as a NULL value in CSS format,
> only a missing value ("tag"), AFAIK.
It was just an example. The example needed the assumption of storing
single CSS properties in a field to make sense. That's not a limitation
of the idea of adding a unique element nil to any domain; after all,
*you* wanted an example and not an academic discussion.
[...]
> ...but there is one thing I don't need: 'IsNull' for string fields.
> The empty string tells it all. I will not write an application that
> gives NULL value of a string field any meaning.
But I will, if it suits me.
> Databases require NULLS for referential integrity, but the distinction
> is superflous, since using a '' for a key value is madness.
Who's talking about key values? Databases are for storing data, and it
may suit me to distinguish the cases of a string field having the empty
string or _no_ string as its value.
> Thus, the "inherited"/"override" problem should be handled otherwise.
What's wrong with handling it by using "no value" to denote "not an
override in place"? You (effectively) asked for an example; I gave you
one. Don't be too surprised if I give one that would really work.
> How to show it in a GUI ? I developed a special vertical grid type,
> having an extra column of check boxes indicating whether the value
> was to be left unchanged or specifically set - e.g. to EmptyString.
> No control can show the difference between the two for a string value,
> unless some extra functionality is added.
Okay, so you don't know of any currently existing (single) control that
can. Derive one. It's not hard; one of the nice things about Delphi is
that deriving components isn't hard. Still thinking of my CSS example,
a different background colour could indicate that the displayed value
is inherited, and a context menu might have an option "revert".
> When you 'Clear' a TMemo using your keyboard, what value do you write
> in the underlying field ? You have to decide, right ? It's not obvious
> at all, it's an utterly meaningless ditinction.
You keep saying that, in the face of my example, when *you*, in the best
biblical tradition, called it "good". Let's also not forget something
else: there need not be a one-to-one mapping between what's in the
database and what's in the GUI. In the simplest case, "inherited" is not
a CSS property value itself, it's a pointer to another property's value,
and _that_ value will be used for rendering. In less simple cases, a
database may use a very different data structure and representation than
the one the user eventually sees in a presentation layer, with several
more layers in between.
Groetjes,
Maarten Wiltink
- Previous message: Maarten Wiltink: "Re: [OT] Danger of using FillMem() on a string? Speed of Abs()?"
- In reply to: Bjørge Sæther: "Re: Invalid variant type conversion"
- Next in thread: Bjørge Sæther: "Re: Invalid variant type conversion"
- Reply: Bjørge Sæther: "Re: Invalid variant type conversion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|