Exemple #1
0
 def searchCodeReviews(self, crStruct):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE "
     queryPart = self.createORLoop(dbEscape(crStruct.Name), "Name")
     if len(queryPart) != 0:
         query = query + "(" + queryPart + ") AND "
     query = query + "Author LIKE '%" + dbEscape(crStruct.Author) + "%' AND Status LIKE '%" + dbEscape(crStruct.Status) + "%' AND DateCreate >= '" + crStruct.DateCreate + "'"
     return self.execCodeReviewQuery(query, False)
Exemple #2
0
 def getVotesByID(self, type, id):
     query = "SELECT Count(Reviewer) FROM Reviewers WHERE IDReview = '" + dbEscape(
         id) + "' AND Vote = '" + dbEscape(type) + "'"
     cursor = self.db.cursor()
     cursor.execute(query)
     row = cursor.fetchone()
     if not row:
         return 0
     return row[0]
Exemple #3
0
 def searchCodeReviews(self, crStruct):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE "
     queryPart = self.createORLoop(dbEscape(crStruct.Name), "Name")
     if len(queryPart) != 0:
         query = query + "(" + queryPart + ") AND "
     query = query + "Author LIKE '%" + dbEscape(
         crStruct.Author) + "%' AND Status LIKE '%" + dbEscape(
             crStruct.Status
         ) + "%' AND DateCreate >= '" + crStruct.DateCreate + "'"
     return self.execCodeReviewQuery(query, False)
 def save(self, db):
     query = ""
     cursor = db.cursor()
     #Add information to a new database entry
     if self.IDReview == "":
         query = "INSERT INTO CodeReviews VALUES(NULL,'" + dbEscape(
             self.Author) + "','" + dbEscape(
                 self.Status
             ) + "','" + ` self.DateCreate ` + "','" + dbEscape(
                 self.Name) + "','" + dbEscape(self.Notes) + "')"
         cursor.execute(query)
         db.commit()
         cursor.execute("SELECT last_insert_rowid() FROM CodeReviews")
         self.IDReview = ` cursor.fetchone()[0] `
     else:
         #Update information in existing database entry
         query = "UPDATE CodeReviews SET Author = '" + dbEscape(
             self.Author
         ) + "', Status = '" + dbEscape(
             self.Status
         ) + "', DateCreate = '" + ` self.DateCreate ` + "', Name = '" + dbEscape(
             self.Name) + "', Notes = '" + dbEscape(
                 self.Notes) + "' WHERE IDReview = '" + dbEscape(
                     self.IDReview) + "'"
         cursor.execute(query)
         db.commit()
     return self.IDReview
