• Main Page
  • Namespaces
  • Data Structures
  • Files
  • File List

/www/proggenOrg/dedupe/export/trunk/dataholding/sqlitewrapper.h

Go to the documentation of this file.
00001 
00008 #ifndef ORG_PROGGEN_DEDUPE_DATAHOLDING_SQLITEWRAPPER_H
00009 #define ORG_PROGGEN_DEDUPE_DATAHOLDING_SQLITEWRAPPER_H
00010 
00011 #include <sqlite3.h>
00012 #include <string>
00013 #include <map>
00014 #include <vector>
00015 
00016 #include <stdexcept>
00017 #include <cstdlib>
00018 
00019 namespace Dedupe
00020 {
00021   namespace Dataholding
00022   {
00029     class SqliteWrapper
00030     {
00034       public:
00035 
00039       enum WrapperCode
00040       {
00041         WrapperOk,         
00042         WrapperError     
00043       };
00044 
00048       typedef std::map<std::string,std::string> Row;
00049 
00053       typedef std::vector<Row> Result;
00054 
00061       SqliteWrapper( std::string Path );
00062 
00063 
00068       virtual ~SqliteWrapper();
00069 
00076       WrapperCode SqlExec( const std::string &sql_com );
00077 
00078 
00079       WrapperCode ExecStatement( sqlite3_stmt *stmt );
00080 
00085       Result GetTabledata();
00086 
00090       void FreeResult();
00091 
00092       protected:
00093       //dbs_path holds the path to the database, initialized by the constructor
00094       std::string dbs_path;
00095 
00096       //db_handle is a must for most of the sqlite functions
00097       sqlite3* db_handle;
00098 
00099       //Data from SQL Commands which give an result are stored here
00100       Dedupe::Dataholding::SqliteWrapper::Result ReturningTable;
00101 
00102       //check is used to make sure the sqlite commands are correct
00103       WrapperCode Check( short ret_value );
00104 
00105       private:
00106       SqliteWrapper( const SqliteWrapper& origin );
00107       SqliteWrapper& operator=( const SqliteWrapper& origin);
00108 
00109     };
00110   }
00111 }
00112 #endif

Generated on Mon Mar 11 2013 12:04:52 for Dedupe by  doxygen 1.7.1