(
db: &RelationalDB,
tx: &mut crate::db::relational_db::MutTx,
table_name: &str,
schema: ProductType,
rows: &[ProductValue],
access: StAccess,
)
| 303 | } |
| 304 | |
| 305 | fn create_table_with_rows( |
| 306 | db: &RelationalDB, |
| 307 | tx: &mut crate::db::relational_db::MutTx, |
| 308 | table_name: &str, |
| 309 | schema: ProductType, |
| 310 | rows: &[ProductValue], |
| 311 | access: StAccess, |
| 312 | ) -> ResultTest<Arc<TableSchema>> { |
| 313 | let columns = schema |
| 314 | .elements |
| 315 | .iter() |
| 316 | .cloned() |
| 317 | .enumerate() |
| 318 | .map(|(i, element)| ColumnSchema { |
| 319 | table_id: TableId::SENTINEL, |
| 320 | col_name: Identifier::new(element.name.unwrap()).unwrap(), |
| 321 | col_type: element.algebraic_type, |
| 322 | col_pos: ColId(i as _), |
| 323 | alias: None, |
| 324 | }) |
| 325 | .collect(); |
| 326 | |
| 327 | let table_id = db.create_table( |
| 328 | tx, |
| 329 | TableSchema::new( |
| 330 | TableId::SENTINEL, |
| 331 | TableName::for_test(table_name), |
| 332 | None, |
| 333 | columns, |
| 334 | vec![], |
| 335 | vec![], |
| 336 | vec![], |
| 337 | StTableType::User, |
| 338 | access, |
| 339 | None, |
| 340 | None, |
| 341 | false, |
| 342 | None, |
| 343 | ), |
| 344 | )?; |
| 345 | let schema = db.schema_for_table_mut(tx, table_id)?; |
| 346 | |
| 347 | for row in rows { |
| 348 | insert(db, tx, table_id, row)?; |
| 349 | } |
| 350 | |
| 351 | Ok(schema) |
| 352 | } |
| 353 | |
| 354 | fn create_data(total_rows: u64) -> ResultTest<(TestDB, TestRows)> { |
| 355 | let stdb = TestDB::durable()?; |
searching dependent graphs…