Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct StoreProcIO
- {
- StoreProcIO( )
- : _id( 0 ) , _output( 0 )
- {
- }
- std::string _name;
- int _id;
- int _output;
- };
- struct StoreProceBoundIO
- {
- void operator()( dtl::BoundIOs &boundIOs, StoreProcIO &io )
- {
- int i = 0;
- boundIOs[i] << io._id; //(in)
- boundIOs[++i] << io._name; //(in)
- boundIOs[++i] == io._output; //(in/out)
- }
- };
- void init()
- {
- dtl::DBView<StoreProcIO> storeProc( "{call myStoreProc( ?, ?, ? )}", StoreProceBoundIO() );
- dtl::DBView<StoreProcIO>::sql_iterator sqlIter( storeProc );
- StoreProcIO bindIO( storeProc.GetDataObj() );
- bindIO._id = 123;
- bindIO._name = "Test";
- bindIO._output = -1;
- *sqlIter = bindIO; //execute the store procedure
- sqlIter.MoreResults();
- bindIO = *sqlIter; //get output parameters
- }
Add Comment
Please, Sign In to add comment