Just a couple of questions…
Based on this string below we can easily see that we can make a bunch of words, how do I query a my dictionary for what words can be created from the string?
Obviously this string wouldn’t return anything because I just query if my string is within the dictionary. How do I format my sql query?
[lua]
local letters = “abcdeaowhtgillx”
local sql = “SELECT *FROM WORDS WHERE word LIKE’”…letters…"’ "
local myWords = {}
for row in db:nrows(sql) do
if row.word == nil then
print(" NO WORDS FOUND ")
else
print(" FOUND WORDS: ", row.word)
myWords[#myWords + 1] = row.word
end
end
[/lua]
I understand how to find if a word is in my dictionary, however I see there are more than one way of doing it with sqlite, what is the best way to query the database?
One way…
[lua]
local theWord = “hammer”
local sql = “SELECT * FROM WORDS WHERE word = '” … theWord… "’ "
[/lua]
Another way…
[lua]
local theWord = “hammer”
local sql = “SELECT * FROM WORDS WHERE word LIKE '” … theWord… "’ "
[/lua]