Skip to content

query() should return query_result, not boolean #60

@MrSmite

Description

@MrSmite

Describe the solution you'd like

Since gdscript doesn't support pointers or passing by reference, it would be more efficient and possibly safer to have query() return the actual recordset instead of a boolean. In the current implementation, the caller has to duplicate the recordset into an empty dictionary in order to preserve it or it gets deleted on the next query().

Current:

var my_result = {}
 
if db.query(sql_string):
    my_result = db.query_result.duplicate()    # adds more overhead if query_result is complex

New:

var my_result = {}
 
my_result = db.query(sql_string)

if my_result.empty():
    # error handling
else
    # do stuff with my_result without having to duplicate it or worry it will be overwritten by another query()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions