Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support Oracle Implicit Results (#8050)
- Loading branch information
Showing
2 changed files
with
62 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import "reflect-metadata"; | ||
import { Connection } from "../../../src"; | ||
import { closeTestingConnections, createTestingConnections } from "../../utils/test-utils"; | ||
import { expect } from "chai"; | ||
|
||
describe("query runner > implicit results", () => { | ||
|
||
let connections: Connection[]; | ||
before(async () => { | ||
connections = await createTestingConnections({ | ||
entities: [__dirname + "/view/*{.js,.ts}"], | ||
enabledDrivers: ["oracle"], | ||
schemaCreate: true, | ||
dropSchema: true, | ||
}); | ||
}); | ||
after(() => closeTestingConnections(connections)); | ||
|
||
it("should return results for Oracle Stored Procedure with Implicit Results", () => Promise.all(connections.map(async connection => { | ||
const queryRunner = connection.createQueryRunner(); | ||
|
||
// Create sample procedure with implicit results | ||
await connection.query(` | ||
CREATE OR REPLACE PROCEDURE TEST_IMPLICIT_RESULTS | ||
AS | ||
test_array dbms_sql.varchar2_table; | ||
cur1 sys_refcursor; | ||
BEGIN | ||
test_array(1) := 'First'; | ||
test_array(2) := 'Second'; | ||
test_array(3) := 'Third'; | ||
OPEN cur1 FOR SELECT * FROM TABLE(test_array); | ||
DBMS_SQL.return_result(cur1); | ||
END; | ||
`); | ||
|
||
const result = await queryRunner.query(` | ||
BEGIN | ||
TEST_IMPLICIT_RESULTS; | ||
END; | ||
`); | ||
|
||
expect(result).to.be.an('array'); | ||
expect(result).to.eql( | ||
[ | ||
[ | ||
{ COLUMN_VALUE: 'First' }, | ||
{ COLUMN_VALUE: 'Second' }, | ||
{ COLUMN_VALUE: 'Third' }, | ||
] | ||
] | ||
); | ||
|
||
await queryRunner.release(); | ||
}))); | ||
|
||
}); |