2009 shaares
6 private links
6 private links
8 results
tagged
db
async fn create_records(tx: &mut Transaction<Postgres>, records: &[Record]) -> Result<(), Error> {
if records.is_empty() {
return Ok(());
}
let mut query_builder: QueryBuilder<Postgres> = QueryBuilder::new(
// Note the trailing space
"INSERT INTO records
(id, some_data) ",
);
query_builder.push_values(records, |mut query_builder, record| {
query_builder
.push_bind(record.id)
.push_bind(&record.some_data);
});
let query = query_builder.build();
query
.execute(tx)
.await
.map_err(|err| Error::Unspecified(format!("create_records: {err}")))?;
return Ok(());
}
If you use a relational database, you are almost certainly underusing constraints. This post is a checklist of useful database constraints you should consider when designing a schema.
Transform db into rest api
And lot more explanation on indexes in postgres
Inj3ct0r is the ultimate database of exploits and vulnerabilities and a great resource for vulnerability researchers and security professionals.