Skip to content

Externalize SQL queries #2

@LlemonDuck

Description

@LlemonDuck

Port of runelite/runelite#8740

Perhaps a rather minor thing, but I only mention it because code is otherwise very clean.

SQL queries (e.g. https://github.com/runelite/runelite/blob/master/http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java) can be moved into xml file inside src/main/resources, and then read using standard java properties.

E.g.: src/main/resources/sql/loottracker.sql:

<properties>
    <entry key="createTable">
    <![CDATA[
        CREATE TABLE ....
    ]]>
    </entry>
</properties>

and then inside service file:

Properties sqlProperties = new Properties();
sqlProperties.loadFromXML(new ClassPathResource("sql/loottracker.sql").getInputStream());
String createTableQuery = sqlProperties.getProperty("createTable");

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