Skip to content

Commit

Permalink
fix: resolve issues ora-00972:identifier is too long
Browse files Browse the repository at this point in the history
Closes: typeorm#5067
  • Loading branch information
Murat Gundes committed Aug 19, 2020
1 parent c96ab43 commit 25a8214
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/driver/oracle/OracleDriver.ts
Expand Up @@ -627,7 +627,7 @@ export class OracleDriver implements Driver {
* Creates an escaped parameter.
*/
createParameter(parameterName: string, index: number): string {
return ":" + parameterName;
return ":" + (index + 1);
}

/**
Expand Down
24 changes: 24 additions & 0 deletions test/github-issues/5067/issue-5067.ts
@@ -0,0 +1,24 @@
import "reflect-metadata";
import {expect} from "chai";
import {Connection} from "../../../src";
import {closeTestingConnections, createTestingConnections} from "../../utils/test-utils";

describe.only("github issues > #5067 ORA-00972: identifier is too long", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
entities: [__dirname + "/entity/*{.js,.ts}"]
}));
after(() => closeTestingConnections(connections));

it("generated parameter name returns index instead of parameter name", () => Promise.all(connections.map(async connection => {
const paramName = "output_";
const parametersCount = 0;
const createdParameter = await connection.driver.createParameter(paramName, parametersCount);

expect(createdParameter).to.be.not.undefined;
expect(createdParameter).to.be.not.null;
expect(createdParameter).to.be.an("String");
expect(createdParameter).to.not.match(/(?:output_)/);
expect(await connection.driver.createParameter(paramName, 2)).to.equal(":" + 3);
})));
});

0 comments on commit 25a8214

Please sign in to comment.