/* handle error */
}
/* fetch each row and display */
ret= SQLFetch(hstmt);
if(ret == SQL_NO_DATA_FOUND)
{
printf("No data found");
}
while(ret != SQL_NO_DATA_FOUND)
{
printf("%i%",user_id);
ret=SQLFetch(hstmt);
}
ret = SQLFreeStmt(hstmt, SQL_UNBIND);
if (ret != SQL_SUCCESS)
{
/* handle error */
}
/* free the statement handle */
ret = SQLFreeHandle(SQL_HANDLE_STMT, hstmt);
if (ret != SQL_SUCCESS)
{
/* handle error */
return 1;
}
Example 7 49 DB2 CLI prepare/execute
in one step with SQLGetData & manual commit
SQLHANDLE hstmt; /* statement handle */
SQLINTEGER wk_id;
SQLINTEGER user_id;
SQLCHAR val[15];
/* SQL statements to execute */
SQLCHAR *stmt1 = (SQLCHAR *)"SELECT wk_id, user_id,status FROM warenkorb";
/* set AUTOCOMMIT on */
ret = SQLSetConnectAttr(hdbc,
SQL_ATTR_AUTOCOMMIT,
SQLPOINTER)SQL_AUTOCOMMIT_OFF,
SQL_NTS);
if (ret != SQL_SUCCESS)
Chapter 7. Application porting
209
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved