Skip to content

Commit

Permalink
Merge pull request #1250 from muzarski/rename-query
Browse files Browse the repository at this point in the history
rename `Query` to `Statement`
  • Loading branch information
wprzytula authored Feb 27, 2025
2 parents 58d1aef + 72c5ed4 commit f591696
Show file tree
Hide file tree
Showing 61 changed files with 577 additions and 577 deletions.
26 changes: 13 additions & 13 deletions docs/source/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
- [Quick start](quickstart/quickstart.md)
- [Creating a project](quickstart/create-project.md)
- [Running Scylla using Docker](quickstart/scylla-docker.md)
- [Connecting and running a simple query](quickstart/example.md)
- [Connecting and executing a simple CQL statement](quickstart/example.md)

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

- [Making queries](queries/queries.md)
- [Simple query](queries/simple.md)
- [Query values](queries/values.md)
- [Query result](queries/result.md)
- [Prepared query](queries/prepared.md)
- [Batch statement](queries/batch.md)
- [Paged query](queries/paged.md)
- [Lightweight transaction query (LWT)](queries/lwt.md)
- [USE keyspace](queries/usekeyspace.md)
- [Schema agreement](queries/schema-agreement.md)
- [Query timeouts](queries/timeouts.md)
- [Timestamp generators](queries/timestamp-generators.md)
- [Executing CQL statements](statements/statements.md)
- [Unprepared statement](statements/unprepared.md)
- [Statement values](statements/values.md)
- [Query result](statements/result.md)
- [Prepared statement](statements/prepared.md)
- [Batch statement](statements/batch.md)
- [Paged query](statements/paged.md)
- [Lightweight transaction statement (LWT)](statements/lwt.md)
- [USE keyspace](statements/usekeyspace.md)
- [Schema agreement](statements/schema-agreement.md)
- [Request timeouts](statements/timeouts.md)
- [Timestamp generators](statements/timestamp-generators.md)

- [Execution profiles](execution-profiles/execution-profiles.md)
- [Creating a profile and setting it](execution-profiles/create-and-use.md)
Expand Down
2 changes: 1 addition & 1 deletion docs/source/contents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
index
quickstart/quickstart
connecting/connecting
queries/queries
statements/statements
execution-profiles/execution-profiles
data-types/data-types
load-balancing/load-balancing
Expand Down
4 changes: 2 additions & 2 deletions docs/source/data-types/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ to achieve seamless sending and receiving of CQL values.

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

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

Database types and their Rust equivalents:
* `Boolean` <----> `bool`
Expand Down
8 changes: 4 additions & 4 deletions docs/source/execution-profiles/create-and-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ let session: Session = SessionBuilder::new()
```

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

let handle = profile.into_handle();

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

let mut query2 = Query::from("SELECT pk FROM ks.table WHERE pk = ?");
let mut query2 = Statement::from("SELECT pk FROM ks.table WHERE pk = ?");
query2.set_execution_profile_handle(Some(handle));
# Ok(())
# }
Expand Down
4 changes: 2 additions & 2 deletions docs/source/execution-profiles/maximal-example.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# extern crate scylla;
# use std::error::Error;
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::statement::unprepared::Statement;
use scylla::policies::speculative_execution::SimpleSpeculativeExecutionPolicy;
use scylla::statement::{Consistency, SerialConsistency};
use scylla::client::execution_profile::ExecutionProfile;
Expand All @@ -32,7 +32,7 @@ let profile = ExecutionProfile::builder()
)
.build();

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

# Ok(())
Expand Down
16 changes: 8 additions & 8 deletions docs/source/execution-profiles/priority.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Priorities of execution profiles and directly set options:
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::client::session::Session;
use scylla::client::session_builder::SessionBuilder;
use scylla::query::Query;
use scylla::statement::unprepared::Statement;
use scylla::statement::Consistency;
use scylla::client::execution_profile::ExecutionProfile;

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

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

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

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

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

# Ok(())
Expand Down
6 changes: 3 additions & 3 deletions docs/source/execution-profiles/remap.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Below, the remaps described above are followed in code.
# async fn check_only_compiles() -> Result<(), Box<dyn Error>> {
use scylla::client::session::Session;
use scylla::client::session_builder::SessionBuilder;
use scylla::query::Query;
use scylla::statement::unprepared::Statement;
use scylla::statement::Consistency;
use scylla::client::execution_profile::ExecutionProfile;

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

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

query1.set_execution_profile_handle(Some(handle1.clone()));
query2.set_execution_profile_handle(Some(handle2.clone()));
Expand Down
12 changes: 6 additions & 6 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Although optimized for Scylla, the driver is also compatible with [Apache Cassan


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

This file was deleted.

22 changes: 11 additions & 11 deletions docs/source/retry-policy/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,43 +30,43 @@ let session: Session = SessionBuilder::new()
# }
```

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

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

