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