Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-13 Thread Stephen Sutherland
Thanks Igor I used your solution and it work. Char* was the problem. I'll use strings from now on . Stephen Igor Mironchick <[EMAIL PROTECTED]> wrote: I think problem is in use char * as parameter in push function. For that reason I use std::string always. Look, in callback2 SQLite pas

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-10 Thread John Stanton
Sqlite has a feature where you can contanenate SQL statements and prepare and step them in a loop. Prepare returns a pointer to the start of the next statement. The basic prepare/step/reset activity requires that there be a loop to handle multiple rows, busy returns and possible errors. Ste

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-10 Thread Dennis Cote
Stephen Sutherland wrote: okay i'm trying to use preparestatement and step and finalize. I have some quick questions about this legacy.c code. First I notice that it has a while loop within a while loop. Question: when I implement this prepared statement, will I also need a while loo

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-10 Thread Igor Mironchick
Hi, guys. Dennis Cote wrote: Stephen, You should look into using the newer prepare/step API functions instead of the callback mechanism. It will make your code clearer, and will probably execute faster as well. I don't think so. Prepare/step mechanism can invoke productivity of "INSERT" or

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Igor Mironchick
I think problem is in use char * as parameter in push function. For that reason I use std::string always. Look, in callback2 SQLite pass char ** - array of char*. But when your code leave callback2 SQLite might errase that array and then all char* will garbage. But when in push method you will p

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Stephen Sutherland
okay i'm trying to use preparestatement and step and finalize. I have some quick questions about this legacy.c code. First I notice that it has a while loop within a while loop. Question: when I implement this prepared statement, will I also need a while loop within a while loop ?

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Stephen Sutherland
Igor I tried your solution and can't get it working . Here is my code. The STRANGE problem that I am having is that when it adds to the vector at position 1, the vector contains the object. But when it adds to vector at position 2 using push_back - for some reason the contents at

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Stephen Sutherland
Thanks I guess i have to figure out how to use prepared statements instead of callbacks because i can't get callbacks working as expected. Dennis Cote <[EMAIL PROTECTED]> wrote: Stephen Sutherland wrote: > Hi > > I am using the 'quick start' C-styled code for sqlite3 > http://www.sql

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Dennis Cote
Stephen Sutherland wrote: Hi I am using the 'quick start' C-styled code for sqlite3 http://www.sqlite.org/quickstart.html I think I'm running into a problem trying to put it in classes to make it somewhat object oriented. So I'm asking for help about how to make it object-oriented - or to

RE: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Lee Crain
ord7< Field0, Field1, Field2, FieldN > Lee Crain __ -Original Message- From: Lee Crain [mailto:[EMAIL PROTECTED] Sent: Thursday, August 09, 2007 1:45 PM To: sqlite-users@sqlite.org Subject: RE: [sqlite] Object Oriented Question About Adding a vector inside the callback function St

RE: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Lee Crain
urce code will not. I hope this helps, Lee Crain -Original Message- From: Stephen Sutherland [mailto:[EMAIL PROTECTED] Sent: Thursday, August 09, 2007 1:06 PM To: sqlite-users@sqlite.org Subject: [sqlite] Object Oriented Question About Adding a vector inside the callback function Hi

Re: [sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Igor Mironchick
If I understand you right then try it: static int add_value( void *st, int, char **value, char ** ) { storage_t * storage = (storage_t*) st; st->push( value[ 0 ] ); return SQLITE_OK; }; class storage_t { public: storage_t() :m_db( 0 ) { sqlite3_open( "your_databa

[sqlite] Object Oriented Question About Adding a vector inside the callback function

2007-08-09 Thread Stephen Sutherland
Hi I am using the 'quick start' C-styled code for sqlite3 http://www.sqlite.org/quickstart.html I think I'm running into a problem trying to put it in classes to make it somewhat object oriented. So I'm asking for help about how to make it object-oriented - or to confirm whether what I'