With C++ can you return a sqlite3_stmt from a method?
===

I'm trying to reduce duplicate sqlite code in my object. To do so I wanted one method that had the sqlite interaction and just return a sqlite3_stmt. My problem is that the sqlite3_stmt pointer is always null.  My question is, am I doing something wrong or can this not be done with sqlite?

Usage:

    SqliteIO sqldb;
    string GET_CONFIG = "select* from config; ";
    sqlite3_stmt *statement;
    assert(sqldb.sqlForResults(GET_CONFIG, statement));
    assert(statement != NULL); //this fails
    
 Method:   
 bool SqliteIO::sqlForResults(string pSql, sqlite3_stmt *statement ){
    	bool lbRetVal=false;
    
    	if(mDB == NULL){
    		cerr << "No database to query";
    		Logger::error("SqlliteIO::getAllScheuled() null database handle");
    	} else {
    		sqlite3_busy_timeout(mDB, 2000);
    		if(sqlite3_prepare_v2(mDB, pSql.c_str(), -1, &statement, 0) == SQLITE_OK) {
    			lbRetVal = true;
    		}
    		string error = sqlite3_errmsg(mDB);
    		if(error != "not an error"){
    			cerr << pSql << " " << error << endl;
    			Logger::error("SqlliteIO::sqlForResults() "+ error + " " +pSql  );
    		}
    	}
    	return lbRetVal;
    }