Question

I get the error I mentioned in the title when I try to compile the following code:

void Sql::select(const string table, const string column, const string condition, const string condition_2, const string condition_3) {
otl_stream s;
otl_column_desc* desc;
int desc_len;

const string select = str(format("SELECT %2% FROM %1% WHERE LEFT(%3%, 8) < %6% AND %4% = 'Ausstehend' AND (%5% = '1' OR %5% = '2') ")
        % table % column % condition % condition_2 % condition_3 % getDate());

// cout << select;
    try {
        s.open(10, select.c_str(), con);
    } catch (otl_exception &e) {
        cerr << e.msg;
    }

desc = s.describe_select(desc_len);

}

I am told that otl_column_desc* desc is set but not used. Can you tell me what goes wrong there?

Was it helpful?

Solution

Its exactly what it says, you are setting the variable but not using the value anywhere, meaning this variable is, for all intents and purposes, useless.

desc = s.describe_select(desc_len);//value in desc never used

This sometimes could happen if you make a mistake in your code, and use some other variable when you meant to use this one, and I guess this warning is to catch those cases.

But to answer your question, nothing is wrong since this is a warning, not an error. It is just an indication that something might be wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top