This function checks whether the table has oids or not.
(self, default_conn=None)
| 551 | return True |
| 552 | |
| 553 | def has_oids(self, default_conn=None): |
| 554 | """ |
| 555 | This function checks whether the table has oids or not. |
| 556 | """ |
| 557 | driver = get_driver(PG_DEFAULT_DRIVER) |
| 558 | manager = driver.connection_manager(self.sid) |
| 559 | |
| 560 | # Remove the special behavior of OID columns from |
| 561 | # PostgreSQL 12 onwards, so returning False. |
| 562 | if manager.sversion >= 120000: |
| 563 | return False |
| 564 | |
| 565 | if default_conn is None: |
| 566 | conn = manager.connection(did=self.did, conn_id=self.conn_id) |
| 567 | else: |
| 568 | conn = default_conn |
| 569 | |
| 570 | if conn.connected(): |
| 571 | |
| 572 | # Fetch the table oids status |
| 573 | query = render_template( |
| 574 | "/".join([self.sql_path, 'has_oids.sql']), obj_id=self.obj_id) |
| 575 | |
| 576 | status, has_oids = conn.execute_scalar(query) |
| 577 | if not status: |
| 578 | raise ExecuteError(has_oids) |
| 579 | |
| 580 | else: |
| 581 | raise InternalServerError(SERVER_CONNECTION_CLOSED) |
| 582 | |
| 583 | return has_oids |
| 584 | |
| 585 | def save(self, |
| 586 | changed_data, |
no test coverage detected