Was this page helpful?
Caution
You're viewing documentation for an unstable version of Scylla Rust Driver. Switch to the latest stable version.
Ascii
, Text
and Varchar
are represented as &str
and String
use scylla::IntoTypedRows;
// Insert some text into the table as a &str
let to_insert_str: &str = "abcdef";
session
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert_str,))
.await?;
// Insert some text into the table as a String
let to_insert_string: String = "abcdef".to_string();
session
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert_string,))
.await?;
// Read ascii/text/varchar from the table
if let Some(rows) = session.query("SELECT a FROM keyspace.table", &[]).await?.rows {
for row in rows.into_typed::<(String,)>() {
let (text_value,): (String,) = row?;
}
}
Was this page helpful?