Depending on if a condition is met I want to return a session but don't want to create a new connection.
Poco::Data::Session initialise(){
 if(some condition){
   Poco::Data::Session temp1('odbc',someSettings1)
   return temp1
  }else{
   Poco::Data::Session temp2('odbc',someSettings2)   
   return temp2
   }
}
int main(){
 Poco::Data::Session  sess(initialise());
}
- Does the above create a new connection when I pass the function as a constructor argument?
 - Would it make a difference if I returned it as an anonymous object i.e. 
return Poco::Data::Session('odbc',someSettings1) - Or is there a better way overall to achieve what I want?
 
Aucun commentaire:
Enregistrer un commentaire