Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
afaruga-atlassian opened this issue Mar 5, 2021 · 0 comments

Comments

@afaruga-atlassian
Copy link
Contributor

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});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant