コード例 #1
0
ファイル: ticket.py プロジェクト: nyuhuhuu/trachacks
    def set_location(self, ticket, lat, lon):
        """
        sets the ticket location in the db
        * ticket: the ticket id (int)
        * lat, lon: the lattitude and longtitude (degrees)
        """

        # determine if we need to insert or update the table
        # (SQL is retarded)
        if get_first_row(self.env, "select ticket from ticket_location where ticket='%s'" % ticket):
            execute_non_query(
                self.env,
                "update ticket_location set ticket=%s, latitude=%s, longitude=%s where ticket=%s",
                ticket,
                lat,
                lon,
                ticket,
            )
        else:
            execute_non_query(
                self.env,
                "insert into ticket_location (ticket, latitude, longitude) values (%s, %s, %s)",
                ticket,
                lat,
                lon,
            )
コード例 #2
0
ファイル: ticket.py プロジェクト: nyuhuhuu/trachacks
    def delete_location(self, ticket):
        """
        deletes a ticket location in the db
        * ticket: the ticket id (int)
        """

        if get_first_row(self.env, "select ticket from ticket_location where ticket='%s'" % ticket):
            execute_non_query(self.env, "delete from ticket_location where ticket='%s'" % ticket)
コード例 #3
0
ファイル: ticket.py プロジェクト: pombredanne/trachacks
    def delete_location(self, ticket):
        """
        deletes a ticket location in the db
        * ticket: the ticket id (int)
        """

        if get_first_row(
                self.env,
                "select ticket from ticket_location where ticket='%s'" %
                ticket):
            execute_non_query(
                self.env,
                "delete from ticket_location where ticket='%s'" % ticket)
コード例 #4
0
ファイル: ticket.py プロジェクト: pombredanne/trachacks
    def set_location(self, ticket, lat, lon):
        """
        sets the ticket location in the db
        * ticket: the ticket id (int)
        * lat, lon: the lattitude and longtitude (degrees)
        """

        # determine if we need to insert or update the table
        # (SQL is retarded)
        if get_first_row(
                self.env,
                "select ticket from ticket_location where ticket='%s'" %
                ticket):
            execute_non_query(
                self.env,
                "update ticket_location set ticket=%s, latitude=%s, longitude=%s where ticket=%s",
                ticket, lat, lon, ticket)
        else:
            execute_non_query(
                self.env,
                "insert into ticket_location (ticket, latitude, longitude) values (%s, %s, %s)",
                ticket, lat, lon)