MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / run

Function run

crates/core/src/sql/execute.rs:52–64  ·  view source on GitHub ↗

Run the `SQL` string using the `auth` credentials If a `ModuleHost` is provided, the SQL query is executed via the module host, meaning the module’s core is used to run the statement. If no module host is provided, the SQL query is executed on the current thread.

(
    db: Arc<RelationalDB>,
    sql_text: String,
    auth: AuthCtx,
    subs: Option<ModuleSubscriptions>,
    module: Option<ModuleHost>,
    head: &mut Vec<(RawIdentifier, AlgebraicType)>,
)

Source from the content-addressed store, hash-verified

50/// meaning the module’s core is used to run the statement.
51/// If no module host is provided, the SQL query is executed on the current thread.
52pub async fn run(
53 db: Arc<RelationalDB>,
54 sql_text: String,
55 auth: AuthCtx,
56 subs: Option<ModuleSubscriptions>,
57 module: Option<ModuleHost>,
58 head: &mut Vec<(RawIdentifier, AlgebraicType)>,
59) -> Result<SqlResult, DBError> {
60 match module {
61 Some(module) => module.call_sql(db, sql_text, auth, subs, head).await,
62 None => run_inner::<crate::host::wasmtime::WasmtimeInstance>(None, db, sql_text, auth, subs, head).map(|x| x.0),
63 }
64}
65
66/// Run the `SQL` string using the provided `WasmInstance` and `ModuleDef`
67///

Callers 15

run_for_testingFunction · 0.70
test_row_limitFunction · 0.70
test_row_dmlFunction · 0.70
project_cols_bsatnMethod · 0.50
run_describerFunction · 0.50
with_spanMethod · 0.50
async_with_spanMethod · 0.50
cvtMethod · 0.50
with_sys_resultFunction · 0.50
with_nothingFunction · 0.50
test_updates_for_dmlFunction · 0.50
exec_sqlMethod · 0.50

Calls 2

call_sqlMethod · 0.45
mapMethod · 0.45

Tested by 3

test_row_limitFunction · 0.56
test_row_dmlFunction · 0.56
test_updates_for_dmlFunction · 0.40