runelite / runelite/api.runelite.net

Externalize SQL queries

Open
#2 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4
Forks
10
PR merge metrics
No merged PRs in 30d

Description

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");

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with http-service/src/main/java/net/runelite/http/service/loottracker/LootTrackerService.java and review the proposed src/main/resources/sql/loottracker.sql format. Identify the SQL queries in the service, externalize them as XML properties, and update the service to load them from the classpath. Done means the service uses the externalized queries without changing its behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, databases
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.