Skip to content

refactor: deduplicate DB connection and query execution logic#85

Open
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
refactor/deduplicate-db-and-query-logic
Open

refactor: deduplicate DB connection and query execution logic#85
sauravbhattacharya001 wants to merge 1 commit intomasterfrom
refactor/deduplicate-db-and-query-logic

Conversation

@sauravbhattacharya001
Copy link
Owner

Summary

Eliminates code duplication in the \�pp\ package:

Util.java

  • Extracted a private \getConnection(dbName)\ method that both \getAppConnection()\ and \getAzialaConnection()\ now delegate to
  • Removes ~12 duplicated lines of credential lookup + JDBC connection logic

Network.java

  • Replaced 5 nearly-identical query execution blocks (~100 lines) with a data-driven approach:
    • \MeetingQuery\ descriptor class holds SQL, edge code, and thresholds
    • \�uildSql()\ generates SQL from a shared template with parameterized operators
    • \�ppendEdges()\ executes any query and appends results to the output buffer
  • All 5 relationship types (friends, study groups, classmates, strangers, familiar strangers) now use the same execution path

What didn't change

  • Same SQL queries (verified by expansion)
  • Same output format
  • Same security validations (path traversal, env var requirements)

- Util.java: deduplicate getAppConnection/getAzialaConnection into
  a single private getConnection(dbName) method
- Network.java: replace 5 nearly-identical query blocks with a
  data-driven MeetingQuery array and a single appendEdges() helper
- Extract SQL template with parameterized location/duration/count
  operators via buildSql() instead of 5 copy-pasted SQL strings
- No behavioral changes — same queries, same output format
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions bot added database Database queries and schema security Security improvements size/l labels Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

database Database queries and schema security Security improvements size/l

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant