00001 #ifndef INCLUDE_ORA_RELATIONALBUFFER_H 00002 #define INCLUDE_ORA_RELATIONALBUFFER_H 00003 00004 // 00005 #include <string> 00006 #include <vector> 00007 #include <boost/shared_ptr.hpp> 00008 // 00009 #include <memory> 00010 00011 namespace coral { 00012 class ISchema; 00013 class Blob; 00014 } 00015 00016 namespace ora { 00017 00018 class IRelationalOperation; 00019 class InsertOperation; 00020 class BulkInsertOperation; 00021 class MultiRecordInsertOperation; 00022 class UpdateOperation; 00023 class DeleteOperation; 00024 00025 class RelationalBuffer { 00026 00027 public: 00028 00029 explicit RelationalBuffer( coral::ISchema& schema ); 00030 00031 virtual ~RelationalBuffer(); 00032 00033 InsertOperation& newInsert( const std::string& tableName ); 00034 BulkInsertOperation& newBulkInsert( const std::string& tableName ); 00035 MultiRecordInsertOperation& newMultiRecordInsert( const std::string& tableName ); 00036 UpdateOperation& newUpdate( const std::string& tableName, bool addToResult=false ); 00037 DeleteOperation& newDelete( const std::string& tableName, bool addToResult=false ); 00038 00039 RelationalBuffer& addVolatileBuffer(); 00040 00041 void storeBlob( boost::shared_ptr<coral::Blob> blob ); 00042 00043 void clear(); 00044 bool flush(); 00045 00046 private: 00047 00048 coral::ISchema& m_schema; 00049 std::vector< std::pair<IRelationalOperation*, bool> > m_operations; 00050 std::vector<RelationalBuffer*> m_volatileBuffers; 00051 std::vector< boost::shared_ptr<coral::Blob> > m_blobBuffer; 00052 }; 00053 00054 } 00055 #endif 00056 00057 00058