Guest User

Untitled

a guest
Jul 18th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. struct StoreProcIO
  2. {
  3. StoreProcIO( )
  4. : _id( 0 ) , _output( 0 )
  5. {
  6. }
  7.  
  8. std::string _name;
  9. int _id;
  10. int _output;
  11. };
  12.  
  13. struct StoreProceBoundIO
  14. {
  15. void operator()( dtl::BoundIOs &boundIOs, StoreProcIO &io )
  16. {
  17. int i = 0;
  18. boundIOs[i] << io._id; //(in)
  19. boundIOs[++i] << io._name; //(in)
  20. boundIOs[++i] == io._output; //(in/out)
  21. }
  22. };
  23.  
  24. void init()
  25. {
  26. dtl::DBView<StoreProcIO> storeProc( "{call myStoreProc( ?, ?, ? )}", StoreProceBoundIO() );
  27.  
  28. dtl::DBView<StoreProcIO>::sql_iterator sqlIter( storeProc );
  29.  
  30. StoreProcIO bindIO( storeProc.GetDataObj() );
  31. bindIO._id = 123;
  32. bindIO._name = "Test";
  33. bindIO._output = -1;
  34.  
  35. *sqlIter = bindIO; //execute the store procedure
  36. sqlIter.MoreResults();
  37.  
  38. bindIO = *sqlIter; //get output parameters
  39. }
Add Comment
Please, Sign In to add comment