Exemple #5
0
 def save(self, db):
     #Add information to a new database entry
     query = "INSERT INTO Reviewers VALUES('" + dbEscape(self.IDReview) + "', '" + dbEscape(self.Reviewer) + "','" + dbEscape(self.Status) + "','" + dbEscape(self.Vote) + "')"
     cursor = db.cursor();
     try:
         cursor.execute(query)
         db.commit()
     except:
         #Update information in existing database entry
         query = "UPDATE Reviewers SET Status = '" + dbEscape(self.Status) + "', Vote = '" + dbEscape(self.Vote) + "' WHERE IDReview = '" + dbEscape(self.IDReview) + "' AND Reviewer = '" + dbEscape(self.Reviewer) + "'"
         cursor.execute(query)
         db.commit()
 def save(self, db):
     cursor = db.cursor()
     if self.IDFile == "":
     #Add information to a new database entry
         query = "INSERT INTO ReviewFiles VALUES(NULL,'" + dbEscape(self.IDReview) + "', '" + dbEscape(self.Path) + "','" + dbEscape(self.LineStart) + "','" + dbEscape(self.LineEnd) + "','" + dbEscape(self.Version) + "')"
         cursor.execute(query)
         db.commit()
         self.IDFile = cursor.lastrowid;
     else:
     #Update information in existing database entry
         query = "UPDATE ReviewFiles SET IDReview = '" + dbEscape(self.IDReview) + "', Path = '" + dbEscape(self.Path) + + "', LineStart = '" + dbEscape(self.LineStart) + "', LineEnd = '" + dbEscape(self.LineEnd) + "', Version = '" + dbEscape(self.Version) + "' WHERE IDFile = '" + dbEscape(self.IDFile) + "'"
         cursor.execute(query)
         db.commit()
     return self.IDFile
 def save(self, db):
     cursor = db.cursor()
     #Add information to a new database entry
     if self.IDComment == "-1":
         query = "INSERT INTO ReviewComments VALUES(NULL,'" + dbEscape(self.IDFile) + "', '" + dbEscape(self.IDParent) + "','" + dbEscape(self.LineNum) + "','" + dbEscape(self.Author) + "','" + dbEscape(self.Text) + "','" + dbEscape(self.AttachmentPath) + "','" + `self.DateCreate` + "')"
         cursor.execute(query)
         db.commit()
         self.IDComment = cursor.lastrowid;
     else:
     #Update information in existing database entry
         query = "UPDATE ReviewComments SET IDFile = '" + dbEscape(self.IDFile) + "', IDParent = '" + dbEscape(self.IDParent) + "', LineNum = '" + dbEscape(self.LineNum) + "', Author = '" + dbEscape(self.Author) + "', Text = '" + dbEscape(self.Text) + "', AttachmentPath = '" + dbEscape(self.AttachmentPath) + "', DateCreate = '" + `self.DateCreate` + "' WHERE IDComment = '" + dbEscape(self.IDComment) + "'"
         cursor.execute(query)
         db.commit()
     return self.IDComment
 def save(self, db):
     query = ""
     cursor = db.cursor()
     #Add information to a new database entry
     if self.IDReview == "":
         query = "INSERT INTO CodeReviews VALUES(NULL,'" + dbEscape(self.Author) + "','" + dbEscape(self.Status) + "','" + `self.DateCreate` + "','" + dbEscape(self.Name) + "','" + dbEscape(self.Notes) + "')"
         cursor.execute(query)
         db.commit()
         self.IDReview = cursor.lastrowid;
     else:
     #Update information in existing database entry
         query = "UPDATE CodeReviews SET Author = '" + dbEscape(self.Author) + "', Status = '" + dbEscape(self.Status) + "', DateCreate = '" + `self.DateCreate` + "', Name = '" + dbEscape(self.Name) + "', Notes = '" + dbEscape(self.Notes) +  "' WHERE IDReview = '" + dbEscape(self.IDReview) + "'"
         cursor.execute(query)
         db.commit()
     return self.IDReview
Exemple #9
0
 def searchCodeReviewsByName(self, name):
     query = self.createORLoop(dbEscape(name), "Name")
     if len(queryPart) == 0:
         query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews"
     else:
         query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE " + dbEscape(query)
     return self.execCodeReviewQuery(query, True)
Exemple #10
0
 def searchCodeReviewsByName(self, name):
     query = self.createORLoop(dbEscape(name), "Name")
     if len(queryPart) == 0:
         query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews"
     else:
         query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE " + dbEscape(
             query)
     return self.execCodeReviewQuery(query, True)
Exemple #11
0
 def getVotesByID(self, type, id):
     query = "SELECT Count(Reviewer) FROM Reviewers WHERE IDReview = '" + dbEscape(id) +"' AND Vote = '" + dbEscape(type) + "'"
     cursor = self.db.cursor()
     cursor.execute(query)
     row = cursor.fetchone()
     if not row:
         return 0
     return row[0]
Exemple #12
0
 def getMyCodeReviews(self, user):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE Author= '" + dbEscape(user) + "' ORDER BY DateCreate"
     return self.execCodeReviewQuery(query, False)
Exemple #13
0
 def getCodeReviews(self, user):
     query = "SELECT CodeReviews.IDReview, CodeReviews.Author, CodeReviews.Status, CodeReviews.DateCreate, CodeReviews.Name, CodeReviews.Notes FROM CodeReviews, Reviewers WHERE Reviewers.IDReview = CodeReviews.IDReview AND Reviewer = '" + dbEscape(user) + "' ORDER BY CodeReviews.DateCreate"
     return self.execCodeReviewQuery(query, False)
Exemple #14
0
 def getCommentsByFileIDAndLine(self, id, line):
     query = "SELECT IDComment, IDFile, IDParent, LineNum, Author, Text, AttachmentPath, DateCreate FROM ReviewComments WHERE IDFile = '" + dbEscape(id) + "' AND LineNum = '" + dbEscape(line) + "' ORDER BY DateCreate"
     return self.execReviewCommentQuery(query, False)
