Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Async MySQL Query

Comments in 'Plugin Development' started by Samueljh1H8sLag, Jan 4, 2016.

  1. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    Hey, Im trying to do an async mysql query. I've tried to make the connection via the task's __construct method but that hasn't worked. I also tried @PEMapModder's method of get/setFromThreadStore .

    Not only this, but are asynctasks required? I had a look at @shoghicp's simpleauth plugin and found out that the sqlprovider used none.

    Any ideas? :)
    Legoboy0215 likes this.
  2. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    They are not required.
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    They are not required, but they may be laggy.
    Look at this for examples of queries that use AsyncTask. Note that they might not be executed in the correct order. Yes, AsyncTask may be executed not in the correct order.
  4. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    were you gonna link something? xD
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
  6. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    https://github.com/LegionPE/LegionPE-Theta-Base/blob/master/stubs/creden_tials_stub.php
    cred.PNG
    Yes, I really have those lines in the production plugin. That prevents, in case I forgot to disable, the PocketMine crash report system to upload the code related to the password :D because constant declarations can't trigger crash reports in any ways (even if there are syntax errors, PocketMine can't locate that line and upload them), so I used comments/empty lines to protect them xD
  8. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    *Bumping*, I'm still having trouble with this; the sql object itself is fine, but whenever running a query, the result is always NULL (even when valid.)
  9. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    Nevermind.
  10. iJoshuaHD
    Offline

    iJoshuaHD Notable Member Plugin Developer

    Joined:
    Nov 7, 2013
    Posts:
    1,167
    Plugins:
    4
    Minecraft User:
    iJoshuaHD
    thats onCompletion function is used for...
  11. Samueljh1H8sLag
    Offline

    Samueljh1H8sLag Active Member

    Joined:
    Jun 20, 2015
    Posts:
    168
    Minecraft User:
    Samueljh1_
    It's nothing to do with that, it's because you need to re-create the connection. Also I even posted "nevermind". Lol

Share This Page

Advertisement