Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

refactor: deduplicate DB connection and query execution logic - #85

Closed
sauravbhattacharya001 wants to merge 1 commit into
masterfrom
refactor/deduplicate-db-and-query-logic
Closed

sauravbhattacharya001 wants to merge 1 commit into
masterfrom
refactor/deduplicate-db-and-query-logic

Conversation

@sauravbhattacharya001

Copy link
Copy Markdown
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
Copy Markdown

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
@sauravbhattacharya001

Copy link
Copy Markdown
Owner Author

Closing: superseded or conflicting with newer changes already on main/master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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