diff -r 18c7858c4d04 codereview/dbBackend.py
--- a/codereview/dbBackend.py	Wed Jun 04 23:19:30 2008 +0000
+++ b/codereview/dbBackend.py	Fri Sep 11 17:09:06 2009 +0200
@@ -33,22 +33,22 @@
 
     #Returns an array of all the code reviews whose author is the given user
     def getMyCodeReviews(self, user):
-        query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE Author = '%s' ORDER BY DateCreate" % (user)
+        query = "SELECT \"IDReview\", \"Author\", \"Status\", \"DateCreate\", \"Name\", \"Notes\" FROM \"CodeReviews\" WHERE \"Author\" = '%s' ORDER BY \"DateCreate\"" % (user)
         return self.execCodeReviewQuery(query, False)
 
     #Returns an array of all the code reviews who have the given user assigned to them as a reviewer
     def getCodeReviews(self, user):
-        query = "SELECT cr.IDReview, cr.Author, cr.Status, cr.DateCreate, cr.Name, cr.Notes FROM CodeReviews cr, Reviewers r WHERE r.IDReview = cr.IDReview AND r.Reviewer = '%s' ORDER BY cr.DateCreate" % (user)
+        query = "SELECT cr.\"IDReview\", cr.\"Author\", cr.\"Status\", cr.\"DateCreate\", cr.\"Name\", cr.\"Notes\" FROM \"CodeReviews\" cr, \"Reviewers\" r WHERE r.\"IDReview\" = cr.\"IDReview\" AND r.\"Reviewer\" = '%s' ORDER BY cr.\"DateCreate\"" % (user)
         return self.execCodeReviewQuery(query, False)
 
     #Returns an array of all the code reviews with the given status
     def getCodeReviewsByStatus(self, status):
-        query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE Status = '%s' ORDER BY DateCreate" % (status)
+        query = "SELECT \"IDReview\", \"Author\", \"Status\", \"DateCreate\", \"Name\", \"Notes\" FROM \"CodeReviews\" WHERE \"Status\" = '%s' ORDER BY \"DateCreate\"" % (status)
         return self.execCodeReviewQuery(query, False)
 
     #Returns the number of votes of type 'type' for the given code review
     def getVotesByID(self, type, id):
-        query = "SELECT Count(Reviewer) FROM Reviewers WHERE IDReview = '%s' AND Vote = '%s'" % (id, type)
+        query = "SELECT Count(\"Reviewer\") FROM \"Reviewers\" WHERE \"IDReview\" = '%s' AND \"Vote\" = '%s'" % (id, type)
         cursor = self.db.cursor()
         cursor.execute(query)
         row = cursor.fetchone()
@@ -58,7 +58,7 @@
 
     #Returns the code review requested by ID
     def getCodeReviewsByID(self, id):
-        query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE IDReview = '%s'" % (id)
+        query = "SELECT \"IDReview\", \"Author\", \"Status\", \"DateCreate\", \"Name\", \"Notes\" FROM \"CodeReviews\" WHERE \"IDReview\" = '%s'" % (id)
         return self.execCodeReviewQuery(query, True)
 
     #Returns an array of code reviews which have a name like any of the
@@ -66,54 +66,54 @@
     def searchCodeReviewsByName(self, name):
         queryPart = self.createORLoop(name, "Name")
         if len(queryPart) == 0:
-            query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews"
+            query = "SELECT \"IDReview\", \"Author\", \"Status\", \"DateCreate\", \"Name\", \"Notes\" FROM \"CodeReviews\""
         else:
-            query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE %s" % (queryPart)
+            query = "SELECT \"IDReview\", \"Author\", \"Status\", \"DateCreate\", \"Name\", \"Notes\" FROM \"CodeReviews\" WHERE %s" % (queryPart)
         return self.execCodeReviewQuery(query, True)
 
     #Returns an array of code reviews that match the values in the given
     #code review structure.  The 'name' part is treated as a keyword list
     def searchCodeReviews(self, crStruct):
-        query = "SELECT IDReview, Author, Status, DateCreate, Name, Notes FROM CodeReviews WHERE "
+        query = "SELECT \"IDReview\", \"Author\", \"Status\", \"DateCreate\", \"Name\", \"Notes\" FROM \"CodeReviews\" WHERE "
         queryPart = self.createORLoop(crStruct.Name, "Name")
         if len(queryPart) != 0:
             query = query + "(%s) AND " % (queryPart)
-        query = query + "Author LIKE '%s%s%s' AND Status LIKE '%s%s%s' AND DateCreate >= '%s'" % ('%', crStruct.Author, '%', '%', crStruct.Status, '%', crStruct.DateCreate)
+        query = query + "\"Author\" LIKE '%s%s%s' AND \"Status\" LIKE '%s%s%s' AND \"DateCreate\" >= '%s'" % ('%', crStruct.Author, '%', '%', crStruct.Status, '%', crStruct.DateCreate)
         return self.execCodeReviewQuery(query, False)
 
     #Returns an array of all the reviewers for a code review
     def getReviewers(self, id):
