FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sorry for mistake i made yesterday :)

 
Post new topic   Reply to topic     Forum Index -> DDBI
View previous topic :: View next topic  
Author Message
davidl



Joined: 17 Aug 2006
Posts: 27

PostPosted: Wed Nov 01, 2006 8:22 pm    Post subject: sorry for mistake i made yesterday :) Reply with quote

i didn't see the code carefully enough, actually don't bother
to check the indicator whether less than 0
just add indicator=4 when indicator==SQL_NULL_DATA
but that would make user confused when he has a string also has content
"null", maybe still pass null pointer is good?
return "null" string version
line 94:
if (SQL_SUCCEEDED(SQLGetData(stmt, i, SQL_C_CHAR, buf, buf.length, &indicator))) {
if (indicator == SQL_NULL_DATA) {
buf[0 .. 4] = cast(SQLCHAR[])"null";
buf[4 .. length] = cast(SQLCHAR)'\0';
indicator=4;
}
row.addField(columnNames[i - 1], strip(cast(char[])buf[0 .. indicator]), columnTypesName[i - 1], columnTypesNum[i - 1]);
}

return null pointer version

line 94:
if (SQL_SUCCEEDED(SQLGetData(stmt, i, SQL_C_CHAR, buf, buf.length, &indicator))) {
if (indicator == SQL_NULL_DATA) {
/* buf[0 .. 4] = cast(SQLCHAR[])"null";
buf[4 .. length] = cast(SQLCHAR)'\0';
indicator=4;*/
row.addField(columnNames[i - 1], null, columnTypesName[i - 1], columnTypesNum[i - 1]);
}
else
{
row.addField(columnNames[i - 1], strip(cast(char[])buf[0 .. indicator]), columnTypesName[i - 1], columnTypesNum[i - 1]);
}
}

i think i prefer null pointer version Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDBI All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group