#Need help with sqlite3 module

18 messages · Page 1 of 1 (latest)

crimson tendon
#
    db.exec(`CREATE TABLE cmd (name varchar(20), value text)`);

table schema

fallow temple
#

You don’t have named parameters in your SQL statement but pass them as an object for names parameters. Either pass them as array instead or use named parameters in the SQL

crimson tendon
#

all return same error

fallow temple
#

And did you check that the table in SQLite actually has those two columns?

crimson tendon
#

i cant delete teh db rq to test

#

yeah

#

it for sure has it

fallow temple
#

You don’t need to delete itwaitWhat

crimson tendon
#

wtf, it shows me it added it to the dn

#

*db

#

still error thrown tho

fallow temple
#

Does the error come from that line though?

crimson tendon
#

hmm

#
    /**
     * @param {String} name 
     * @returns {Promise.<Command>}
     */
    static async getCommand(name){
        return new Promise(r=>{
            db.all(`SELECT * FROM cmd WHERE name='?'`,[name],(err,rows)=>{
                console.log("a2")
                if(err)throw err;
                r(rows[0])
            })
        })
    }

its thrown in here?? lol

#

its coz of '', ok

#

it should be ? not '?'

#

ok, fixed