コード例 #1
0
ファイル: util.py プロジェクト: peopledoc/django-aggtrigg
 def drop_functions(self):
     """DROP all related functions
     """
     res = 0
     for sql in self.sql_drop_functions():
         res = res + dbcommands.execute_raw(sql)
     return res
コード例 #2
0
ファイル: util.py プロジェクト: peopledoc/django-aggtrigg
 def drop_triggers(self, name):
     """DROP related triggers
     """
     res = 0
     for sql in self.sql_drop_triggers(name):
         res = res + dbcommands.execute_raw(sql, self.database)
     return res
コード例 #3
0
ファイル: util.py プロジェクト: peopledoc/django-aggtrigg
 def initialize(self):
     """Initialize the agregate table with values from source table
     May be long on huge tables
     """
     sql = self.sql_init()
     res = dbcommands.execute_raw(sql, database=self.database)
     return res
コード例 #4
0
ファイル: util.py プロジェクト: peopledoc/django-aggtrigg
 def create_functions(self):
     """Create all functions in the database
     """
     res = 0
     for sql in self.sql_create_functions():
         if res == 0:
             res = dbcommands.execute_raw(sql, self.database)
     return res
コード例 #5
0
ファイル: util.py プロジェクト: peopledoc/django-aggtrigg
 def create_trigger(self, sql):
     """Create a trigger
     """
     if self.verbose > 2:
         stm = dbcommands.mogrify(sql, database=self.database)
         sys.stdout.write(stm)
     res = dbcommands.execute_raw(sql, self.database)
     return res
コード例 #6
0
ファイル: util.py プロジェクト: peopledoc/django-aggtrigg
    def create_table(self):
        """
        table (string)
        column (string)
        aggregats (array)

        Return :
        - 0 is case of creation + success
        - 1 if table already exists
        """
        if not self.agg_table_ispresent():
            sql = self.sql_create_table()
            return dbcommands.execute_raw(sql, self.database)
        else:
            return 1
コード例 #7
0
ファイル: util.py プロジェクト: peopledoc/django-aggtrigg
 def drop_table(self):
     sql = self.sql_drop_table()
     return dbcommands.execute_raw(sql)