|
I'm wondering whether it's considered okay to do something like this.
if ( p_Pointer != NULL ) { return p_Pointer; } else { return NULL; }
Without the else, whatever. The point is that if the pointer is null, NULL is going to be returned, so it would ...
Started by Anonymous on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
) { return p_Pointer; } else { assert(p_Pointer); return NULL; }
or
assert(p_Pointer); return p_PointerYou could just say:
return p_Pointer;
Because the if statement is superfluous in that case to
if( flag == TRUE )....
|
|
I have a web service API. Some calls return objects containing text fields with information provided by the user. From both a design and a security standpoint, what are the downsides to returning null in those fields when no information has been provided...
Answer Snippets (Read the full thread at stackoverflow):
There's....
returning an empty string.
A null value, a web service returning that value should ideally return null instead of an emptyI don't think there's a security issue involved with returning null vs.
|
|
Is it possible for a VB.net function with a return type of integer to return null ?
Started by mat690 on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
If you're strictly....
You'll need a return type of Nullable from an Integer returning function
Public Function Example() As Integer Return Nothing End Function
(Of Integer).
Only if it is defined as returning a nullable integer.
|
Ask your Facebook Friends
|
How do you return 0 instead of null when running the following command:
SELECT MAX(X) AS MaxX FROM tbl WHERE XID = 1
(Assuming there is no row where XID=1)
Started by cf_PhillipSenn on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
MAX(X), 0, MAX(X)) AS MaxX FROM tbl WHERE XID = 1
or
SELECT CASE MAX(X) WHEN NULL THEN 0 ELSE MAX(X use COALESCE ( expression [ ,...n ] ) - returns first non-null like:
SELECT COALESCE(MAX(X),0.
|
|
How can I prevent inner SELECT from returning NULL (when matches no rows) and force query to fail.
INSERT INTO tt (t1_id, t2_id) VALUES ( (SELECT id FROM t1 WHERE ...), (SELECT id FROM t2 WHERE ...) );
Side question: is there better way form this query...
Started by Ćukasz Lew on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
You may also prefer to use SELECT....
AND t1.id IS NOT NULL AND t2.id IS NOT NULL ...
To return if SELECT returns NULL
for t1.id and t2.id to be NULL then include the relevant clause in your WHERE condition ( ...
|
|
Never seen this one before.
WebService.Implementation imp = new WebService.Implementation(); WebService.ImplementationRequest req = new WebService.ImplementationRequest(); return imp.GetValue(req);
The object that imp returns is not null. It's returning...
Started by Xaiter on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Stackoverflow.com/questions/560370/handling-wcf-proxy-null-return-issue
I suppose I should also note;DataMember()> _ Public Property SomeField() As String Get Return m_strSomeField End Get Private that the WebService should....
|
|
I've heard some voices saying that checking for a returned null value from methods is bad design. I would like to hear some reasons for this.
pseudocode:
variable x = object.method() if (x is null) do something
Started by koen on
, 21 posts
by 21 people.
Answer Snippets (Read the full thread at stackoverflow):
Returning ....
G'day,
Returning NULL when you are unable to create a new.
Since throw exceptions when you don't need to.
Writes that returning null is bad design when you can instead return, say, empty array.
|
|
Good Morning All. I've been struggling with this issue for a while now, and I can't seem to wrap my head around it.
So I have two tables in my Database
tblDateTrans CREATE TABLE [dbo].[tblDateTrans]( [Date] [smalldatetime] NOT NULL, )
This table is an...
Started by whobutsb on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
= 4)
to this:
AND (dbo.tblSurveySession.FK_StoreId = 4 OR dbo.tblSurveySession.FK_StoreId IS NULL.
|
|
//here assembly is loaded Assembly asm = Assembly.LoadFile(@"C:\Documents and Settings\E454930\Desktop\nunit_dll_hutt\for_hutt_proj\bin\Debug\for_hutt_proj.dll"); Type type = asm.GetType("for_hutt_proj.class1"); //returning null object instance = Activator...
Started by Arunachalam on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You could try:
Type type = asm.GetType("for_hutt_proj.class1", false, true);
which will do a case-insensitive... .
The only things I wonder is whether the casing of the type-name is correct .
Looks fine...
Try posting more info, and use formatting.
Seems fine.
|
|
The oracle data source is returning null connection when the no of connection request is more. I have the implict cache enabled.The oracle specs says null is returned only is ConnectionWaitTimeout is set. I do not have a value set for ConnectionWaitTimeout...
Started by Java Guy on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
When I explicitly specified a value the connection was waiting, even the value to 0 was giving me a null connection..
The datasource was returning null..
|