Reputation: 3666
I'm trying to retrieve particular rows in my database, the setup is like this:
CREATE TABLE "Rules" ("credit" BOOL NOT NULL , "debit" BOOL NOT NULL , "product_code" INTEGER, "frequency" INTEGER, "percentage" FLOAT, "limit" FLOAT, "below" BOOL, "above" BOOL, "price" FLOAT)
My code is:
class Process_Rules
def initialize()
@rules = Array.new() {Array.new()}
end
def process()
db = SQLite3::Database.open "Checkout.sqlite"
#############################################
productRules = db.execute "SELECT product_code FROM Rules WHERE product_code NOT NULL"
@rules.push([])
for i in 0..productRules.length
@rules[0].push(productRules[i])
end
#############################################
limitRules = db.execute "SELECT limit FROM Rules" #ERRORSOME HERE, PREVIOUS SQL STATEMENT EXECUTES FINE
#############################################
db.close()
end
end
Error:
in 'initialize': near 'limit': syntax error (SQLite3::SQLException)
Upvotes: 0
Views: 36
Reputation: 30775
Since LIMIT is a keyword, you'll have to quote it:
SELECT "limit" FROM Rules
Upvotes: 1