Pivity

Help with SQLite

Last read Never
#1

Hi,

I'm trying to fetch boolean values from my db. But my function return a string : the column name.

So I'm need help to fix the issue and return the boolean value instead.

Thanks in advance.


Here's my function to fetch :


function plymeta:getValue(columnName, callback)

    local result = sql.QueryValue("SELECT "..sql.SQLStr(columnName).." FROM MyTable WHERE steamid = "..sql.SQLStr(steamID)..";")

    print("SQLite query result:", result)     

    if not result then

      print("SQLite: Failed to retrieve " .. columnName .. " for steamID " .. steamID .. ": " .. sql.LastError())

      callback(nil)

    else

      callback(result)

    end

end


ply:getValue("MyFirstColumn", function(firstcol)

print(firstcol) -- print a string the column name instead of the boolean value

end)

Users viewing this thread
Nobody