|
Well, I wrote my own trimmer (faster than a RFE) ....Best regards
Typical (IBM db2a) SQL result returned in Javascript Object
[
{
"WCWUSC": "QSECOFR",
"WCHEAD": "Security Officer ",
"WCRCST": "123456",
"WCRCDC": "N",
"WCRCUD": "1",
"WCCDTE": "32418"
},
{
"WCWUSC": "QUSER",
"WCHEAD": " Base User \" '' ",
"WCRCST": "A",
"WCRCDC": "D",
"WCRCUD": "",
"WCCDTE": "22254"
}
]
Result after .trimDataset(sqlResult)
[
{
"WCWUSC": "QSECOFR",
"WCHEAD": "Security Officer",
"WCRCST": "123456",
"WCRCDC": "N",
"WCRCUD": 1,
"WCCDTE": 32418
},
{
"WCWUSC": "QUSER",
"WCHEAD": " Base User\" ''",
"WCRCST": "A",
"WCRCDC": "D",
"WCRCUD": 0,
"WCCDTE": 22254
}
]
Result after .mapToSchema(sqlResult)
[
{
"userId": "QSECOFR",
"description": "Security Officer",
"http": "powerext.com",
"recordDeleteCode": false,
"recordUpdateCounter": 1,
"creationDate": "2018-03-24"
},
{
"userId": "QUSER",
"description": " Base User\" ''",
"http": "powerext.com",
"recordDeleteCode": true,
"recordUpdateCounter": 0,
"creationDate": "1954-02-22"
}
]
On Mon, Mar 26, 2018 at 3:43 PM, Justin Taylor <JUSTIN@xxxxxxxxxxxxx>
wrote:
" I believe that it is problably a common problem"db2a
Sounds like more reason for an RFE IMO.
-----Original Message-----
From: Henrik Rützou [mailto:hr@xxxxxxxxxxxx]
Sent: Saturday, March 24, 2018 12:47 PM
To: Web Enabling the IBM i (AS/400 and iSeries) <web400@xxxxxxxxxxxx>
Subject: Re: [WEB400] dataformatting in nodeJS SQL interface with IBM
Niels,
or as always "do it yourself" ;-)
Well I could raise a RFE but I believe that it is problably a common
problem at least with non-trimmed fields so I have written this little 26
line function that iterates throug an object and clean up most.
I can foresee that the next question is "what about booleans?"
I also seems to remember that there are some column metadata send by db2a
we just don't see them in the result set.
Maybee someone knows or has a link, it was in some example as far as I
remember.
On Sat, Mar 24, 2018 at 6:36 PM, Nathan Andelin <nandelin@xxxxxxxxx>
wrote:
Niels,"trim"
Could you clarify? Are you suggesting that somebody submit an RFE to
have IBM add new SQL connection settings that implement the desired
behaviors?
Nathan.
On Sat, Mar 24, 2018 at 9:08 AM, Niels Liisberg
<nli@xxxxxxxxxxxxxxxxx>
wrote:
At better solution would be: set the trim option on the connectionthe
since that is already IBM proprietary . Doing it on the select
statement would pollute the sql syntax.
Why don't you raise a RFE for both trimming and sql-alike data types
in
result-set. I think my friend Jesse Gorzinsky would love that.connotation,
lør. 24. mar. 2018 kl. 15.52 skrev Henrik Rützou <hr@xxxxxxxxxxxx>:
Nathan
a lazy programmer (and I'm one) is a programmer that dosn't code
100 similar programs from one end to the other - they have fun
making a program generator that then does the job they do not
bother to make ;-)
On Sat, Mar 24, 2018 at 3:10 PM, Nathan Andelin
<nandelin@xxxxxxxxx>
wrote:
Henrik,
The term "lazy programmer" is sometimes used with negative
faultand
other times used with positive connotation. In this case, I
don't
includingprogrammers who would rather not code the full SQL statement,
webrtrim() function calls required to trim fields.
I was just trying to say that this is a case where invoking a
REST
ofttimesservice API would provide a simpler interface for programmers. A
web-service API would relieve programmers of the verbosity and
mailingwrote:complexity of coding their own SQL statements.would
I'm just suggesting that this is a case where a REST web service
API
have advantages over Node's db2a interface.
On Sat, Mar 24, 2018 at 7:41 AM, Henrik Rützou <hr@xxxxxxxxxxxx>
fromhasn't
Nathan
you may call it lazy to want to have a transparent interface
that
toresultsets
be
touched every time you add a new or remove a column to a table.
Especially removing a column will cause errors if you specify
by specific field names, imho they sould automatically be
removed
arethe rest service and that should automatically result in the
field
appears -UserAremoved
in the UI regardless of code defining the field may exsist.
We are back to constructing an UI where if you filter the SSN
from
it dosn't appear in his UI but dons't filter it from UserB it
mailingboth running--
on the same code.
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
list
To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx Before posting, please
take a moment to review the archives at
https://archive.midrange.com/web400.
--
Regards,
Henrik Rützou
http://powerEXT.org <http://powerext.org/>
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
--listBest regards
To post a message email: WEB400@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
https://archive.midrange.com/web400.
--
Niels Liisberg
Chief Software Architect
System & Method A/S
Phone +45 70 20 30 10 <+45%2070%2020%2030%2010>
Mobile + 45 31 15 88 61 <+45%2031%2015%2088%2061>
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list To post a message email: WEB400@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
https://archive.midrange.com/web400.
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400)
mailing list To post a message email: WEB400@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/web400.
--
Regards,
Henrik Rützou
http://powerEXT.org <http://powerext.org/>
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
--
Regards,
Henrik Rützou
http://powerEXT.org <http://powerext.org/>
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.
--
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.