0 votes


I'm making a game based on vocabulary.

For that I was thinking about using sqlite, so I download the module from : https://github.com/2shady4u.

So far so good I can explore the data base, but when I want to make a request (a query) with variable, then I can't go further :/

It's this line of my code that didn't work (I don't have any issue but no result ^^ :

    db.query("SELECT * FROM words WHERE id = ?",[test])

Here is my code :

extends Node

const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns")
#const SQLite = preload("res://module/sqlite")

var db;

var db_name = "res://bdd.db"

var result

#var ligne

func _ready():

    db = SQLite.new();

    db.path = db_name


    db.query("SELECT * FROM words WHERE trials = 0 ORDER BY RANDOM() LIMIT 1;")

    var ligne = db.query_result[0]["id"]

    print("ligne : ")

    for i in db.query_result:

        db.query("UPDATE words SET trials = 1 WHERE id = ?",i.id)


    print("a nouveau ligne")

    var test = "3";

    db.query("SELECT * FROM words WHERE id = ?",[test])


    for j in db.query_result:


Thanks a lot !

Take care of your self

PS : I also have seen that Godot have a built in sqlite module but I can't make it work :/

godot sqlite built in module

Godot version 3.2
in Engine by (34 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.