Skip to content

Unable to execute custom sql query #29

Closed

Description

@Kuailun

Hi Navigraph team,

I am trying the sample airplane that you provided.

May I ask how to successfully run the custom sql query?

Current I have:
ExecuteSQLQuery("SELECT * FROM tbl_hdr_header;", "")

However the db gives me:
{
"line": 19738,
"column": 35,
"sourceURL": "xxxx"
}

Could you possibly provide some examples of using this function including / excluding the params?

Thanks a lot!

Activity

  1. SkySails commented on Nov 20, 2025

    @SkySails
    Contributor

    Hello! Thank you for the feedback!

    We have looked into this, and there are at least two different reasons why you get an error:

    • That table may or may not exist (it does not exist in our test database)
    • Queries without parameters currently always fail due to "too many parameters being passed"

    We're looking into the second reason and related things in #30 !

  2. Kuailun commented on Nov 20, 2025

    @Kuailun
    Author

    Hi! Thanks for getting back to me!

    I am using this DB: https://github.com/Navigraph/msfs-navigation-data-interface/tree/main/example/aircraft/PackageSources/Navigraph

    By opening with Pycharm, I can see the table and the table:

    Image
  3. Kuailun commented on Nov 20, 2025

    @Kuailun
    Author

    I have two additional questions:

    1. am I referring to the table correctly? should I just do “SELECT * FROM tbl_hdr_header” (I am able to query this table in Pycharm with this command), or should I add anything to refer to this table?
    2. what is the proper way to use the params? Is there any example I can refer to?

    Thanks again for the help!

  4. pepperoni505 commented on Nov 20, 2025

    @pepperoni505
    Contributor

    Hi,

    We are looking into your first question.

    Regarding the second, the sample has been fixed in #30. There was a bug on our end that added a param to arguments that didn't have any which caused that issue. When using the ExecuteSQLQuery call, you need to pass an array of strings for the params. If there are none, you can leave the array empty. You can look at this file for the list of CommBus calls and their expected bodies.

    Please let us know if you have any more question!

    / Jack

  5. SkySails commented on Nov 20, 2025

    @SkySails
    Contributor
    1. am I referring to the table correctly? should I just do “SELECT * FROM tbl_hdr_header” (I am able to query this table in Pycharm with this command), or should I add anything to refer to this table?

    I have tried to run your query with the changes in #30, and it works as expected:

    Image

    Please confirm if this is the case for you too!

  6. Kuailun commented on Nov 20, 2025

    @Kuailun
    Author

    Thanks!

    I am able to execute the query as well.

    Image
  7. SkySails commented on Nov 21, 2025

    @SkySails
    Contributor

    Thank you for the confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions