-
-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c634bf
commit e353b97
Showing
9 changed files
with
96 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,21 @@ | ||
from typing import TYPE_CHECKING, cast | ||
|
||
from tortoise import Model | ||
from tortoise.backends.odbc.executor import ODBCExecutor | ||
|
||
if TYPE_CHECKING: | ||
from .client import OracleClient # pylint: disable=W0611 | ||
|
||
|
||
class OracleExecutor(ODBCExecutor): | ||
async def _process_insert_result(self, instance: Model, results: int) -> None: | ||
sql = "SELECT SEQUENCE_NAME FROM ALL_TAB_IDENTITY_COLS where TABLE_NAME = ? and OWNER = ?" | ||
ret = await self.db.execute_query_dict( | ||
sql, values=[instance._meta.db_table, self.db.database] # type: ignore | ||
) | ||
db = cast("OracleClient", self.db) | ||
ret = await db.execute_query_dict(sql, values=[instance._meta.db_table, db.database]) | ||
try: | ||
seq = ret[0]["SEQUENCE_NAME"] | ||
except IndexError: | ||
return | ||
sql = f"SELECT {seq}.CURRVAL FROM DUAL" # nosec:B608 | ||
ret = await self.db.execute_query_dict(sql) | ||
await super(OracleExecutor, self)._process_insert_result(instance, ret[0]["CURRVAL"]) | ||
ret = await db.execute_query_dict(sql) | ||
await super()._process_insert_result(instance, ret[0]["CURRVAL"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters