Skip to content

Commit f591696

Browse files
authored
Merge pull request #1250 from muzarski/rename-query
rename `Query` to `Statement`
2 parents 58d1aef + 72c5ed4 commit f591696

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+577
-577
lines changed

docs/source/SUMMARY.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- [Quick start](quickstart/quickstart.md)
66
- [Creating a project](quickstart/create-project.md)
77
- [Running Scylla using Docker](quickstart/scylla-docker.md)
8-
- [Connecting and running a simple query](quickstart/example.md)
8+
- [Connecting and executing a simple CQL statement](quickstart/example.md)
99

1010
- [Migration guides](migration-guides/migration-guides.md)
1111
- [Adjusting code to changes in serialization API introduced in 0.11](migration-guides/0.11-serialization.md)
@@ -16,18 +16,18 @@
1616
- [Authentication](connecting/authentication.md)
1717
- [TLS](connecting/tls.md)
1818

19-
- [Making queries](queries/queries.md)
20-
- [Simple query](queries/simple.md)
21-
- [Query values](queries/values.md)
22-
- [Query result](queries/result.md)
23-
- [Prepared query](queries/prepared.md)
24-
- [Batch statement](queries/batch.md)
25-
- [Paged query](queries/paged.md)
26-
- [Lightweight transaction query (LWT)](queries/lwt.md)
27-
- [USE keyspace](queries/usekeyspace.md)
28-
- [Schema agreement](queries/schema-agreement.md)
29-
- [Query timeouts](queries/timeouts.md)
30-
- [Timestamp generators](queries/timestamp-generators.md)
19+
- [Executing CQL statements](statements/statements.md)
20+
- [Unprepared statement](statements/unprepared.md)
21+
- [Statement values](statements/values.md)
22+
- [Query result](statements/result.md)
23+
- [Prepared statement](statements/prepared.md)
24+
- [Batch statement](statements/batch.md)
25+
- [Paged query](statements/paged.md)
26+
- [Lightweight transaction statement (LWT)](statements/lwt.md)
27+
- [USE keyspace](statements/usekeyspace.md)
28+
- [Schema agreement](statements/schema-agreement.md)
29+
- [Request timeouts](statements/timeouts.md)
30+
- [Timestamp generators](statements/timestamp-generators.md)
3131

3232
- [Execution profiles](execution-profiles/execution-profiles.md)
3333
- [Creating a profile and setting it](execution-profiles/create-and-use.md)

docs/source/contents.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
index
77
quickstart/quickstart
88
connecting/connecting
9-
queries/queries
9+
statements/statements
1010
execution-profiles/execution-profiles
1111
data-types/data-types
1212
load-balancing/load-balancing

docs/source/data-types/data-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ to achieve seamless sending and receiving of CQL values.
55

66
See the following chapters for examples on how to send and receive each data type.
77

8-
See [Query values](../queries/values.md) for more information about sending values in queries.\
9-
See [Query result](../queries/result.md) for more information about reading values from queries
8+
See [Statement values](../statements/values.md) for more information about sending values along with statements.\
9+
See [Query result](../statements/result.md) for more information about retrieving values from queries
1010

1111
Database types and their Rust equivalents:
1212
* `Boolean` <----> `bool`

docs/source/execution-profiles/create-and-use.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ let session: Session = SessionBuilder::new()
2828
```
2929

3030
### Example
31-
To create an `ExecutionProfile` and attach it to a `Query`:
31+
To create an `ExecutionProfile` and attach it to a `Statement`:
3232
```rust
3333
# extern crate scylla;
3434
# use std::error::Error;
3535
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
36-
use scylla::query::Query;
36+
use scylla::statement::unprepared::Statement;
3737
use scylla::statement::Consistency;
3838
use scylla::client::execution_profile::ExecutionProfile;
3939
use std::time::Duration;
@@ -45,10 +45,10 @@ let profile = ExecutionProfile::builder()
4545

4646
let handle = profile.into_handle();
4747

48-
let mut query1 = Query::from("SELECT * FROM ks.table");
48+
let mut query1 = Statement::from("SELECT * FROM ks.table");
4949
query1.set_execution_profile_handle(Some(handle.clone()));
5050

