Skip to content

Commit e1139cc

Browse files
authored
Merge pull request #96 from ThePrez/test/extendedchar
Improved support for multibyte characters
2 parents 7785ee8 + 62b606d commit e1139cc

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

src/connection/serverComponent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class ServerComponent {
5656
const path = this.getComponentPath();
5757

5858
if (path) {
59-
return `/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java -jar ${path}`
59+
return `/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit/bin/java -Dos400.stdio.convert=N -jar ${path}`
6060
}
6161
}
6262

src/connection/sqlJob.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export class SQLJob {
5656
const instance = getInstance();
5757
const connection = instance.getConnection();
5858
return new Promise((resolve, reject) => {
59-
connection.client.connection.exec(ServerComponent.getInitCommand() + ` && exit`, {}, (err: any, stream: any) => {
59+
// Setting QIBM_JAVA_STDIO_CONVERT and QIBM_PASE_DESCRIPTOR_STDIO to make sure all PASE and Java converters are off
60+
connection.client.connection.exec(`QIBM_JAVA_STDIO_CONVERT=N QIBM_PASE_DESCRIPTOR_STDIO=B exec `+ServerComponent.getInitCommand(), {}, (err: any, stream: any, options: {encoding: `binary`}) => {
6061
if (err)
6162
reject(err);
6263
let outString = ``;

src/testing/jobs.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,22 @@ export const JobsSuite: TestSuite = {
100100
newJob.close();
101101
}},
102102

103+
{name: `Can round-trip Extended characters`, test: async () => {
104+
assert.strictEqual(ServerComponent.isInstalled(), true);
105+
106+
let testString = `¯\\_(ツ)_/¯`
107+
let newJob = new SQLJob();
108+
await newJob.connect();
109+
let qryResults = await newJob.query(`create table qtemp.weewoo (col1 varchar(1208) ccsid 1208)`).run();
110+
assert.equal(qryResults.success, true);
111+
qryResults = await newJob.query(`insert into qtemp.weewoo values('${testString}')`).run();
112+
assert.equal(qryResults.success, true);
113+
qryResults = await newJob.query(`select COL1 from qtemp.weewoo`).run();
114+
assert.equal(qryResults.success, true);
115+
let resultData = qryResults.data[0]['COL1'];
116+
assert.equal(resultData, testString);
117+
newJob.close();
118+
}},
103119
{name: `Auto close statements`, test: async () => {
104120
let newJob = new SQLJob();
105121
await newJob.connect();

0 commit comments

Comments
 (0)