For starters sqlite3_column_count( ) should be after prepare once.
You don't need to do it for every step.

The other thing is do you have to use STL when you can do everything by
using SQLite?
Tell us in English what you want to accomplish with your code. We can come
up with a pure SQLite solution.

Thanks,
-Alex

On Tue, Jun 10, 2008 at 10:12 AM, piotro <[EMAIL PROTECTED]> wrote:

> Hello. I really need help with this, because Im almost out of
> ideas here. Help please!
>
> sqldata is a vector< vector < char* > >
> row is a vector < char* >
>
> sqldata sql3wrapper::pobierzPodmiot(){
>    const char* tail;
>    sqlite3_stmt* statement;
>
>    std::string query = squery("SELECT * FROM %;",PODMIOTY_TABLE);
>
>    sqlite3_prepare_v2(interface,query.c_str(),-1,&statement,&tail);
>    sqldata data;
>    for(int a=0;sqlite3_step(statement)!=101;a++){
>        row set;
>        data.push_back(set);
>        for(int az=1; az<sqlite3_column_count(statement); az++){
>            data[a].push_back((char*)sqlite3_column_text(statement,az));
>    }
>        std::cout<<(data[a])[2]<<std::endl;
>    }
>    return data;
>    sqlite3_finalize(statement);
> }
>
> this does cout properly. But when I'm using it in a different place:
>
> int main(){
> sqldata est = sql3wrapper().pobierzPodmiot();
>
>    row one = est[0];
>    row two = est[1];
>    row three = est[2];
>
>    std::cout<<'\n'<<std::endl;
>    std::cout<<one[2]<<std::endl;
>    std::cout<<two[2]<<std::endl;
>    std::cout<<three[2]<<std::endl;
> }
>
> the data is couted properly, but the values are just the values coming
> from the last row.
>
> I have three rows of data in the sqlite database. Then I use the
> pobierzPodmiot
> function, get the data correctly, but when the function is used
> somewhere else,
> it hickups pretty much.
>
> Can someone come up with a solution or something, coping with this had
> been tiresome.
>
> Cheers!
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to