davidl
Joined: 17 Aug 2006 Posts: 27
|
Posted: Wed Nov 01, 2006 8:22 pm Post subject: sorry for mistake i made yesterday :) |
|
|
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 |
|