Re: Better comparing and converting of variant values...?

From: Bjørge Sæther (bjorge_at_hahaha_itte.no)
Date: 04/29/04

  • Next message: Bjørge Sæther: "Re: Impact of TSession"
    Date: Thu, 29 Apr 2004 09:03:57 +0200
    
    

    pr wrote:
    > "Bjørge Sæther" <bjorge@hahaha_itte.no> wrote in message
    > news:Khvjc.427$Yc.5982@news4.e.nsc.no...
    >> You need to do a lot of checking before trying to compare or cast
    >> variants. To my application, an 'Unassigned' variant should be
    >> resulting in an empty string value, an empty string should equal an
    >> unassigned, etc., etc.. The matrix is quite large then...
    >
    > An empty string is not an unassigned, it is an empty string!
    > Unassigned means just that, no data type, no value.
    > An unassigned may be considered an empty string in
    > some implementations, but this is not the case in SQL.

    Oracle stores and treats '' as NULL. Which, IMHO, is correct. For STRINGS,
    that is. A Delphi string type doesn't distinguish between '' and NULL.

    > Confuse the two at your own peril.

    I don't *confuse* anything, I just said that I need a few code snippets that
    returns values much like TField does, and that doesn't throw exceptions when
    a string field is NULL - just gently return ''. As it is now, I need to do a
    lot of checking all the time.

    If anyone attending this group had made these routines (and would share
    them), I'd have them by now. So - I'll have to do it myself....;-)

    -- 
    Regards,
    Bjørge Sæther
    bjorge@haha_itte.no
    -------------------------------------
    I'll not spend any money on American Software products
    until armed forces are out of Iraq.
    

  • Next message: Bjørge Sæther: "Re: Impact of TSession"

    Relevant Pages

    • Re: Magic Excel function or UDF?
      ... code to handle implicit type conversions ... ... I understand that using variants is slower than typed variables; ... If it's an empty string ...
      (microsoft.public.excel.programming)
    • Re: Better comparing and converting of variant values...?
      ... > varEmpty The Variant is Unassigned. ... > varNull The Variant is Null. ... > routines for variants. ... string value, an empty string should equal an unassigned, etc., etc.. ...
      (comp.lang.pascal.delphi.misc)
    • Re: Date format in repeater control
      ... databinding expression in the aspx. ... expressions should not blow up with null values (DBNull), ... However, if you need to cast to a date in code, you can nothing but check ... outout empty string, ...
      (microsoft.public.dotnet.framework.aspnet)