Skip to content

Recognise read sqlQueries passed in statement.execute(***) to run them on REPLICA #53

@afaruga-atlassian

Description

@afaruga-atlassian

Methods like ReplicaStatement.execute(String, *** ) (listed below), are run on MAIN, as they're treated as write operations.
They can be used by application to either pass WRITE or READ SQL query.
Currently, all execute()*** invocations are treated as write operations.
For applications that use execute()for READ operations this won't move those queries to REPLICA.

Example methods:

  • connection.prepareStatement(SIMPLE_QUERY).execute();
  • connection.prepareStatement(SIMPLE_QUERY).execute(SIMPLE_QUERY);
  • connection.prepareStatement(SIMPLE_QUERY).execute(SIMPLE_QUERY, Statement.RETURN_GENERATED_KEYS);
  • connection.prepareStatement(SIMPLE_QUERY).execute(SIMPLE_QUERY, new String[]{"test"});
  • connection.prepareStatement(SIMPLE_QUERY).execute(SIMPLE_QUERY, new int[]{123});
  • connection.prepareStatement(SIMPLE_QUERY, new int[]{123}).execute(SIMPLE_QUERY, new int[]{123});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions