MCPcopy Create free account
hub / github.com/chatmail/core / table_exists

Method table_exists

src/sql.rs:492–505  ·  view source on GitHub ↗

Query the database if the requested table already exists.

(&self, name: &str)

Source from the content-addressed store, hash-verified

490
491 /// Query the database if the requested table already exists.
492 pub async fn table_exists(&self, name: &str) -> Result<bool> {
493 let query_only = true;
494 self.call(query_only, move |conn| {
495 let mut exists = false;
496 conn.pragma(None, "table_info", name.to_string(), |_row| {
497 // will only be executed if the info was found
498 exists = true;
499 Ok(())
500 })?;
501
502 Ok(exists)
503 })
504 .await
505 }
506
507 /// Check if a column exists in a given table.
508 pub async fn col_exists(&self, table_name: &str, col_name: &str) -> Result<bool> {

Callers 1

runFunction · 0.80

Calls 1

callMethod · 0.80

Tested by

no test coverage detected