Browse Source

[#61] Added the empty functions : update, insert, delete to the LeDataSourceSQL class

Roland Haroutiounian 9 years ago
parent
commit
50af1b16a8
1 changed files with 28 additions and 0 deletions
  1. 28
    0
      leobject/datasources/ledatasourcesql.py

+ 28
- 0
leobject/datasources/ledatasourcesql.py View File

13
         super(LeDataSourceSQL, self).__init__()
13
         super(LeDataSourceSQL, self).__init__()
14
         self.db = Database(self.module, self.conn_args, self.conn_kargs)
14
         self.db = Database(self.module, self.conn_args, self.conn_kargs)
15
 
15
 
16
+    ## @brief update an existing object's data
17
+    # @param lodel_id int : lodel_id of the object to update
18
+    # @param checked_data dict
19
+    # @param filters
20
+    # @param relational_filters
21
+    def update (self, lodel_id, checked_data, filters, relational_filters):
22
+        pass
23
+
24
+    ## @brief create a new object in the datasource
25
+    # @param letype LeType
26
+    # @param leclass LeClass
27
+    # @param data dict : dictionnary of field:value pairs to save
28
+    # @return lodel_id int : lodel_id of the created object
29
+    def insert(self, letype, leclass, **data):
30
+        pass
31
+
32
+    ## @brief delete an existing object
33
+    # @param lodel_id int : lodel_id of the object to delete
34
+    # @param filters list : list of typles formatted as (FIELD, OPERATOR, VALUE)
35
+    # @param relational_filters list
36
+    # @return bool : True on success
37
+    def delete(self, lodel_id, filters, relational_filters):
38
+        pass
39
+
16
     ## @brief search for a collection of objects
40
     ## @brief search for a collection of objects
17
     # @param emclass
41
     # @param emclass
18
     # @param emtype
42
     # @param emtype
19
     # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
43
     # @param filters list : list of tuples formatted as (FIELD, OPERATOR, VALUE)
20
     # @param relational_filters
44
     # @param relational_filters
21
     def get(self, emclass, emtype, field_list, filters, relational_filters):
45
     def get(self, emclass, emtype, field_list, filters, relational_filters):
46
+
22
         tablename =  emclass.name
47
         tablename =  emclass.name
23
         where_filters = self._prepare_filters(filters)
48
         where_filters = self._prepare_filters(filters)
24
         rel_filters = self._prepare_filters(relational_filters)
49
         rel_filters = self._prepare_filters(relational_filters)
26
         self.db.execute(query)
51
         self.db.execute(query)
27
         return all_to_dicts(self.db)
52
         return all_to_dicts(self.db)
28
 
53
 
54
+    # @brief prepares the filters to be used by the mosql library's functions
55
+    # @params filters : (FIELD, OPERATOR, VALUE) tuples
56
+    # @return dict : Dictionnary with (FIELD, OPERATOR):VALUE style elements
29
     def _prepare_filters(self, filters):
57
     def _prepare_filters(self, filters):
30
         prepared_filters = {}
58
         prepared_filters = {}
31
         for filter in filters:
59
         for filter in filters:

Loading…
Cancel
Save