36 self.repo.set_schema(self.repo.deserialize_schema(), resetvreg=False) |
36 self.repo.set_schema(self.repo.deserialize_schema(), resetvreg=False) |
37 self.__class__.schema_eids = schema_eids_idx(self.repo.schema) |
37 self.__class__.schema_eids = schema_eids_idx(self.repo.schema) |
38 |
38 |
39 def index_exists(self, cnx, etype, attr, unique=False): |
39 def index_exists(self, cnx, etype, attr, unique=False): |
40 dbhelper = self.repo.system_source.dbhelper |
40 dbhelper = self.repo.system_source.dbhelper |
41 with cnx.ensure_cnx_set: |
41 sqlcursor = cnx.cnxset.cu |
42 sqlcursor = cnx.cnxset.cu |
42 return dbhelper.index_exists(sqlcursor, |
43 return dbhelper.index_exists(sqlcursor, |
43 SQL_PREFIX + etype, |
44 SQL_PREFIX + etype, |
44 SQL_PREFIX + attr, |
45 SQL_PREFIX + attr, |
45 unique=unique) |
46 unique=unique) |
|
47 |
46 |
48 def _set_perms(self, cnx, eid): |
47 def _set_perms(self, cnx, eid): |
49 cnx.execute('SET X read_permission G WHERE X eid %(x)s, G is CWGroup', |
48 cnx.execute('SET X read_permission G WHERE X eid %(x)s, G is CWGroup', |
50 {'x': eid}) |
49 {'x': eid}) |
51 cnx.execute('SET X add_permission G WHERE X eid %(x)s, G is CWGroup, ' |
50 cnx.execute('SET X add_permission G WHERE X eid %(x)s, G is CWGroup, ' |