INF: dbwritetext Sample Code Documentation IncorrectID: Q95125
|
The dbwritetext documentation on page 246 and 247 of the "Programmer's Reference for C" contains incorrect sample code.
On page 246, replace the last part of the code in the example, from the
following lines to the end
while (dbnextrow(q_dbproc)
!= NO_MORE_ROWS);
while (dbnextrow(q_dbproc) != NO_MORE_ROWS)
{
/* Change the value of "abstract_var". */
strcpy(abstract_var, "A brand new value.");
/* Update the text column. */
dbwritetext(u_dbproc, "articles.abstract", dbtxptr(q_dbproc, 1),
DBTXPLEN, dbtxtimestamp(q_dbproc, 1), TRUE,
(DBINT)strlen(abstract_var), abstract_var);
}
/* Done. */
dbexit();
while (dbnextrow(q_dbproc)
!= NO_MORE_ROWS);
while (dbnextrow(q_dbproc) != NO_MORE_ROWS)
{
/* Change the value of part of the text column. This example */
/* adds a sentence to the end of the existing text.*/
/* Update the text column. */
dbwritetext(u_dbproc, 'articles.abstract", dbtxptr(q_dbproc, 1),
DBTXPLEN, dbtxtimestamp(q_dbproc, 1), TRUE,
(DBINT)(strlen(part1) + strlen(part2)), NULL);
dbsqlok(u_dbproc);
dbresults(u_dbproc);
/* Send the update value in chunks. */
dbmoretext(u_dbproc, (DBINT)strlen(part1), part1);
dbmoretext(u_dbproc, (DBINT)strlen(part2), part2);
dbsqlok(u_dbproc);
while (dbresults(u_dbproc) != NO_MORE_RESULTS);
}
dbexit();
Additional query words: db-lib dblib
Keywords : kbprg SSrvDB_Lib SSrvDoc_Err
Version : 4.2 | 4.2 | 4.2
Platform : MS-DOS OS/2 WINDOWS
Issue type :
Last Reviewed: March 16, 1999