SQLPrepare with SQLFetchScroll???? Can it be done?
Posted in 2006
Topics: General Discussion
The snippet of example code below os how I'm setting up a select with a where clause. I don't want to have a loop to get all the rows and I read about SQLFetchScroll. But for the life of me I can't work out how I can get all the qualifying rows from this SQLFetchScroll. It seems to me that the SQLFetchScroll can't be in the same code block as SQLPrepare? But then, how can I selectively return rows from a table? I can't even find a book on this stuff and it's driving me bananas. Any help AT all will be appreciated, Kate /* gets ONE row */ ret = SQLPrepare( hstmt, "select * from num_test where role_id = ?", SQL_NTS ); ival = 0; ret = SQLBindParameter( hstmt, 1, SQL_PARAM_INPUT, SQL_C_DOUBLE, SQL_NUMERIC, 0, 0, &dval, sizeof( dval ), &ival ); dval = 1.0; ret = SQLExecute( hstmt ); ret = SQLFetch( hstmt ); ret = SQLGetData( hstmt, 1, SQL_C_CHAR, str, sizeof( str ), &ival );
You can find Informix CLI online manual here: http://publib.boulder.ibm.com/epubs/html/25122940/25122940tfrm.htm - See the chap. "Working with Rows and Collections". You can also download the manual as pdf file http://www-306.ibm.com/software/data/informix/pubs/library/csdk_29.html kjuliff@gmail.com wrote: > The snippet of example code below os how I'm setting up a select with > a where clause. > > I don't want to have a loop to get all the rows and I read about > SQLFetchScroll. But for the life of me I can't work out how I can get > all the qualifying rows from this SQLFetchScroll. > > It seems to me that the SQLFetchScroll can't be in the same code block > as SQLPrepare? But then, how can I selectively return rows from a > table? > > I can't even find a book on this stuff and it's driving me bananas. > > Any help AT all will be appreciated, > > Kate > > > > /* gets ONE row */ > > ret = SQLPrepare( hstmt, "select * from num_test where role_id = ?", > SQL_NTS ); > ival = 0; > ret = SQLBindParameter( hstmt, 1, SQL_PARAM_INPUT, SQL_C_DOUBLE, > SQL_NUMERIC, 0, 0, &dval, sizeof( dval ), &ival ); > dval = 1.0; > ret = SQLExecute( hstmt ); > ret = SQLFetch( hstmt ); > ret = SQLGetData( hstmt, 1, SQL_C_CHAR, str, sizeof( str ), &ival ); >