shows performance issue while building the comma separted the value to single char*


hi folks,

presently i am facing delay issue while making comma separted values .
pls provide the valuable solution to resolve the issue.Below mentioned problematic code ,


for (int32 iRow = MINC3_INITVAL; iRow < oTableQuery.numRows(); iRow++)
{
oTableQuery.setRow(iRow);
for ( iField = MINC3_INITVAL; iField < oTableQuery.numFields(); iField++ )
{
if (!oTableQuery.fieldIsNull(iField))
{
#ifdef _DB_DEBUG_
cout << oTableQuery.fieldValue(iField) << "|";
#endif

m_iBuflength = static_cast<int32>( strlen( mpcTmpbuf ) );
strcpy( &mpcTempbuff[ m_iBuflength ], mpcTmpbuf );

strcpy( mpcTempbuff, mpcTmpbuf );
sprintf( mpcTempbuff, "%s," , oTableQuery.getStringField( iField ) );
strcpy( mpcTmpbuf, mpcTempbuff );

}
else
{
#ifdef _DB_DEBUG_
cout << "BUFNULL" << "|";
#endif

m_iBuflength = static_cast<int32>( strlen( mpcTempbuff ) );
strcpy( &mpcTempbuff[ m_iBuflength ], "BUFNULL" );

m_iBuflength = static_cast<int32>( strlen( mpcTempbuff ) );
strcpy( &mpcTempbuff[ m_iBuflength ], "," );
}
}

#ifdef _DB_DEBUG_
cout << endl;
#endif
}

example

1 2 4 are values 1st row column value need to be 1,2,4 .
which one slow the process of execution .finally it shows performance issue while building the comma separted the value to single char*
Why not print/record the time where you have those debug statements? Obviously, the things that are taking time are methods on oTableQuery, you should time those to begin with.

Also, please format your code using the relevant tags.
Topic archived. No new replies allowed.