4 ms·
Could you explain why you believe the presence of a NULL in the database necessitates a NULL pointer somewhere in the code?
by bubaflub 10y ago
Could you explain why you believe the presence of a NULL in the database necessitates a NULL pointer somewhere in the code?
- andrewguenther 10y agoI believe the author's intent is if you read a null value out of a database, how would you represent it in code?
- deleted 10y ago[deleted]
- bubaflub 10y agoI think it depends on where the NULL is and what it represents. If NULL value is in a field that is used for JOIN-ing, I don't think you would "represent" the NULL value as much as you would simply have a lack of data. For example, if you had some set of results from a query that contained a JOIN on a field and some values were NULL, those records with the NULL value would not be in the result set. If we do receive results with possibly NULL values I believe they could be either be represented with an appropriate zero value -- e.g. "" or 0 -- or with an optional type like another commenter suggested.