51-
let mut query2 = Query::from("SELECT pk FROM ks.table WHERE pk = ?");
51+
let mut query2 = Statement::from("SELECT pk FROM ks.table WHERE pk = ?");
5252
query2.set_execution_profile_handle(Some(handle));
5353
# Ok(())
5454
# }

docs/source/execution-profiles/maximal-example.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# extern crate scylla;
77
# use std::error::Error;
88
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
9-
use scylla::query::Query;
9+
use scylla::statement::unprepared::Statement;
1010
use scylla::policies::speculative_execution::SimpleSpeculativeExecutionPolicy;
1111
use scylla::statement::{Consistency, SerialConsistency};
1212
use scylla::client::execution_profile::ExecutionProfile;
@@ -32,7 +32,7 @@ let profile = ExecutionProfile::builder()
3232
)
3333
.build();
3434

35-
let mut query = Query::from("SELECT * FROM ks.table");
35+
let mut query = Statement::from("SELECT * FROM ks.table");
3636
query.set_execution_profile_handle(Some(profile.into_handle()));
3737

3838
# Ok(())

docs/source/execution-profiles/priority.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Priorities of execution profiles and directly set options:
1515
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
1616
use scylla::client::session::Session;
1717
use scylla::client::session_builder::SessionBuilder;
18-
use scylla::query::Query;
18+
use scylla::statement::unprepared::Statement;
1919
use scylla::statement::Consistency;
2020
use scylla::client::execution_profile::ExecutionProfile;
2121

@@ -33,20 +33,20 @@ let session: Session = SessionBuilder::new()
3333
.build()
3434
.await?;
3535

36-
let mut query = Query::from("SELECT * FROM ks.table");
36+
let mut query = Statement::from("SELECT * FROM ks.table");
3737

38-
// Query is not assigned any specific profile, so session's profile is applied.
39-
// Therefore, the query will be executed with Consistency::One.
38+
// Statement is not assigned any specific profile, so session's profile is applied.
39+
// Therefore, the statement will be executed with Consistency::One.
4040
session.query_unpaged(query.clone(), ()).await?;
4141

4242
query.set_execution_profile_handle(Some(query_profile.into_handle()));
43-
// Query's profile is applied.
44-
// Therefore, the query will be executed with Consistency::Two.
43+
// Statement's profile is applied.
44+
// Therefore, the statement will be executed with Consistency::Two.
4545
session.query_unpaged(query.clone(), ()).await?;
4646

4747
query.set_consistency(Consistency::Three);
48-
// An option is set directly on the query.
49-
// Therefore, the query will be executed with Consistency::Three.
48+
// An option is set directly on the Statement.
49+
// Therefore, the statement will be executed with Consistency::Three.
5050
session.query_unpaged(query, ()).await?;
5151

5252
# Ok(())

docs/source/execution-profiles/remap.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Below, the remaps described above are followed in code.
2525
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
2626
use scylla::client::session::Session;
2727
use scylla::client::session_builder::SessionBuilder;
28-
use scylla::query::Query;
28+
use scylla::statement::unprepared::Statement;
2929
use scylla::statement::Consistency;
3030
use scylla::client::execution_profile::ExecutionProfile;
3131

@@ -46,8 +46,8 @@ let session: Session = SessionBuilder::new()
4646
.build()
4747
.await?;
4848

49-
let mut query1 = Query::from("SELECT * FROM ks.table");
50-
let mut query2 = Query::from("SELECT pk FROM ks.table WHERE pk = ?");
49+
let mut query1 = Statement::from("SELECT * FROM ks.table");
50+
let mut query2 = Statement::from("SELECT pk FROM ks.table WHERE pk = ?");
5151

5252
query1.set_execution_profile_handle(Some(handle1.clone()));
5353
query2.set_execution_profile_handle(Some(handle2.clone()));

