scylladb/scylla-rust-driver

PreparedStatement: document that cloning it is cheap

Closed this issue · 2 comments

Ref: #811 (comment)

As described in the referenced issue, we should document that cloning a PreparedStatement is intentionally made cheap for seamless use with the driver's API that consumes PreparedStatement, e.g. Session::execute_iter.

As a bonus, it would be great to add some docstring example of preparation and execution of a PreparedStatement to its docstring. ATM, its docstring is very terse: /// Represents a statement prepared on the server..

For inspiration, this is a comment from prepared statements coming from DataStax NodeJS driver:

Using prepared statements provides multiple benefits.
Prepared statements are parsed and prepared on the Cassandra nodes and are ready for future execution. Also, when preparing, the driver retrieves information about the parameter types which allows an accurate mapping between a JavaScript type and a Cassandra type.
The driver will prepare the query once on each host and execute the statement with the bound parameters.

Done with #986.