Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with isc_dsql_execute2

Status
Not open for further replies.

NoRulez

Programmer
Nov 20, 2006
1
AT
Hello to all,

i get the following error message from interbase
Code:
attempt to fetch past the last record in a record stream

when I execute the following code:
Code:
int fetch_stat = 0;
if (isc_dsql_execute2(m_connStatus, &m_transaction, &m_statement, dialect, in_sqlda, out_sqlda)) {
//if (isc_dsql_execute2(m_connStatus, &m_transaction, &m_statement, dialect, in_sqlda, NULL)) {
    cout << endl;
    isc_print_status(m_connStatus);
    long *pVector;
    char msg[1024];
    string err_message = "";
    pVector = m_connStatus;
    isc_interprete(msg, &pVector);
    err_message = msg;
    msg[0] = '-';
                
    while(isc_interprete(msg + 1, &pVector))
        err_message += msg;
    cerr << err_message << endl;
}

int fetch_stat = 0;
while ((fetch_stat = isc_dsql_fetch(m_connStatus, &m_statement, 1, out_sqlda)) == 0) {
    for (i = 0; i < out_sqlda->sqld; i++) {
        process_column(&out_sqlda->sqlvar[i]);
    }
}

if (fetch_stat != 100L) { // isc_dsql_fetch returns 100 if no more rows remain to be retrieved
    isc_print_status(m_connStatus);
    long *pVector;
    char msg[1024];
    string err_message = "";
    pVector = m_connStatus;
    isc_interprete(msg, &pVector);
    err_message = msg;
    msg[0] = '-';
                
    while(isc_interprete(msg + 1, &pVector))
        err_message += msg;
    cerr << err_message << endl;
}
The SQL Statement I've executed was as follows:
Code:
SELECT col1, col2, col3, FROM my_table WHERE id>=? AND id <?

Can anybody help to find a solution? I'll have only the fetch columns.

Much thanks and best Regards
NoRulez
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top