virtual bool Create(bool writable = false);
/// Destroys the 'source'
virtual bool Destroy();
+ /// Begins a transaction
+ virtual void BeginTransaction();
+ ///Commits results and ends transaction
+ virtual void EndTransaction();
//====================================================================
// WITHOUT altering the source, e.g. the database
virtual void UnLoad(tree::Node* n);
///====================================================================
-
+
+ //====================================================================
+ /// Returns the top level node id for the given search param and search value
+ virtual void GetTopLevelNodeId(const std::string& searchParam,
+ const std::string& searchValue,
+ std::string& parent_id);
+ ///====================================================================
//====================================================================
// WRITE METHODS : WORK ONLY IN WRITE MODE
const std::string& searchVal);
//Deletes the tuple that matches the parameters given
virtual void DeleteTuple(std::string levelDescriptor, std::string key, std::string value);
+ //Deletes the entries that match the parameters given
+ virtual void RemoveEntries(const std::string i_table,
+ const std::string i_attribute,
+ const std::string i_operand,
+ const std::string i_val);
//====================================================================
void DBDelete(std::string levelDescriptor, std::string key, std::string value);
//======================================================================
+ //======================================================================
/// Recursively Removes the nodes whose parent is given as a parameter
void DBRecursiveRemoveNode(tree::Node* node);
- /*
- ///
- int DBQueryNumberOfChildren(tree::Node* n);
-
- // Insertion
- bool DBInsert(tree::Node* alien_node) ; //, UpdateSummary& summary);
-
- //
- std::string DBGetNodeId(tree::Node* node, const std::string& parent_id);
-
- tree::Node* GetNodeFromTypeId(int level,
- const std::string& id);
-
- //
- tree::Node* DBGetOrCreateNode(tree::Node* alien_node,
- tree::Node* internal_parent,
- std::string parentid,
- std::string& created_id);
- // UpdateSummary& summary);
-
- tree::Node* DBGetOrCreateParent(tree::Node* alien_node,
- std::string& parent_id);
- // UpdateSummary& summary);
-
- void DBRecursiveGetOrCreateNode(tree::Node* alien_node,
- tree::Node* parent,
- const std::string& parent_id);
- // UpdateSummary& summary);
-
-
- */
-
- /*
-
- void BuildSQLFieldsValues(tree::Node* n,
- std::string& str);
-
+ /// Recursively Removes the nodes found in the given level with the given parent id
+ void DBRecursiveRemoveNode(int level, std::string parentId);
+
+ //======================================================================
- tree::Node* GetChildrenLike(tree::Node* internal_parent,
- tree::Node* alien_node);
- */
+
private:
/// The DB
CppSQLite3DB* mDB;
std::string mFileName;
/// Is the DB writable ?
bool mWritable;
- void SetWritable(bool w) { mWritable; }
+ void SetWritable(bool w) { mWritable = w; }
bool GetWritable() const { return mWritable; }
bool mIsAdding;
- /*
- struct TypeId
- {
- int type;
- std::string id;
- bool operator< (const TypeId& o) const
- {
- return ((type<o.type) ||
- ((type==o.type)&&id<o.id));
- }
- };
-
- typedef std::map<TypeId,tree::Node*> TypeIdToNodeMapType;
- TypeIdToNodeMapType mTypeIdToNodeMap;
- */
+
};
// EO class SQLiteTreeHandler
//=======================================================================