1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Is there an MySQL tutorial flying around this forums?

Discussion in 'General discussion' started by Levi, Jun 8, 2018.

  1. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Is there an MySQL tutorial flying around this forums?
     
  2. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    What do you want to know?

    MySQL syntax documentaiton: https://dev.mysql.com
    How to use MySQL from plugins: examples available in many plugins
    How to use MySQL with libasynql, which is probably the easiest way to make plugins use MySQL asynchronously (so that it won't lag the server): https://github.com/poggit/libasynql

    Anything else?
     
    Levi likes this.
  3. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    what's should i put for schema?
     
  4. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    Code:
    Warning: Use of unshaded libasynql detected. Debug mode is enabled. This may lead to major performance drop. Please use a shaded package in production. See https://poggit.pmmp.io/virion for more information.
     
  5. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Yes. Libasynql is on debug mode if it is unpackaged, and extra tasks are run on debug mode and decrease performance. In production, you should pack your plugin (without libasynql) into a phar, then run
    Code:
    php libasynql.phar plugin.phar 'your\plugin\namespace'
    (no need '' if you are on Windows) to compile the plugin. Or just use the Poggit build in production :)
     
  6. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    MySQL schema is a section of your MySQL server. You can think of it as a directory inside your MySQL database.
    Before you start the server with the plugin, you should first run the MySQL query (in a MySQL client) to create a schema:
    Code:
    mysql> CREATE SCHEMA your_schema_name;
    
    The schema name is usually the plugin name, because different plugins may have the same table name, and it is important to make sure these plugins won't conflict with each other.
     
  7. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    where is that Poggit build? I went to https://poggit.pmmp.io/plugins find no libasynql
     
  8. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    libasynql is a virion, not a plugin. A virion should be bundled along with your plugin. You should not ask your users to download libasynql separately, because it should be included inside the phar.
     
  9. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    I put the libasynql.phar to \virions folder outside plugins folder. Is that fine?
     
  10. Levi

    Levi Skeleton

    Messages:
    955
    GitHub:
    captainleviftw
    It works btw
     
  11. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Read the virion guide: https://poggit.pmmp.io/virion
    Anything that works is ok for your own development. But make sure not to tell users to do that when you release the plugin as a phar.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.