SV: NULL vs Empty String

Kim Gräsman <[email protected]> Thu, 15 Aug 2002 22:53:00 +0200
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <[email protected]>
Hi Alan,
=20
Definitely NULL, but a SQL-NULL, not a C++-NULL.
You need a status member (DBSTATUS tcVal_status) of your accessor to =
signify that the member (tcVal) should be nulled in the DB.
=20
Does that help?
=20
Kim

        -----Ursprungligt meddelande-----=20
        Fr=E5n: Alan Gamboa [mailto:[email protected]]=20
        Skickat: to 2002-08-15 22:34=20
        Till: [email protected]=20
        Kopia:=20
        =C4mne: NULL vs Empty String
=09
=09
        Hello all, a question on best practices...
        =20
        Which is the accepted practice in database storage for varchar type =
fields...
        =20
        record is defined as below:
        =20
        class CAccRecType
        {
            public:
            CAccRecType() { Clear() };
           =20
            LONG     lKey;
            TCHAR    tcVal[10];
            int            iMoreData;
          =20
            void Clear() { memset(this,0,sizeof(*this) );
        }
        =20
        usage:
        =20
            CAccRecType    rec;
            rec.lKey =3D 100L;
            rec.iMoreData =3D 50;
            [ add record to database ]
        =20
        if the field is not "used" in a record, what should be stored on the =
database -  NULL or "an empty string" ?
        =20
        tia
        =20
        Alan Gamboa
        CCG Systems, Inc.
        =20

You can read messages from the OLEDB_DEV archive, unsubscribe from =
OLEDB_DEV, or subscribe to other DevelopMentor lists at =
http://discuss.develop.com.

You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.