btk5h / skript-db

MIT License
5 stars 5 forks source link

"WARN A SQL query was attempted on the main thread!" #21

Closed SpinKnight closed 5 years ago

SpinKnight commented 5 years ago

This is the "error" I am receiving in my console: WARN A SQL query was attempted on the main thread!

when running this piece of code: execute "SELECTuuidFROMteam_usersWHEREteam_name= 'test'" on {db} and store result in {_data::*}

I also tried saving the result in a global variable, resulted in same warning. The synchronously flag did not work either. Still gave me the warning.

Surely I don't have to create a new thread $ thread from SkQuery everytime?

Skript version: 2.2-dev36 skript-db version: 0.2.0

btk5h commented 5 years ago

This should have been fixed in 0.2.1, can you try that build?

On Sun, Aug 25, 2019 at 8:03 AM SpinKnight notifications@github.com wrote:

This is the "error" I am receiving in my console: WARN A SQL query was attempted on the main thread!

when running this piece of code: execute "SELECT uuidFROMteam_usersWHEREteam_name = 'test'" on {db} and store result in {_data::*}

I also tried saving the result in a global variable, resulted in same warning.

Skript version: 2.2-dev36 skript-db version: 0.2.0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/btk5h/skript-db/issues/21?email_source=notifications&email_token=AAXTMJHL3AIB5BW7QHRUW7DQGKNKNA5CNFSM4IPJKBKKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HHHTWCQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAXTMJBMWQ3VVTWVKZDZSM3QGKNKNANCNFSM4IPJKBKA .

SpinKnight commented 5 years ago

Fixed it. Thank you. Does skript-db not support multiple queries at once? "SELECT * FROM table; UPDATE table SET column = column + 1" basically Cuz everytime I try it, it fails

btk5h commented 5 years ago

I have not tested this approach, but you may be able to execute multiple queries by connecting with the parameter allowMultiQueries=true in the connection uri.

If you have more follow-up questions/suggestions for this, please open them in another issue.