NULL vs Empty String
Alan Gamboa <[email protected]> Thu, 15 Aug 2002 16:34:30 -0400
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <[email protected]> |
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C2449B.282FE8A0
Content-Type: text/plain;
charset="iso-8859-1"
Hello all, a question on best practices...
Which is the accepted practice in database storage for varchar type
fields...
record is defined as below:
class CAccRecType
{
public:
CAccRecType() { Clear() };
LONG lKey;
TCHAR tcVal[10];
int iMoreData;
void Clear() { memset(this,0,sizeof(*this) );
}
usage:
CAccRecType rec;
rec.lKey = 100L;
rec.iMoreData = 50;
[ add record to database ]
if the field is not "used" in a record, what should be stored on the
database - NULL or "an empty string" ?
tia
Alan Gamboa
CCG Systems, Inc.
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.
------_=_NextPart_001_01C2449B.282FE8A0
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2716.2200" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>Hello all, a
question on best practices...</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>Which is the
accepted practice in database storage for varchar type
fields...</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>record is defined as
below:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>class
CAccRecType</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002>{</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
public:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
CAccRecType() { Clear() };</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
LONG lKey;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
TCHAR tcVal[10];</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
int
iMoreData;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
void Clear() { memset(this,0,sizeof(*this) );</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002>}</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002>usage:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
CAccRecType rec;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
rec.lKey = 100L;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>
rec.iMoreData = 50;</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002> [
add record to database ]</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=834252220-15082002>if the field is not
"used" in a record, what should be stored on the database - NULL or "an
empty string" ?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002>tia</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=834252220-15082002></SPAN></FONT> </DIV>
<DIV align=left>
<DIV align=left><FONT face=Arial size=2>Alan Gamboa</FONT></DIV>
<DIV align=left><B><FONT face=Arial size=2>CCG Systems,
Inc.</FONT></B></DIV></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML>
You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.
------_=_NextPart_001_01C2449B.282FE8A0--