-        query = "SELECT IDReview, Reviewer, Status, Vote FROM Reviewers WHERE IDReview = '%s'" % (id)
+        query = "SELECT \"IDReview\", \"Reviewer\", \"Status\", \"Vote\" FROM \"Reviewers\" WHERE \"IDReview\" = '%s'" % (id)
         return self.execReviewerQuery(query, False)
 
     #Returns a specific reviewer entry for the given code review and name
     def getReviewerEntry(self, id, name):
-        query = "SELECT IDReview, Reviewer, Status, Vote FROM Reviewers WHERE IDReview = '%s' AND Reviewer = '%s'" % (id, name)
+        query = "SELECT \"IDReview\", \"Reviewer\", \"Status\", \"Vote\" FROM \"Reviewers\" WHERE \"IDReview\" = '%s' AND \"Reviewer\" = '%s'" % (id, name)
         return self.execReviewerQuery(query, True)
 
     #Returns an array of the files associated with the given review id
     def getReviewFiles(self, id):
-        query = "SELECT IDFile, IDReview, Path, LineStart, LineEnd, Version FROM ReviewFiles WHERE IDReview = '%s'" % (id)
+        query = "SELECT \"IDFile\", \"IDReview\", \"Path\", \"LineStart\", \"LineEnd\", \"Version\" FROM \"ReviewFiles\" WHERE \"IDReview\" = '%s'" % (id)
         return self.execReviewFileQuery(query, False)
 
     #Returns the requested review file
     def getReviewFile(self, id):
-        query = "SELECT IDFile, IDReview, Path, LineStart, LineEnd, Version FROM ReviewFiles WHERE IDFile = '%s'" % (id)
+        query = "SELECT \"IDFile\", \"IDReview\", \"Path\", \"LineStart\", \"LineEnd\", \"Version\" FROM \"ReviewFiles\" WHERE \"IDFile\" = '%s'" % (id)
         return self.execReviewFileQuery(query, True)
 
     #Returns the requested comment
     def getCommentByID(self, id):
-        query = "SELECT IDComment, IDFile, IDParent, LineNum, Author, Text, AttachmentPath, DateCreate FROM ReviewComments WHERE IDComment = '%s'" % (id)
+        query = "SELECT \"IDComment\", \"IDFile\", \"IDParent\", \"LineNum\", \"Author\", \"Text\", \"AttachmentPath\", \"DateCreate\" FROM \"ReviewComments\" WHERE \"IDComment\" = '%s'" % (id)
         return self.execReviewCommentQuery(query, True)
 
     #Returns an array of comments for the given file
     def getCommentsByFileID(self, id):
-        query = "SELECT IDComment, IDFile, IDParent, LineNum, Author, Text, AttachmentPath, DateCreate FROM ReviewComments WHERE IDFile = '%s' ORDER BY DateCreate" % (id)
+        query = "SELECT \"IDComment\", \"IDFile\", \"IDParent\", \"LineNum\", \"Author\", \"Text\", \"AttachmentPath\", \"DateCreate\" FROM \"ReviewComments\" WHERE \"IDFile\" = '%s' ORDER BY \"DateCreate\"" % (id)
         return self.execReviewCommentQuery(query, False)
 
     #Returns all the comments for the given file on the given line
     def getCommentsByFileIDAndLine(self, id, line):
-        query = "SELECT IDComment, IDFile, IDParent, LineNum, Author, Text, AttachmentPath, DateCreate FROM ReviewComments WHERE IDFile = '%s' AND LineNum = '%s' ORDER BY DateCreate" % (id, line)
+        query = "SELECT \"IDComment\", \"IDFile\", \"IDParent\", \"LineNum\", \"Author\", \"Text\", \"AttachmentPath\", \"DateCreate\" FROM \"ReviewComments\" WHERE \"IDFile\" = '%s' AND LineNum = '%s' ORDER BY \"DateCreate\"" % (id, line)
         return self.execReviewCommentQuery(query, False)
 
     #Returns the current "Threshold" for code to be ready for inclusion
@@ -141,7 +141,7 @@
     #Returns a dictionary where the key is the line number and the value is the number of comments on that line
     #for the given file id.
     def getCommentDictForFile(self, id):
-        query = "SELECT LineNum, Count(IDComment) FROM ReviewComments WHERE IDFile = '%s' GROUP BY LineNum" % (id)
+        query = "SELECT \"LineNum\", Count(\"IDComment\") FROM \"ReviewComments\" WHERE \"IDFile\" = '%s' GROUP BY \"LineNum\"" % (id)
         cursor = self.db.cursor()
         cursor.execute(query)
         rows = cursor.fetchall()
