![]() You only return once you have a full DB record and have updated that object. Out >(db_record&) you handle your query logic, buffering enough input to be able to construct a DB record object, whatever you need. Instead of reading a file line by line, you are pulling data from a table record by record: idbstream in() Try to think of this as something similar to reading lines from a file, except you are reading records from a database. Use a stream.īased on your comments, it appears that you may be getting hung up on the idea of buffering. Using one or the other is not choosing between two implementations, it is a choice between a basic building block and a more advanced stream interface that people expect. This is because, the std::istream can be used for a HTTP download via Wts Wt::WStreamRessource interface and the file stream obviously, to just store the data as a file.įirst of all, a std::basic_streambuf is basically the building block of a std::XYZstream. measurement data), in this example out of a database mddb via the C++ library odb, converts it into another format, called df here, and now comes the important part: Makes that converted data available for at least an std::istream and also an std::fstream. I'm designing a C++ converter module, that takes custom data (i.e. I my assumed approach at the moment for ? was std::basic_streambuf My assumption:ĪFAIK the foreseen way to stuff data from one std::istream source into another std::ostream sink, like std::ofstream is to just use the <<operator with sources std::streambuf argument, like Note: The data volume may be large, from MB up to GB, so data could be converted in chunks and lazy from the database, which will lead to a chunk of text lines. To better describe it look at the diagram below or use this text data flow: A(ODB) -> COSTLY CONVERSION -> ? -> std::istream ![]() ![]() When you've got a complex converter like, that takes chunks or large result sets out of a database, converts it into a line by line file/resource in the end, should one either design it as std::basic_streambuf or should it be a std::basic_istream or something different, using C++?! ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |