2shady4u / godot-sqlite

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

Feature Request: multi-statements #58

Closed progsource closed 2 years ago

progsource commented 3 years ago

Is your feature request related to a problem? Please describe.

So I tried the other day to use multiple statements in a query and found out the hard way, that that isn't supported yet. Example Code:

_db = SQLite.new()
_db.path = my_db_path
_db.open_db()

var update_query = """
    UPDATE infos SET value = 1 WHERE name = 'a';
    UPDATE infos SET value = 2 WHERE name = 'b';
    UPDATE infos SET value = 3 WHERE name = 'c';
    """

_db.query(update_query)

Only the first statement is actually executed.

Describe the solution you'd like

I would like to make multi-statements as shown above.

Describe alternatives you've considered

Of course I can work around it with doing one query per statement, but it would be nice to have it working with multi-statements.

Additional context

https://github.com/2shady4u/godot-sqlite/blob/a7580a037c786976d9c42ab1e46dbe460fb111f3/src/gdsqlite.cpp#L184

There pzTail is NULL currently. If it was used, this way multi-statements could be made possible.

2shady4u commented 3 years ago

Hi @progsource This seems like something useful to have/support so I'll see if I can implement for the next release (3.1).

2shady4u commented 2 years ago

This feature request has now been implemented in the latest release (https://github.com/2shady4u/godot-sqlite/releases/tag/v3.2).

I am closing this issue as a result 🙏