docs/source/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ Although optimized for Scylla, the driver is also compatible with [Apache Cassan
1212

1313

1414
## Contents
15-
* [Quick start](quickstart/quickstart.md) - Setting up a Rust project using `scylla-rust-driver` and running a few queries
15+
* [Quick start](quickstart/quickstart.md) - Setting up a Rust project using `scylla-rust-driver` and executing a few CQL statements
1616
* [Migration guides](migration-guides/migration-guides.md) - How to update the code that used an older version of this driver
1717
* [Connecting to the cluster](connecting/connecting.md) - Configuring a connection to scylla cluster
18-
* [Making queries](queries/queries.md) - Making different types of queries (simple, prepared, batch, paged)
19-
* [Execution profiles](execution-profiles/execution-profiles.md) - Grouping query execution configuration options together and switching them all at once
18+
* [CQL statement execution](statements/statements.md) - Executing different types of CQL statement (simple, prepared, batch, paged)
19+
* [Execution profiles](execution-profiles/execution-profiles.md) - Grouping statement execution configuration options together and switching them all at once
2020
* [Data Types](data-types/data-types.md) - How to use various column data types
2121
* [Load balancing](load-balancing/load-balancing.md) - Load balancing configuration
22-
* [Retry policy configuration](retry-policy/retry-policy.md) - What to do when a query fails, query idempotence
23-
* [Driver metrics](metrics/metrics.md) - Statistics about the driver - number of queries, latency etc.
22+
* [Retry policy configuration](retry-policy/retry-policy.md) - What to do when execution attempt fails, statement idempotence
23+
* [Driver metrics](metrics/metrics.md) - Statistics about the driver - number of executed statements, latency etc.
2424
* [Logging](logging/logging.md) - Viewing and integrating logs produced by the driver
25-
* [Query tracing](tracing/tracing.md) - Tracing query execution
25+
* [Request tracing](tracing/tracing.md) - Tracing request execution
2626
* [Database schema](schema/schema.md) - Fetching and inspecting database schema

docs/source/queries/lwt.md

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/source/retry-policy/default.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,43 @@ let session: Session = SessionBuilder::new()
3030
# }
3131
```
3232

33-
To use in a [simple query](../queries/simple.md):
33+
To use in an [unprepared statement](../statements/unprepared.md):
3434
```rust
3535
# extern crate scylla;
3636
# use scylla::client::session::Session;
3737
# use std::error::Error;
3838
# use std::sync::Arc;
3939
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
40-
use scylla::query::Query;
40+
use scylla::statement::unprepared::Statement;
4141
use scylla::client::execution_profile::ExecutionProfile;
4242
use scylla::policies::retry::DefaultRetryPolicy;
4343

44-
// Create a Query manually and set the retry policy
45-
let mut my_query: Query = Query::new("INSERT INTO ks.tab (a) VALUES(?)");
46-
my_query.set_retry_policy(Some(Arc::new(DefaultRetryPolicy::new())));
44+
// Create a Statement manually and set the retry policy
45+
let mut my_statement: Statement = Statement::new("INSERT INTO ks.tab (a) VALUES(?)");
46+
my_statement.set_retry_policy(Some(Arc::new(DefaultRetryPolicy::new())));
4747

4848
// You can also set retry policy in an execution profile
4949
let handle = ExecutionProfile::builder()
5050
.retry_policy(Arc::new(DefaultRetryPolicy::new()))
5151
.build()
5252
.into_handle();
53-
my_query.set_execution_profile_handle(Some(handle));
53+
my_statement.set_execution_profile_handle(Some(handle));
5454

55-
// Run the query using this retry policy
55+
// Execute the statement using this retry policy
5656
let to_insert: i32 = 12345;
57-
session.query_unpaged(my_query, (to_insert,)).await?;
57+
session.query_unpaged(my_statement, (to_insert,)).await?;
5858
# Ok(())
5959
# }
6060
```
6161

62-
To use in a [prepared query](../queries/prepared.md):
62+
To use in a [prepared statement](../statements/prepared.md):
6363
```rust
6464
# extern crate scylla;
6565
# use scylla::client::session::Session;
6666
# use std::error::Error;
6767
# use std::sync::Arc;
6868
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
69-
use scylla::prepared_statement::PreparedStatement;
69+
use scylla::statement::prepared::PreparedStatement;
7070
use scylla::client::execution_profile::ExecutionProfile;
7171
use scylla::policies::retry::DefaultRetryPolicy;
7272

@@ -83,7 +83,7 @@ let handle = ExecutionProfile::builder()
8383
.into_handle();
8484
prepared.set_execution_profile_handle(Some(handle));
8585

86-
// Run the query using this retry policy
86+
// Execute the statement using this retry policy
8787
let to_insert: i32 = 12345;
8888
session.execute_unpaged(&prepared, (to_insert,)).await?;
8989
# Ok(())

0 commit comments

Comments
 (0)