Jump to content

Unrecognized Token


Recommended Posts

Posted
local database = dbConnect("sqlite", "parchement.db") 
dbExec(database, "CREATE TABLE IF NOT EXISTS parchement (account_name TEXT, parchement TEXT DEFAULT "..toJSON({})..")") 

WARNING: system\save\save.lua:2: dbExec failed; (1) unrecognized token: "]"

Where is the problem?

Posted

Try putting the toJSON in single quotes.

local database = dbConnect("sqlite", "parchement.db") 
dbExec(database, "CREATE TABLE IF NOT EXISTS parchement (account_name TEXT, parchement TEXT DEFAULT '"..toJSON({}).."')") 

I'm honestly not sure if this will fix the problem though.

Posted (edited)

You can't set defaults for text fields in MySQL.

Edit: didn't see it was SQLite. Silly me.

Edited by Guest
Posted
Try putting the toJSON in single quotes.
local database = dbConnect("sqlite", "parchement.db") 
dbExec(database, "CREATE TABLE IF NOT EXISTS parchement (account_name TEXT, parchement TEXT DEFAULT '"..toJSON({}).."')") 

I'm honestly not sure if this will fix the problem though.

Solved, thank you. :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...