// You can also set retry policy in an execution profile
let handle = ExecutionProfile::builder()
.retry_policy(Arc::new(DefaultRetryPolicy::new()))
.build()
.into_handle();
my_query.set_execution_profile_handle(Some(handle));
my_statement.set_execution_profile_handle(Some(handle));

// Run the query using this retry policy
// Execute the statement using this retry policy
let to_insert: i32 = 12345;
session.query_unpaged(my_query, (to_insert,)).await?;
session.query_unpaged(my_statement, (to_insert,)).await?;
# Ok(())
# }
```

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

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

// Run the query using this retry policy
// Execute the statement using this retry policy
let to_insert: i32 = 12345;
session.execute_unpaged(&prepared, (to_insert,)).await?;
# Ok(())
Expand Down
20 changes: 10 additions & 10 deletions docs/source/retry-policy/downgrading-consistency.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ let session: Session = SessionBuilder::new()
# }
```

To use in a [simple query](../queries/simple.md):
To use in an [unprepared statement](../statements/unprepared.md):
```rust
# extern crate scylla;
# use scylla::client::session::Session;
# use std::error::Error;
# use std::sync::Arc;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::statement::unprepared::Statement;
use scylla::client::execution_profile::ExecutionProfile;
use scylla::policies::retry::DowngradingConsistencyRetryPolicy;

Expand All @@ -87,25 +87,25 @@ let handle = ExecutionProfile::builder()
.build()
.into_handle();

// Create a Query manually and set the retry policy
let mut my_query: Query = Query::new("INSERT INTO ks.tab (a) VALUES(?)");
my_query.set_execution_profile_handle(Some(handle));
// Create a Statement manually and set the retry policy
let mut my_statement: Statement = Statement::new("INSERT INTO ks.tab (a) VALUES(?)");
my_statement.set_execution_profile_handle(Some(handle));

// Run the query using this retry policy
// Execute the statement using this retry policy
let to_insert: i32 = 12345;
session.query_unpaged(my_query, (to_insert,)).await?;
session.query_unpaged(my_statement, (to_insert,)).await?;
# Ok(())
# }
```

To use in a [prepared query](../queries/prepared.md):
To use in a [prepared statement](../statements/prepared.md):
```rust
# extern crate scylla;
# use scylla::client::session::Session;
# use std::error::Error;
# use std::sync::Arc;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::prepared_statement::PreparedStatement;
use scylla::statement::prepared::PreparedStatement;
use scylla::client::execution_profile::ExecutionProfile;
use scylla::policies::retry::DowngradingConsistencyRetryPolicy;

Expand All @@ -122,7 +122,7 @@ let mut prepared: PreparedStatement = session
prepared.set_execution_profile_handle(Some(handle));


// Run the query using this retry policy
// Execute the statement using this retry policy
let to_insert: i32 = 12345;
session.execute_unpaged(&prepared, (to_insert,)).await?;
# Ok(())
Expand Down
18 changes: 9 additions & 9 deletions docs/source/retry-policy/fallthrough.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ let session: Session = SessionBuilder::new()
# }
```

To use in a [simple query](../queries/simple.md):
To use in an [unprepared statement](../statements/unprepared.md):
```rust
# extern crate scylla;
# use scylla::client::session::Session;
# use std::error::Error;
# use std::sync::Arc;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::query::Query;
use scylla::statement::unprepared::Statement;
use scylla::client::execution_profile::ExecutionProfile;
use scylla::policies::retry::FallthroughRetryPolicy;

Expand All @@ -45,25 +45,25 @@ let handle = ExecutionProfile::builder()
.build()
.into_handle();

// Create a Query manually and set the retry policy
let mut my_query: Query = Query::new("INSERT INTO ks.tab (a) VALUES(?)");
my_query.set_execution_profile_handle(Some(handle));
// Create a Statement manually and set the retry policy
let mut my_statement: Statement = Statement::new("INSERT INTO ks.tab (a) VALUES(?)");
my_statement.set_execution_profile_handle(Some(handle));

// Run the query using this retry policy
// Execute the statement using this retry policy
let to_insert: i32 = 12345;
session.query_unpaged(my_query, (to_insert,)).await?;
session.query_unpaged(my_statement, (to_insert,)).await?;
# Ok(())
# }
```

To use in a [prepared query](../queries/prepared.md):
To use in a [prepared statement](../statements/prepared.md):
```rust
# extern crate scylla;
# use scylla::client::session::Session;
# use std::error::Error;
# use std::sync::Arc;
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> {
use scylla::prepared_statement::PreparedStatement;
use scylla::statement::prepared::PreparedStatement;
use scylla::client::execution_profile::ExecutionProfile;
use scylla::policies::retry::FallthroughRetryPolicy;

Expand Down
Loading

0 comments on commit f591696

Please sign in to comment.