-
Notifications
You must be signed in to change notification settings - Fork 92
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
Major API cleanup #1968
Major API cleanup #1968
Conversation
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
Signed-off-by: Seb Julliand <sebjulliand@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me @worksofliam !
The code is OK (save for a very small suggested change) and it all runs fine.
I guess it's unrelated, but there is the Test getTable (SQL compared to nosql)
test that fails because all the numeric fields are strings in tableB, making deepEqual to fail.
// added by liam
Object.keys(tableA[0]).forEach(k => {console.log({k, a: tableA[0][k], b: tableB[0][k], at: typeof tableA[0][k], bt: typeof tableB[0][k]})});
Object.keys(tableA[0]).map(k => ({k, a: tableA[0][k], b: tableB[0][k], at: typeof tableA[0][k], bt: typeof tableB[0][k], mismatch: (typeof tableA[0][k]) !== (typeof tableB[0][k]) }));
Object.keys(tableA[0])
.map(k => ({k, a: tableA[0][k], b: tableB[0][k], at: typeof tableA[0][k], bt: typeof tableB[0][k], mismatch: (typeof tableA[0][k]) !== (typeof tableB[0][k]) }))
.filter(r => r.mismatch)
Anyway, just see that small suggestion and we can merge afterwards. Good job, I love a good cleanup!
Signed-off-by: worksofliam <mrliamallan@live.co.uk>
@sebjulliand Fixed your suggestion - thanks! I also tried to fix that issue but there is a deeper issue that the CSV parser and our |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved! Merge whenever you want. 😎
Changes
This is a fairly large API change, but I think a good one. At a high level, here are the biggest changes:
CCSID and SQL logic
runSQL
was moved fromIBMiContent
and intoIBMi
. It made more sense here as we need to run SQL statements during the connection.runSQL
inIBMiContent
was marked as deprecated, but maps to the new implementation inIBMi
.qccsid
inIBMi
was renamed toruntimeCcsid
. I thought the previous name was wrong as it could hold both the user CCSID or the QCCSID.runtimeCcsidOrigin
to determine if theruntimeCcsid
was from the user profile or from the system.runtimeCcsid
anduserDefaultCCSID
were made private so they could not be changed in code and only altered during connection.getEncoding
returns whichever CCSID should be used. This takes both the QCCSID and user default CCSID. So instead of each API determining if our subsequent calls should use QCCSID or default CCSID, this API does it for you. You will see this is used inrunSQL
.enableSQL
configenableSQL
has been removed.enableSQL
, in theIBMi
class.enableSQL
will returntrue
when these two conditions are met: the SQL runner is available and the user has a valid CCSID (which we determine thanks togetEncoding
)config.enableSQL
have been replaced withconnection.enableSQL
enableSQL
. This is used for two reasons:enableSQL
in some places (namely the QSYS FS provider)getMemberList
used SQL even when it was disabled. I had to update a test case for that instance. We now expect it to crash when SQL is disabled. Is this a problem?Todo
qccsid
prop onIBMi
forruntimeCcsid
, since we're actually grabbing both the user CCSID first and then the QCCSID if need be. IBMi.ts:622-632How to test this PR
The failing test case here ('Write tab to member using SQL') is a known issue and is not affected by this PR.
Checklist
console.log
s I added