Icon View Incident Report

Serious Serious
Reported By: Mike O'Neil
Reported On: 1/27/2002
For: Version 3.04 Build 1
# 1003 Quoted Columns in SQL Statements Being Intrepreted as String Constants

I am using DBISAM in a mature application and have found a couple of bugs. Both relate to double-quotes.

First in an SQL statement with both a WHERE and an AND clause, putting double quotes around the fieldname, results in the query failing to return matches. The first of the following works, while the second does not:

RIGHT - SELECT topic FROM books WHERE title = "ABC" AND author = "Smith" works
WRONG - SELECT topic FROM books WHERE "title" = "ABC" AND "author" = "Smith"

Square brackets around the fieldname seems to work.

Second, COUNT with a GROUP By still gives erroneous results (typically a very large value). After finding the bug above I finally realised that it seems again to be double quotes around fieldnames that causes the problem. The first statement will work, the second will return an erroneous result.

RIGHT - SELECT topic, COUNT(authors) GROUP BY topic
WRONG - SELECT topic, COUNT("authors") GROUP BY topic

Again replacing the double-quotes with square brackets corrects the problem.

SELECT topic FROM books WHERE "title" = "ABC" AND "author" = "Smith"
SELECT topic, COUNT("authors") GROUP BY topic 

Resolution Resolution
Fixed Problem on 1/29/2002 in version 3.05 build 1