SQL Library

Discussion in 'Plugin Development' started by mythbusterma, Jul 7, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    mythbusterma

    I was thinking about making a separate utility plugin that deals solely with accessing SQL databases.

    Rather than each plugin create its own individual database, this plugin would allow multiple plugins to act on the same database, and also handle the creation, caching, opening, and closing of connections. Furthermore, it would provide a more robust interface that would, by nature, (help to) prevent syntax errors that plague new developers, and allow all plugins to support multiple database drivers (i.e. MySQL, SQLite). Also, it would allow for the support of a robust storage system without very much knowledge of SQL.

    Also, by using a centralized database system, server owners would only have to set up databases once and it they would be able to specify which driver they would like to use.

    It would increase efficiency, reduce errors, make code simpler, and provide abstraction to allow multiple drivers.

    EDIT: Essentially it would be an abstraction layer over the existing SQL drivers and Java SQL API, that would also centralize to one file.

    Any thoughts, suggestions, or offers to help are welcome.
     
  2. Offline

    Skye

    I would say go for it, but ultimately developers will need to pass their own raw queries to use SQL to its full potential, so an abstraction layer would not offer much (in terms of performance, or even ease of use) over the java.sql package. YAML can already fit the needs of people who need something easier to use. :oops:
     
  3. Offline

    mythbusterma

    I'm not looking for performance, I'm looking to make it simpler, easier, safer, and more centralized for developers.

    I think it would go a long way in ease of use, however, and reducing development times.

    Most people won't need the entire functionality of SQL, and creating classes to represent the concepts of SQL would make it much easier for developers to understand, and write safe code.

    For example, ideally one could register their plugin with my plugin and then:

    Code:java
    1. Table table = SqlManager#addTable(this, "storagetable")
    2. .addColumn("id" ,UUID.class, ColumnType.KEY)
    3. .addColumn("cash", Integer.class)
    4. .addColumn("name", String.class);
    5. SqlManager#createTable(table);


    After, they could query data from their table, and the plugin would handle multi-threading, exceptions, and other things.
     
  4. Offline

    mythbusterma

    Bump for thoughts or suggestions.
     
Thread Status:
Not open for further replies.

Share This Page