2shady4u / godot-sqlite

GDExtension wrapper for SQLite (Godot 4.x+)
MIT License
850 stars 76 forks source link

create_table() crashes running App when, default is set incorrectly #142

Closed zurrealStudios closed 5 months ago

zurrealStudios commented 1 year ago

Hopefully this wasn't already reported, could not find a report with the same Issue. If yes then I am sorry

Environment:

Issue description: When creating a table with the create_table() function and the default value is NOT set in quotation marks, the program will just crash, without any error message. It would be nice, if there would be an error message telling what went wrong.

Steps to reproduce: Create a dictionary variable with badly set default value (see below) Create table with create_table()

Minimal reproduction project:

@onready var SQL: SQLite = SQLite.new()
var table: Dictionary

func _ready():
    table["id"] = { "data_type" : "int", "primary_key" : true, "auto_increment" : true }
    table["data"] = { "data_type" : "int", "default" : -1 } # <-- this should be "-1"

    SQL.create_table("test_table", table)

Thank you for your great Addon and keep up the great work :D!

2shady4u commented 1 year ago

image

Hello @zurrealStudios I've added some additional schema validation to the create_table()-method that should give the user some error message. It's implemented in 792189a and will be part of the next SQLite for Godot 4.X+ release.

zurrealStudios commented 1 year ago

Awesome, thank You very much :) Also big thanks for this awesome Addon and keep on keepin' on :D!

2shady4u commented 5 months ago

I have fixed some issues with the table validation in the latest release. Closing this issue because the original issue has been solved.