MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / insert_session

Method insert_session

mserver/MasterService/src/repository.rs:492–516  ·  view source on GitHub ↗
(
        &self,
        server_id: &str,
        session: &ServerRecentSession,
    )

Source from the content-addressed store, hash-verified

490 .execute(&mut *transaction)
491 .await?;
492 }
493
494 sqlx::query(&self.bind_sql(
495 "UPDATE servers SET server_id = ?, address = ?, hostport = ? WHERE server_id = ?",
496 ))
497 .bind(new_server_id)
498 .bind(new_address)
499 .bind(i64::from(new_hostport))
500 .bind(&old_server_id)
501 .execute(&mut *transaction)
502 .await?;
503
504 sqlx::query(&self.bind_sql(
505 "DELETE FROM server_samples
506 WHERE server_id = ? AND observed_unix_ms IN (
507 SELECT observed_unix_ms FROM server_samples WHERE server_id = ?
508 )",
509 ))
510 .bind(&old_server_id)
511 .bind(new_server_id)
512 .execute(&mut *transaction)
513 .await?;
514 sqlx::query(&self.bind_sql("UPDATE server_samples SET server_id = ? WHERE server_id = ?"))
515 .bind(new_server_id)
516 .bind(&old_server_id)
517 .execute(&mut *transaction)
518 .await?;
519

Calls 2

bind_sqlMethod · 0.80
executeMethod · 0.45

Tested by

no test coverage detected