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'm doing is object oriented. 
  Here is the code:  
   
  [code]
//callback function
  static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
  int i;
  for(i=0; i<argc; i++){
    printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  }
  printf("\n");
  return 0;
};
  
// this callback is referenced here.   
  void MyClass::executeSQLStatement()
{
 rc = sqlite3_exec(db, "select * from table1" , callback, 0, &zErrMsg);
};
   
  [/code]
   
   
  However I am trying to add a vector in the callback function to store the 
results.  When I put the vector in it seems I am forced to do something like 
this:
   
   
  [code]
vector vecX;
 
static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
  int i;
  for(i=0; i<argc; i++){
    printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
  }
  vecX.push_back(argv[3]);
  
  printf("\n");
  return 0;
};
  [/code]
  Now this doesn't seem object oriented ? 
Nor do I understand how I would access this  vector from other classes ? 
And I don't know how this vector which I created can be considered part of the 
class ? it seems to me to only have page scope. 
  Any advice on how to make my vector object oriented or accessible by other 
classes ? 
   
  Thanks in Advance 
  Stephen 

       
---------------------------------
Pinpoint customers who are looking for what you sell. 

Reply via email to