Skip to content

Commit 5df7d0a

Browse files
Support list_self_profile with sqlite db
Primarily only works when using a db exported from the production Postgres, but that is sufficient for now.
1 parent ca7da47 commit 5df7d0a

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

database/src/pool/sqlite.rs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -914,12 +914,35 @@ impl Connection for SqliteConnection {
914914
}
915915
async fn list_self_profile(
916916
&self,
917-
_aid: ArtifactId,
918-
_crate_: &str,
919-
_profile: &str,
920-
_scenario: &str,
917+
aid: ArtifactId,
918+
crate_: &str,
919+
profile: &str,
920+
scenario: &str,
921921
) -> Vec<(ArtifactIdNumber, i32)> {
922-
Vec::new()
922+
self.raw_ref()
923+
.prepare(
924+
"select aid, cid from raw_self_profile where
925+
crate = ?1 and
926+
profile = ?2 and
927+
cache = ?3 and
928+
aid = (select id from artifact where name = ?4);",
929+
)
930+
.unwrap()
931+
.query_map(
932+
params![
933+
&crate_,
934+
profile,
935+
scenario,
936+
&match aid {
937+
ArtifactId::Commit(c) => c.sha,
938+
ArtifactId::Tag(a) => a,
939+
}
940+
],
941+
|r| Ok((ArtifactIdNumber(r.get::<_, i32>(0)? as u32), r.get(1)?)),
942+
)
943+
.unwrap()
944+
.collect::<Result<_, _>>()
945+
.unwrap()
923946
}
924947

925948
async fn get_bootstrap(&self, aids: &[ArtifactIdNumber]) -> Vec<Option<Duration>> {

0 commit comments

Comments
 (0)