Was this page helpful?
Caution
You're viewing documentation for a deprecated 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
let result = session.query("SELECT a FROM keyspace.table", &[]).await?;
let mut iter = result.rows_typed::<(String,)>()?;
while let Some((text_value,)) = iter.next().transpose()? {
println!("{}", text_value);
}
Was this page helpful?