Exemple #15
0
 def getCommentDictForFile(self, id):
     query = "SELECT LineNum, Count(IDComment) FROM ReviewComments WHERE IDFile = '" + dbEscape(id) + "' GROUP BY LineNum"
     cursor = self.db.cursor()
     cursor.execute(query)
     rows = cursor.fetchall()
     d = {} 
     if not rows:
         return d
     for row in rows:
         d[row[0]] = row[1]
     return d
Exemple #16
0
 def getCommentsByFileIDAndLine(self, id, line):
     query = "SELECT IDComment, IDFile, IDParent, LineNum, Author, Text, AttachmentPath, DateCreate FROM ReviewComments WHERE IDFile = '" + dbEscape(
         id) + "' AND LineNum = '" + dbEscape(
             line) + "' ORDER BY DateCreate"
     return self.execReviewCommentQuery(query, False)
Exemple #17
0
 def getCommentByID(self, id):
     query = "SELECT IDComment, IDFile, IDParent, LineNum, Author, Text, AttachmentPath, DateCreate FROM ReviewComments WHERE IDComment = '" + dbEscape(id) + "'"
     return self.execReviewCommentQuery(query, True)
Exemple #18
0
 def getCodeReviewsByID(self, id):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE IDReview= '" + dbEscape(id) + "'"
     return self.execCodeReviewQuery(query, True)
Exemple #19
0
 def getReviewers(self, id):
     query = "SELECT IDReview, Reviewer, Status, Vote FROM Reviewers WHERE IDReview = '" + dbEscape(
         id) + "'"
     return self.execReviewerQuery(query, False)
Exemple #20
0
 def getReviewerEntry(self, id, name):
     query = "SELECT IDReview, Reviewer, Status, Vote FROM Reviewers WHERE IDReview = '" + dbEscape(id) + "' AND Reviewer = '" + dbEscape(name) + "'"
     return self.execReviewerQuery(query, True)
Exemple #21
0
 def getReviewFile(self, id):
     query = "SELECT IDFile, IDReview, Path, LineStart, LineEnd, Version FROM ReviewFiles WHERE IDFile = '" + dbEscape(
         id) + "'"
     return self.execReviewFileQuery(query, True)
Exemple #22
0
 def save(self, db):
     cursor = db.cursor()
     if self.IDFile == "":
         #Add information to a new database entry
         query = "INSERT INTO ReviewFiles VALUES(NULL,'" + dbEscape(
             self.IDReview) + "', '" + dbEscape(
                 self.Path) + "','" + dbEscape(
                     self.LineStart) + "','" + dbEscape(
                         self.LineEnd) + "','" + dbEscape(
                             self.Version) + "')"
         cursor.execute(query)
         db.commit()
         self.IDFile = cursor.lastrowid
     else:
         #Update information in existing database entry
         query = "UPDATE ReviewFiles SET IDReview = '" + dbEscape(
             self.IDReview) + "', Path = '" + dbEscape(
                 self.Path) + + "', LineStart = '" + dbEscape(
                     self.LineStart) + "', LineEnd = '" + dbEscape(
                         self.LineEnd) + "', Version = '" + dbEscape(
                             self.Version
                         ) + "' WHERE IDFile = '" + dbEscape(
                             self.IDFile) + "'"
         cursor.execute(query)
         db.commit()
     return self.IDFile
