(self)
| 506 | self.assertEqual(res, 'INSERT 0 2') |
| 507 | |
| 508 | async def test_sql_dml_insert_21(self): |
| 509 | # CommandComplete tag (inserted rows) with RETURNING |
| 510 | |
| 511 | query = ''' |
| 512 | INSERT INTO "Document" (title) VALUES ('Report'), ('Briefing') |
| 513 | RETURNING id as my_id; |
| 514 | ''' |
| 515 | |
| 516 | res = await self.scon.fetch(query) |
| 517 | self.assert_shape(res, rows=2, columns=["my_id"]) |
| 518 | |
| 519 | # simple (text) protocol |
| 520 | res = await self.scon.execute(query) |
| 521 | self.assertEqual(res, 'INSERT 0 2') |
| 522 | |
| 523 | # extended (binary) protocol because we used args |
| 524 | query = ''' |
| 525 | INSERT INTO "Document" (title) VALUES ($1), ($2) |
| 526 | RETURNING id as my_id; |
| 527 | ''' |
| 528 | res = await self.scon.execute(query, 'Report', 'Briefing') |
| 529 | self.assertEqual(res, 'INSERT 0 2') |
| 530 | |
| 531 | async def test_sql_dml_insert_22(self): |
| 532 | # insert into link table |
nothing calls this directly
no test coverage detected