Beispiel #1
0
    def __init__(self, logger = None, dbi = None, params = None):
        """
        _init_

        Call the base class's constructor and create all necessary tables,
        constraints and inserts.
        """
        CreateAgentBase.__init__(self, logger, dbi, params)

        self.create["01wm_components"] = \
          """CREATE TABLE wm_components (
             id               INTEGER      NOT NULL,
             name             VARCHAR(255) NOT NULL,
             pid              INTEGER      NOT NULL,
             update_threshold INTEGER      NOT NULL,
             PRIMARY KEY (id),
             UNIQUE (name))"""


        for tableName in self.sequenceTables:
            seqname = '%s_SEQ' % tableName
            self.create["%s%s" % (self.seqStartNum, seqname)] = """
            CREATE SEQUENCE %s start with 1
            increment by 1 nomaxvalue cache 100""" % seqname

            triggerName = '%s_TRG' % tableName
            self.create["%s%s" % (self.seqStartNum, triggerName)] = """
                    CREATE TRIGGER %s
                        BEFORE INSERT ON %s
                        REFERENCING NEW AS newRow
                        FOR EACH ROW
                        BEGIN
                            SELECT %s.nextval INTO :newRow.id FROM dual;
                        END; """ % (triggerName, tableName, seqname)
Beispiel #2
0
    def __init__(self, logger=None, dbi=None, params=None):
        """
        _init_

        Call the base class's constructor and create all necessary tables,
        constraints and inserts.
        """
        CreateAgentBase.__init__(self, logger, dbi, params)

        self.create["01wm_components"] = \
          """CREATE TABLE wm_components (
             id               INTEGER      NOT NULL,
             name             VARCHAR(255) NOT NULL,
             pid              INTEGER      NOT NULL,
             update_threshold INTEGER      NOT NULL,
             PRIMARY KEY (id),
             UNIQUE (name))"""

        for tableName in self.sequenceTables:
            seqname = '%s_SEQ' % tableName
            self.create["%s%s" % (self.seqStartNum, seqname)] = """
            CREATE SEQUENCE %s start with 1
            increment by 1 nomaxvalue cache 100""" % seqname

            triggerName = '%s_TRG' % tableName
            self.create["%s%s" % (self.seqStartNum, triggerName)] = """
                    CREATE TRIGGER %s
                        BEFORE INSERT ON %s
                        REFERENCING NEW AS newRow
                        FOR EACH ROW
                        BEGIN
                            SELECT %s.nextval INTO :newRow.id FROM dual;
                        END; """ % (triggerName, tableName, seqname)
Beispiel #3
0
    def __init__(self, logger=None, dbi=None, params=None):
        """
        _init_

        Call the base class's constructor and create all necessary tables,
        constraints and inserts.
        """
        CreateAgentBase.__init__(self, logger, dbi, params)
Beispiel #4
0
    def __init__(self, logger = None, dbi = None, params = None):
        """
        _init_

        Call the base class's constructor and create all necessary tables,
        constraints and inserts.
        """
        CreateAgentBase.__init__(self, logger, dbi, params)
Beispiel #5
0
    def __init__(self, logger=None, dbi=None, params=None):
        """
        _init_

        Call the base class's constructor and create all necessary tables,
        constraints and inserts.
        """
        CreateAgentBase.__init__(self, logger, dbi, params)

        self.create["02wm_workers"] = \
          """CREATE TABLE wm_workers (
             component_id  INTEGER NOT NULL REFERENCES wm_components(id),
             name          VARCHAR(255) NOT NULL,
             last_updated  INTEGER      NOT NULL,
             state         VARCHAR(255),
             pid           INTEGER,
             last_error    INTEGER,
             error_message VARCHAR(1000),
             UNIQUE (component_id, name))"""

        # constraints added in table definition
        self.constraints.clear()
Beispiel #6
0
    def __init__(self, logger = None, dbi = None, params = None):
        """
        _init_

        Call the base class's constructor and create all necessary tables,
        constraints and inserts.
        """
        CreateAgentBase.__init__(self, logger, dbi, params)
             
        self.create["02wm_workers"] = \
          """CREATE TABLE wm_workers (
             component_id  INTEGER NOT NULL REFERENCES wm_components(id),
             name          VARCHAR(255) NOT NULL,
             last_updated  INTEGER      NOT NULL,
             state         VARCHAR(255),
             pid           INTEGER,
             last_error    INTEGER,
             error_message VARCHAR(1000),
             UNIQUE (component_id, name))"""
         
        # constraints added in table definition
        self.constraints.clear()