libsql
libsql copied to clipboard
Stack overflow exception then trying to get sqlite schema on an empty turso database on Windows (only)
Stack overflow exception then trying to get sqlite schema on an empty turso database on Windows (only). Works on linux (Fedora v40), unknown for MacOs.
use libsql::{Builder, Connection};
#[tokio::main]
async fn main() {
let builder = Builder::new_remote("libsql://<subdomain>.turso.io".into(), "<token>".into()).build().await.unwrap();
let connection = builder.connect().unwrap();
get_current_db_schema("Test", &connection).await;
}
pub async fn get_current_db_schema(name: &str, connection: &Connection) -> Option<Vec<String>> {
let query = format!("SELECT sql FROM sqlite_schema WHERE name = {}", name);
let result_query = connection
.query(&query, ())
.await;
if let Ok(mut result_row) = result_query {
let result_rows = result_row
.next()
.await;
if let Ok(_result_row) = result_rows {
return None;
}
else {
return None;
}
}
else {
return None;
}
}
Repository with the same code: https://github.com/milen-denev/libsql_stackoverflow/
#1051
Is there anyone looking at this issue, I am a library maintainer, and I wish I could move forward supporting both Windows and Linux.