Exemple #23
0
 def save(self, db):
     cursor = db.cursor()
     #Add information to a new database entry
     if self.IDComment == "-1":
         query = "INSERT INTO ReviewComments VALUES(NULL,'" + dbEscape(
             self.IDFile) + "', '" + dbEscape(
                 self.IDParent) + "','" + dbEscape(
                     self.LineNum) + "','" + dbEscape(
                         self.Author) + "','" + dbEscape(
                             self.Text) + "','" + dbEscape(
                                 self.AttachmentPath
                             ) + "','" + ` self.DateCreate ` + "')"
         cursor.execute(query)
         db.commit()
         cursor.execute("SELECT last_insert_rowid() FROM ReviewComments")
         self.IDComment = ` cursor.fetchone()[0] `
     else:
         #Update information in existing database entry
         query = "UPDATE ReviewComments SET IDFile = '" + dbEscape(
             self.IDFile
         ) + "', IDParent = '" + dbEscape(
             self.IDParent
         ) + "', LineNum = '" + dbEscape(
             self.LineNum
         ) + "', Author = '" + dbEscape(
             self.Author
         ) + "', Text = '" + dbEscape(
             self.Text
         ) + "', AttachmentPath = '" + dbEscape(
             self.AttachmentPath
         ) + "', DateCreate = '" + ` self.DateCreate ` + "' WHERE IDComment = '" + dbEscape(
             self.IDComment) + "'"
         cursor.execute(query)
         db.commit()
     return self.IDComment
 def save(self, db):
     cursor = db.cursor()
     if self.IDFile == "":
         # Add information to a new database entry
         query = (
             "INSERT INTO ReviewFiles VALUES(NULL,'"
             + dbEscape(self.IDReview)
             + "', '"
             + dbEscape(self.Path)
             + "','"
             + dbEscape(self.LineStart)
             + "','"
             + dbEscape(self.LineEnd)
             + "','"
             + dbEscape(self.Version)
             + "')"
         )
         cursor.execute(query)
         db.commit()
         cursor.execute("SELECT last_insert_rowid() FROM ReviewFiles")
         self.IDFile = ` cursor.fetchone()[0] `
     else:
         # Update information in existing database entry
         query = (
             "UPDATE ReviewFiles SET IDReview = '"
             + dbEscape(self.IDReview)
             + "', Path = '"
             + dbEscape(self.Path)
             + +"', LineStart = '"
             + dbEscape(self.LineStart)
             + "', LineEnd = '"
             + dbEscape(self.LineEnd)
             + "', Version = '"
             + dbEscape(self.Version)
             + "' WHERE IDFile = '"
             + dbEscape(self.IDFile)
             + "'"
         )
         cursor.execute(query)
         db.commit()
     return self.IDFile
Exemple #25
0
 def getCodeReviewsByStatus(self, status):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE Status= '" + dbEscape(status) + "'ORDER BY DateCreate"
     return self.execCodeReviewQuery(query, False)
Exemple #26
0
 def getCodeReviewsByID(self, id):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE IDReview= '" + dbEscape(
         id) + "'"
     return self.execCodeReviewQuery(query, True)
Exemple #27
0
 def getCommentByID(self, id):
     query = "SELECT IDComment, IDFile, IDParent, LineNum, Author, Text, AttachmentPath, DateCreate FROM ReviewComments WHERE IDComment = '" + dbEscape(
         id) + "'"
     return self.execReviewCommentQuery(query, True)
Exemple #28
0
 def getCommentDictForFile(self, id):
     query = "SELECT LineNum, Count(IDComment) FROM ReviewComments WHERE IDFile = '" + dbEscape(
         id) + "' GROUP BY LineNum"
     cursor = self.db.cursor()
     cursor.execute(query)
     rows = cursor.fetchall()
     d = {}
     if not rows:
         return d
     for row in rows:
         d[row[0]] = row[1]
     return d
Exemple #29
0
 def getCodeReviewsByStatus(self, status):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE Status= '" + dbEscape(
         status) + "'ORDER BY DateCreate"
     return self.execCodeReviewQuery(query, False)
Exemple #30
0
 def getMyCodeReviews(self, user):
     query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE Author= '" + dbEscape(
         user) + "' ORDER BY DateCreate"
     return self.execCodeReviewQuery(query, False)
Exemple #31
0
 def getReviewers(self, id):
     query = "SELECT IDReview, Reviewer, Status, Vote FROM Reviewers WHERE IDReview = '" + dbEscape(id) + "'"
     return self.execReviewerQuery(query, False)
Exemple #32
0
 def getCodeReviews(self, user):
     query = "SELECT CodeReviews.IDReview, CodeReviews.Author, CodeReviews.Status, CodeReviews.DateCreate, CodeReviews.Name, CodeReviews.Notes FROM CodeReviews, Reviewers WHERE Reviewers.IDReview = CodeReviews.IDReview AND Reviewer = '" + dbEscape(
         user) + "' ORDER BY CodeReviews.DateCreate"
     return self.execCodeReviewQuery(query, False)
Exemple #33
0
 def getReviewFiles(self, id):
     query = "SELECT IDFile, IDReview, Path, LineStart, LineEnd, Version FROM ReviewFiles WHERE IDReview = '" + dbEscape(id) + "'"
     return self.execReviewFileQuery(query, False)
Exemple #34
0
 def getReviewerEntry(self, id, name):
     query = "SELECT IDReview, Reviewer, Status, Vote FROM Reviewers WHERE IDReview = '" + dbEscape(
         id) + "' AND Reviewer = '" + dbEscape(name) + "'"
     return self.execReviewerQuery(query, True)