Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve issues ora-00972:identifier is too long #6751

Merged
merged 4 commits into from Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/driver/oracle/OracleDriver.ts
Expand Up @@ -635,7 +635,7 @@ export class OracleDriver implements Driver {
* Creates an escaped parameter.
*/
createParameter(parameterName: string, index: number): string {
return ":" + parameterName;
return ":" + (index + 1);
}

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

describe("github issues > #5067 ORA-00972: identifier is too long", () => {
let connections: Connection[];
before(async () => connections = await createTestingConnections({
enabledDrivers: ["oracle"]
}));
after(() => closeTestingConnections(connections));

it("generated parameter name is within the size constraints", () => Promise.all(connections.map(async connection => {
const paramName = "output_that_is_really_long_and_must_be_truncated_in_this_driver";
const createdParameter = await connection.driver.createParameter(paramName, 0);

expect(createdParameter).to.be.an("String");
expect(createdParameter.length).to.be.lessThan(30);
})));
});