• [Info-ingres] Convert hex string to an integer

    From Martin Bowes@21:1/5 to All on Wed Aug 11 13:21:25 2021
    --_000_d2347ae620c54abaab28ed80772a8763ndphoxacuk_
    Content-Type: text/plain; charset="koi8-r"
    Content-Transfer-Encoding: quoted-printable
    X-WatchGuard-AntiVirus: part scanned. clean action=allow

    Hi All,

    There has got to be an easier way....

    Given a string which represents a hex value, convert it to an integer of a given size.

    The only solution I've come up with is by making an OME function. See attached.

    Here is how I would describe that function...
    hex2int(hexString, integerSize)
    Convert the indicated hex string into a signed integer of the given size. Case is ignored.

    Two's complement is respected and hence when converting to integer1 the string 'FF' becomes -1. However the same string converted to integer2 becomes 255.

    The hex string may be prefixed with '0x', '+0x', or '-0x'. But in the case of '-0x' there is the possibility of a double negative if the string converts to a negative integer.

    And here is some sample output...
    select hex2int('FFFD', 8)\g
    ‚€€€€€€€€€€€€€€€€€€€€€€ƒ
    col1
    †€€€€€€€€€€€€€€€€€€€€€€‡
    65533
    „€€€€€€€€€€€€€€€€€€€€€€…
    (1 row)

    select hex2int('FFFD', 22)\g
    E_OME001 hex2int(): Invalid size '22' specified. It must be one of 1, 2,
    4, 8
    (Tue Aug 10 14:47:58 2021)

    select hex2int('FFFD', 2)\g

    ‚€€€€€€ƒ
    col1
    †€€€€€€‡
    -3
    „€€€€€€…
    (1 row)

    select hex2int('garbage', 8)\g
    Executing . . .

    E_OME001 hex2int(): Non hex character 'g' found in string.
    (Wed Aug 11 14:08:29 2021)

    So the questions are:

    1. Can anyone do this in simple SQL? If so, how?

    2. Could people have a quick look over the C code and give me some feedback please. I'm not a C coder and after compiling with no errors I'm not too sure what more I have to do.

    Thanks,

    Marty

    --_000_d2347ae620c54abaab28ed80772a8763ndphoxacuk_
    Content-Type: text/html; charset="koi8-r"
    Content-Transfer-Encoding: quoted-printable
    X-WatchGuard-AntiVirus: part scanned. clean action=allow

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=koi8-r">
    <meta name="Generator" content="Microsoft Word 15 (filtered medium)"> <style><!--
    /* Font Definitions */
    @font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
    @font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
    @font-face
    {font-family:"Lucida Console";
    panose-1:2 11 6 9 4 5 4 2 2 4;}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0cm;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    a:link, span.MsoHyperlink
    {mso-style-priority:99;
    color:#0563C1;
    text-decoration:underline;}
    a:visited, span.MsoHyperlinkFollowed
    {mso-style-priority:99;
    color:#954F72;
    text-decoration:underline;}
    p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
    {mso-style-priority:34;
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:0cm;
    margin-left:36.0pt;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    span.EmailStyle17
    {mso-style-type:personal-compose;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
    .MsoChpDefault
    {mso-style-type:export-only;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    @page WordSection1
    {size:612.0pt 792.0pt;
    margin:72.0pt 72.0pt 72.0pt 72.0pt;}
    div.WordSection1
    {page:WordSection1;}
    /* List Definitions */
    @list l0
    {mso-list-id:789326651;
    mso-list-type:hybrid;
    mso-list-template-ids:1713395334 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
    @list l0:level1
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l0:level2
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l0:level3
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l0:level4
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l0:level5
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l0:level6
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l0:level7
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l0:level8
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l0:level9
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    ol
    {margin-bottom:0cm;}
    ul
    {margin-bottom:0cm;}
    </style><!--[if gte mso 9]><xml>
    <o:shapedefaults v:ext="edit" spidmax="1026" />
    </xml><![endif]--><!--[if gte mso 9]><xml>
    <o:shapelayout v:ext="edit">
    <o:idmap v:ext="edit" data="1" />
    </o:shapelayout></xml><![endif]-->
    </head>
    <body lang="EN-GB" link="#0563C1" vlink="#954F72">
    <div class="WordSection1">
    <p class="MsoNormal">Hi All,<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">There has got to be an easier&nbsp; way&#8230;.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Given a string which represents a hex value, convert it to an integer of a given size.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">The only solution I&#8217;ve come up with is by making an OME function. See attached.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Here is how I would describe that function&#8230;<o:p></o:p></p>
    <p class="MsoNormal">hex2int(hexString, integerSize)<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">Convert the indicated hex string into a signed integer of the given size. Case is ignored.<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">Two&#8217;s complement is respected and hence when converting to integer1 the string &#8216;FF&#8217; becomes -1. However the same string converted to integer2 becomes 255.<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">The hex string may be prefixed with &#8216;0x&#8217;, &#8216;&#43;0x&#8217;, or &#8216;-0x&#8217;. But in the case of &#8216;-0x&#8217; there is the possibility of a double negative if the string converts
    to a negative integer.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">And here is some sample output&#8230;<o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('FFFD', 8)\g<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">‚€€€€€€€€€€€€€€€€€€€€€€ƒ<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">col1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">†€€€€€€€€€€€€€€€€€€€€€€‡<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 65533<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">„€€€€€€€€€€€€€€€€€€€€€€…<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(1 row)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('FFFD', 22)\g<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">E_OME001 hex2int(): Invalid size '22' specified. It must be one of 1, 2,<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; 4, 8<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; (Tue Aug 10 14:47:58 2021)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('FFFD', 2)\g<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">‚€€€€€€ƒ<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">col1&nbsp; <o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">†€€€€€€‡<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; -3<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">„€€€€€€…<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(1 row)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('garbage', 8)\g<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;"><o:p>&nbsp;</o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">E_OME001 hex2int(): Non hex character 'g' found in string.<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; (Wed Aug 11 14:08:29 2021)<o:p></o:p></span></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">So the questions are:<o:p></o:p></p>
    <p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">1.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </span></span><![endif]>Can anyone do this in simple SQL? If so, how?<o:p></o:p></p>
    <p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><![if !supportLists]><span style="mso-list:Ignore">2.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </span></span><![endif]>Could people have a quick look over the C code and give me some feedback please. I&#8217;m not a C coder and after compiling with no errors I&#8217;m not too sure what more I have to do.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Thanks,<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Marty<o:p></o:p></p>
    </div>
    </body>
    </html>

    --_000_d2347ae620c54abaab28ed80772a8763ndphoxacuk_--

    I2lmbmRlZiBJTkNMVURFX1VEVAojaW5jbHVkZSAidWR0LmgiCiNlbmRpZgoKZXh0ZXJuIElJX1NU QVRVUyAgICgqSW5ncmVzX3RyYWNlX2Z1bmN0aW9uKSgpOwoKZXh0ZXJuIElJX0xPX0hBTkRMRVIg ICAqdXNjX2xvX2hhbmRsZXI7CgojZGVmaW5lIE1BWF9IRVhfU1RSSU5HX0xFTkdUSCAgICAxOSAv KiA4IHggMiBjaGFyICsgbGVhZGluZyAnKzB4JywgJy0weCcgKi8KCiNkZWZpbmUgSEVYMklOVF9E RUZBVUxUX1NJWkUgICAgICA0IC8qIGllLiBpbnRlZ2VyNCAqLwoKSUlfU1RBVFVTCmhleDJpbnQo CiAgICBJSV9TQ0IgICAgICAgICAgKnNjYiwgCiAgICBJSV9EQVRBX1ZBTFVFICAgKmhleFN0cmlu ZywKICAgIElJX0RBVEFfVkFMVUUgICAqc2l6ZSwgLyogdGFyZ2V0IGludGVnZXIgc2l6ZSAqLwog ICAgSUlfREFUQV9WQUxVRSAgICpyZHYKICAgICkKewogICAgLyogU3VuZHJ5IEluaXQuICovCiAg ICBjaGFyICAgICAgICAgICAgICAgIGlucHV0WyBNQVhfSEVYX1NUUklOR19MRU5HVEggKyAxIF07 CiAgICBjaGFyICAgICAgICAgICAgICAgICplbmRwdHIsICpzdHIgPSBpbnB1dDsKICAgIGNoYXIg ICAgICAgICAgICAgICAgbXNnWzI1Nl07IC8qIFVzZWQgZm9yIGVycm9yIHByb2Nlc3NpbmcgKi8K ICAgIHVuc2lnbmVkIGxvbmcgICAgICAgdmFsID0gMDsKICAgIHVuc2lnbmVkIGxvbmcgbG9uZyAg bGx2YWwgPSAwOwogICAgbG9uZyBsb25nICAgICAgICAgICBteVNpemUgPSAwOwogICAgbG9uZyBs b25nICAgICAgICAgICBtYXhJbnQ4ID0gOTIyMzM3MjAzNjg1NDc3NTgwNzsKICAgIGxvbmcgICAg ICAgICAgICAgICAgcHJlZml4TGVuZ3RoID0gMCwgaXNOZWdhdGl2ZSA9IDA7OwogICAgc2hvcnQg ICAgICAgICAgICAgICB0cnVlTGVuZ3RoID0gMDsKCiAgICAvKiBTZXQgdGhlIGNvbnZlcnNpb24g dGFyZ2V0IHNpemUgKi8KICAgIHN3aXRjaCAoc2l6ZS0+ZGJfbGVuZ3RoKQogICAgewogICAgY2Fz ZSAxOgogICAgICAgIG15U2l6ZSA9ICoodW5zaWduZWQgY2hhciAqKXNpemUtPmRiX2RhdGE7CiAg ICAgICAgYnJlYWs7CiAgICBjYXNlIDI6CiAgICAgICAgbXlTaXplID0gKihzaG9ydCAqKXNpemUt PmRiX2RhdGE7CiAgICAgICAgYnJlYWs7CiAgICBjYXNlIDQ6CiAgICAgICAgbXlTaXplID0gKihs b25nICopc2l6ZS0+ZGJfZGF0YTsKICAgICAgICBicmVhazsKICAgIGNhc2UgODoKICAgICAgICBt eVNpemUgPSAqKGxvbmcgbG9uZyAqKXNpemUtPmRiX2RhdGE7CiAgICB9OwoKI2lmZGVmIHhERUJV RwogICAgc3ByaW50Zihtc2csICJoZXgyaW50KCk6IHNldCB0YXJnZXQgc2l6ZSAlZFxuIiwgbXlT aXpl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hERUJVRwogICAgc3ByaW50Zihtc2csICJo ZXgyaW50KCk6IFByb2Nlc3MgaW5wdXQgaGV4U3RyaW5nICclcycgZm9yIGludGVnZXIlZFxuIiwK ICAgICAgICBzdHIsIG15U2l6ZQogICAgKTsKICAgICgqSW5ncmVzX3RyYWNlX2Z1bmN0aW9uKShJ SV9UUkFDRV9GRV9NQVNLLCBzdHJsZW4obXNnKSwgbXNnKTsKI2VuZGlmCgogICAgaWYgKCEgc3Ry bmNtcChzdHIsICItIiwgMSkpIGlzTmVnYXRpdmUgPSAxOwogICAgaWYgKCEgc3RybmNtcChzdHIs ICIweCIsIDIpIHx8ICEgc3RybmNtcChzdHIsICIwWCIsIDIpKQogICAgewogICAgICAgIHByZWZp eExlbmd0aCA9IDI7CiAgICB9CiAgICBlbHNlIGlmICghIHN0cm5jbXAoc3RyLCAiKzB4IiwgMykg fHwgISBzdHJuY21wKHN0ciwgIiswWCIsIDMpCiAgICAgICAgICB8fCAhIHN0cm5jbXAoc3RyLCAi LTB4IiwgMykgfHwgISBzdHJuY21wKHN0ciwgIi0wWCIsIDMpKQogICAgewogICAgICAgIHByZWZp eExlbmd0aCA9IDM7CiAgICB9OwoKICAgIC8qIENvbmZpcm0gdGFyZ2V0IHNpemUgYW5kIGhleFN0 cmluZyBsZW5ndGggbWF0Y2ggKi8KICAgIGlmICh0cnVlTGVuZ3RoID4gKG15U2l6ZSAqIDIpICsg cHJlZml4TGVuZ3RoKQogICAgewogICAgICAgIHNwcmludGYobXNnLAogICAgICAgICAgICAiaGV4 MmludCgpOiBjaGFyYWN0ZXIgc3RyaW5nIGlzIHRvbyBsb25nIGZvciBjb252ZXJzaW9uIGludG8g aW50ZWdlciVkLiIsCiAgICAgICAgICAgIG15U2l6ZQogICAgICAgICk7CiAgICAgICAgdXNfZXJy b3Ioc2NiLCAweDIwMDAxNCwgbXNnKTsKICAgICAgICByZXR1cm4oSUlfRVJST1IpOwogICAgfTsK CiAgICAvKiBJbml0IG91dHB1dC4gKi8KICAgIHJkdi0+ZGJfcHJlYyAgICAgICAgICAgID0gMDsg LyogU2V0IG91dHB1dCBwcmVjaXNpb24gKi8KICAgICoobG9uZyAqKShyZHYtPmRiX2RhdGEpID0g MDsgLyogU2V0IGEgbm8gbWF0Y2ggZGVmYXVsdCAqLwoKICAgIC8qIERvIGNvbnZlcnNpb24gdXNp bmcgQyBzdGFuZGFyZCB1dGlsaXRpZXMuCiAgICAqKiBUaGUgcHJlZml4IGlzIGlnbm9yZWQgdG8g YXZvaWQgYW55IGNvbmZ1c2lvbiBhYm91dCB0aGUgbWVhbmluZyBvZiAtMHguCiAgICAqLwogICAg ZXJybm8gPSAwOwogICAgaWYgKG15U2l6ZSA8PSA0KQogICAgewogICAgICAgIHZhbCAgICA9IHN0 cnRvdWwoKGNoYXIgKikoc3RyICsgcHJlZml4TGVuZ3RoKSwgJmVuZHB0ciwgMTYpOwogICAgfQog ICAgZWxzZQogICAgewogICAgICAgIGxsdmFsICA9IHN0cnRvdWxsKChjaGFyICopKHN0ciArIHBy ZWZpeExlbmd0aCksICZlbmRwdHIsIDE2KTsKICAgIH07CgogICAgaWYgKGVycm5vICE9IDApCiAg ICB7CiAgICAgICAgc3dpdGNoIChlcnJubykKICAgICAgICB7CiAgICAgICAgY2FzZSBFSU5WQUw6 CiAgICAgICAgICAgIHVzX2Vycm9yKHNjYiwgIDB4MjAwMDE1LCAiaGV4MmludCgpOiBubyBjb252 ZXJzaW9uIHBlcmZvcm1lZCIpOwogICAgICAgICAgICBicmVhazsKICAgICAgICBjYXNlIEVSQU5H RToKICAgICAgICAgICAgcHJpbnRmKCJFcnJvcjogTnVtZXJpYyBPdmVyZmxvdyBoYXMgb2NjdXJy ZWQuXG4iKTsKICAgICAgICAgICAgdXNfZXJyb3Ioc2NiLCAgMHgyMDAwMTYsICJoZXgyaW50KCk6 IE51bWVyaWMgT3ZlcmZsb3cgaGFzIG9jY3VycmVkLiIpOwogICAgICAgICAgICBicmVhazsKCiAg ICAgICAgZGVmYXVsdDoKICAgICAgICAgICAgc3ByaW50Zihtc2csICJoZXgyaW50KCk6IFVuZXhw ZWN0ZWQgZXJyb3IgJWQgZW5jb3VudGVyZWQuIiwgZXJybm8pOwogICAgICAgICAgICB1c19lcnJv cihzY2IsICAweDIwMDAxNywgbXNnKTsKICAgICAgICB9OwoKICAgICAgICByZXR1cm4gKElJX0VS Uk9SKTsKICAgIH07CgogICAgLyogc3ByaW50ZiBjYWxsIHN1Y2NlZWRlZCwgYnV0IHdlcmUgYWxs IGNoYXJhY3RlcnMgdXNlZD8gKi8KICAgIGlmICgqZW5kcHRyICE9ICdcMCcpCiAgICB7CiAgICAg ICAgc3ByaW50Zihtc2csCiAgICAgICAgICAgICJoZXgyaW50KCk6IE5vbiBoZXggY2hhcmFjdGVy ICclYycgZm91bmQgaW4gc3RyaW5nLiIsCiAgICAgICAgICAgICplbmRwdHIKICAgICAgICApOwog ICAgICAgIHVzX2Vycm9yKHNjYiwgMHgyMDAwMjAsIG1zZyk7CiAgICAgICAgcmV0dXJuIChJSV9F UlJPUik7CiAgICB9OwoKICAgIGlmIChlbmRwdHIgPT0gc3RyKQogICAgewogICAgICAgIHVzX2Vy cm9yKHNjYiwgMHgyMDAwMjEsICJoZXgyaW50KCk6IE5vIGNvbnZlcnRhYmxlIGNoYXJhY3RlcnMg aW4gaW5wdXQgc3RyaW5nIik7CiAgICAgICAgcmV0dXJuIChJSV9FUlJPUik7CiAgICB9OwoKICAg IC8qIExvb2tzIEdvb2QhCiAgICAqKiBBZGp1c3QgZm9yIG5lZ2F0aXZlIG51bWJlcnMuCiAgICAq LwojaWZkZWYgeERFQlVHCiAgICBzcHJpbnRmKG1zZywgImhleDJpbnQoKTogTG9va3MgT0suIHZh bCA9ICVsZCwgbGx2YWwgPSAlbGxkXG4iLCB2YWwsIGxsdmFsKTsKICAgICgqSW5ncmVzX3RyYWNl X2Z1bmN0aW9uKShJSV9UUkFDRV9GRV9NQVNLLCBzdHJsZW4obXNnKSwgbXNnKTsKI2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7CiAgICB9OwoKICAgIHJldHVybiAoSUlfT0spOwp9 OyAvKmhleDJpbnQoKSovCgovKiBoZXgyaW50X2xzKCkKKiogICAgVGhpcyBpcyB0aGUgbGVuc3Bl YyByb3V0aW5lIHVzZWQgYnkgaGV4MmludCgpLgoqLwpJSV9TVEFUVVMKaGV4MmludF9scygKICAg IElJX1NDQiAgICAgICAgICAqc2NiLCAKICAgIElJX0RUX0lEICAgICAgICAqb3BpZCwKICAgIElJ X0RBVEFfVkFMVUUgICAqaGV4U3RyaW5nLCAvKiBoZXhTdHJpbmcgKi8KICAgIElJX0RBVEFfVkFM VUUgICAqc2l6ZSwgICAgICAvKiB0YXJnZXQgaW50ZWdlciBzaXplICovCiAgICBJSV9EQVRBX1ZB TFVFICAgKnJkdgopCnsKICAgIGNoYXIgbXNnIFsgMjU2IF07CiAgICBsb25nIGxvbmcgbXlTaXpl ID0gMDsKCiAgICBzd2l0Y2ggKHNpemUtPmRiX2xlbmd0aCkKICAgIHsKICAgIGNhc2UgMToKICAg ICAgICBteVNpemUgPSAqKHVuc2lnbmVkIGNoYXIgKilzaXplLT5kYl9kYXRhOwogICAgICAgIGJy ZWFrOwogICAgY2FzZSAyOgogICAgICAgIG15U2l6ZSA9ICooc2hvcnQgKilzaXplLT5kYl9kYXRh OwogICAgICAgIGJyZWFrOwogICAgY2FzZSA0OgogICAgICAgIG15U2l6ZSA9ICoobG9uZyAqKXNp emUtPmRiX2RhdGE7CiAgICAgICAgYnJlYWs7CiAgICBjYXNlIDg6CiAgICAgICAgbXlTaXplID0g Kihsb25nIGxvbmcgKilzaXplLT5kYl9kYXRhOwogICAgICAgIGJyZWFrOwogICAgZGVmYXVsdDoK ICAgICAgICAvKiBUaGlzIHNob2xkIG5ldmVyIG9jY3VyLCBidXQgSSdsbCBsZWF2ZSBpdCBpbi4u LiAqLwogICAgICAgIG15U2l6ZSA9IEhFWDJJTlRfREVGQVVMVF9TSVpFOwogICAgfTsKCiAgICBz d2l0Y2ggKG15U2l6ZSkKICAgIHsKICAgIGNhc2UgMToKICAgIGNhc2UgMjoKICAgIGNhc2UgNDoK ICAgIGNhc2UgODoKICAgICAgICByZHYtPmRiX2xlbmd0aCA9IG15U2l6ZTsKICAgICAgICBicmVh azsKICAgIGRlZmF1bHQ6CiAgICAgICAgLyogQW4gZXJyb3Igd2lsbCBiZSBnZW5lcmF0ZWQgaW4g dGhlIG1haW4gcm91dGluZS4KICAgICAgICAqKiBUaGUgbGVuc3BlYyBjYW4ganVzdCBzZXQgYSBk ZWZhdWx0IGF0IHRoaXMgcG9pbnQuICovCiAgICAgICAgcmR2LT5kYl9sZW5ndGggPSBIRVgySU5U X0RFRkFVTFRfU0laRTsKICAgIH07CgojaWZkZWYgeERFQlVHCiAgICBzcHJpbnRmKG1zZywgImhl eDJpbnRfbHMoKSBIYXZlIFNldCBTaXplICVkXG4iLCByZHYtPmRiX2xlbmd0aCk7CiAgICAoKklu Z3Jlc190cmFjZV9mdW5jdGlvbikoSUlfVFJBQ0VfRkVfTUFTSywgc3RybGVuKG1zZyksIG1zZyk7 CiNlbmRpZgogICAgcmV0dXJuIChJSV9PSyk7Cn07IC8qIGhleDJpbnRfbHMoKSAqLwo=

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Martin Bowes@21:1/5 to Adrian Williamson on Wed Aug 11 14:28:03 2021
    To: roy.hann@rationalcommerce.com (roy.hann@rationalcommerce.com)
    Copy: info-ingres@lists.planetingres.org (info-ingres@lists.planetingres.org)

    SGkgQWRyaWFuLA0KDQpJIGxpa2UgdGhlIHN1Z2dlc3Rpb24gb24gc2hpcCBhbmQgYWxsb3cgdGhl IHVzZXJzIHRvIGRlYnVnLg0KDQpUaGUgbmV3ICgxMS4yKSBVREZzIGF2YWlsYWJsZSB3aXRoIENS RUFURSBGVU5DVElPTiBhcmUgc3dlZXQgYnV0IHZlcnkgbGltaXRlZCBjb21wYXJlZCB0byBPTUUg ZnVuY3Rpb25zLiBTcGVjaWZp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lIHRvIGRvLg0KDQpUaGFua3MsDQoNCk1hcnR5DQo=

    <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ks_c_5601-1987"> <meta name="Generator" content="Microsoft Word 15 (filtered medium)"> <style><!--
    /* Font Definitions */
    @font-face
    {font-family:Wingdings;
    panose-1:5 0 0 0 0 0 0 0 0 0;}
    @font-face
    {font-family:"Cambria Math";
    panose-1:2 4 5 3 5 4 6 3 2 4;}
    @font-face
    {font-family:Calibri;
    panose-1:2 15 5 2 2 2 4 3 2 4;}
    @font-face
    {font-family:"Lucida Console";
    panose-1:2 11 6 9 4 5 4 2 2 4;}
    @font-face
    {font-family:"MS PGothic";
    panose-1:2 11 6 0 7 2 5 8 2 4;}
    @font-face
    {font-family:"\@MS PGothic";}
    /* Style Definitions */
    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin:0cm;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    a:link, span.MsoHyperlink
    {mso-style-priority:99;
    color:#0563C1;
    text-decoration:underline;}
    a:visited, span.MsoHyperlinkFollowed
    {mso-style-priority:99;
    color:#954F72;
    text-decoration:underline;}
    p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
    {mso-style-priority:34;
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:0cm;
    margin-left:36.0pt;
    margin-bottom:.0001pt;
    font-size:11.0pt;
    font-family:"Calibri",sans-serif;
    mso-fareast-language:EN-US;}
    p.msonormal0, li.msonormal0, div.msonormal0
    {mso-style-name:msonormal;
    mso-margin-top-alt:auto;
    margin-right:0cm;
    mso-margin-bottom-alt:auto;
    margin-left:0cm;
    font-size:12.0pt;
    font-family:"MS PGothic",sans-serif;
    mso-fareast-language:JA;}
    span.EmailStyle19
    {mso-style-type:personal;
    font-family:"Calibri",sans-serif;
    color:windowtext;}
    span.EmailStyle20
    {mso-style-type:personal-reply;
    font-family:"Calibri",sans-serif;
    color:#1F497D;}
    .MsoChpDefault
    {mso-style-type:export-only;
    font-size:10.0pt;}
    @page WordSection1
    {size:612.0pt 792.0pt;
    margin:72.0pt 72.0pt 72.0pt 72.0pt;}
    div.WordSection1
    {page:WordSection1;}
    /* List Definitions */
    @list l0
    {mso-list-id:12995188;
    mso-list-template-ids:-219743948;}
    @list l1
    {mso-list-id:323358009;
    mso-list-type:hybrid;
    mso-list-template-ids:774530532 -1587132232 134807555 134807557 134807553 134807555 134807557 134807553 134807555 134807557;}
    @list l1:level1
    {mso-level-start-at:0;
    mso-level-number-format:bullet;
    mso-level-text:\F0D8;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:Wingdings;
    mso-fareast-font-family:Calibri;
    mso-bidi-font-family:"Times New Roman";}
    @list l1:level2
    {mso-level-number-format:bullet;
    mso-level-text:o;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:"Courier New";}
    @list l1:level3
    {mso-level-number-format:bullet;
    mso-level-text:\F0A7;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:Wingdings;}
    @list l1:level4
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:Symbol;}
    @list l1:level5
    {mso-level-number-format:bullet;
    mso-level-text:o;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:"Courier New";}
    @list l1:level6
    {mso-level-number-format:bullet;
    mso-level-text:\F0A7;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:Wingdings;}
    @list l1:level7
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:Symbol;}
    @list l1:level8
    {mso-level-number-format:bullet;
    mso-level-text:o;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:"Courier New";}
    @list l1:level9
    {mso-level-number-format:bullet;
    mso-level-text:\F0A7;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    font-family:Wingdings;}
    @list l2
    {mso-list-id:698435727;
    mso-list-type:hybrid;
    mso-list-template-ids:-261824872 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
    @list l2:level1
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l2:level2
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l2:level3
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l2:level4
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l2:level5
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l2:level6
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l2:level7
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l2:level8
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l2:level9
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l3
    {mso-list-id:789326651;
    mso-list-type:hybrid;
    mso-list-template-ids:1713395334 134807567 134807577 134807579 134807567 134807577 134807579 134807567 134807577 134807579;}
    @list l3:level1
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l3:level2
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l3:level3
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l3:level4
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l3:level5
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l3:level6
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l3:level7
    {mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l3:level8
    {mso-level-number-format:alpha-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:left;
    text-indent:-18.0pt;}
    @list l3:level9
    {mso-level-number-format:roman-lower;
    mso-level-tab-stop:none;
    mso-level-number-position:right;
    text-indent:-9.0pt;}
    @list l4
    {mso-list-id:1791703911;
    mso-list-template-ids:1627295570;}
    @list l4:level1
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:36.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level2
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:72.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level3
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:108.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level4
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:144.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level5
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:180.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level6
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:216.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level7
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:252.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level8
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:288.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    @list l4:level9
    {mso-level-number-format:bullet;
    mso-level-text:\F0B7;
    mso-level-tab-stop:324.0pt;
    mso-level-number-position:left;
    text-indent:-18.0pt;
    mso-ansi-font-size:10.0pt;
    font-family:Symbol;}
    ol
    {margin-bottom:0cm;}
    ul
    {margin-bottom:0cm;}
    </style><!--[if gte mso 9]><xml>
    <o:shapedefaults v:ext="edit" spidmax="1026" />
    </xml><![endif]--><!--[if gte mso 9]><xml>
    <o:shapelayout v:ext="edit">
    <o:idmap v:ext="edit" data="1" />
    </o:shapelayout></xml><![endif]-->
    </head>
    <body lang="EN-GB" link="#0563C1" vlink="#954F72">
    <div class="WordSection1">
    <p class="MsoNormal"><span style="color:#1F497D">Hi Adrian,<o:p></o:p></span></p>
    <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span style="color:#1F497D">I like the suggestion on ship and allow the users to debug.<o:p></o:p></span></p>
    <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span style="color:#1F497D">The new (11.2) UDFs available with CREATE FUNCTION are sweet but very limited compared to OME functions. Specifically:<o:p></o:p></span></p>
    <p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l2 level1 lfo7"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">1.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </span></span></span><![endif]><span style="color:#1F497D">They cannot use C, javaScript, Perl.<o:p></o:p></span></p>
    <p class="MsoNormal" style="margin-left:36.0pt"><span style="color:#1F497D">I¡¯ve asked for Perl and C to be included in any future development.<o:p></o:p></span></p>
    <p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l2 level1 lfo7"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">2.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </span></span></span><![endif]><span style="color:#1F497D">They are not installation wide.<o:p></o:p></span></p>
    <p class="MsoListParagraph"><span style="color:#1F497D">They are only available to the database in which they are defined.<o:p></o:p></span></p>
    <p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l2 level1 lfo7"><![if !supportLists]><span style="color:#1F497D"><span style="mso-list:Ignore">3.<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    </span></span></span><![endif]><span style="color:#1F497D">Furthermore, they are not available to all users, only the user who created them.<o:p></o:p></span></p>
    <p class="MsoListParagraph"><span style="color:#1F497D">There is no grant execute on function statement available.<o:p></o:p></span></p>
    <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span style="color:#1F497D">Where the new UDFs come into their own is for little things.<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="color:#1F497D">Eg. </span>
    <span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">cat hyperbolic.sql<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">\r<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">set autocommit on;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">\p\g<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">CREATE OR REPLACE FUNCTION cosh(x FLOAT8)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">RETURN(FLOAT8) AS<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">BEGIN<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">&nbsp;&nbsp;&nbsp; RETURN (EXP(x) &#43; EXP(-x)) / 2;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">END;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">\p\g<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">CREATE OR REPLACE FUNCTION sinh(x FLOAT8)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">RETURN(FLOAT8) AS<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">BEGIN<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">&nbsp;&nbsp;&nbsp; RETURN (EXP(x) - EXP(-x)) / 2;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">END;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">\p\g<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">CREATE OR REPLACE FUNCTION tanh(x FLOAT8)<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">RETURN(FLOAT8) AS<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">BEGIN<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">&nbsp;&nbsp;&nbsp; RETURN sinh(x) / cosh(x);<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">END;<o:p></o:p></span></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;;mso-fareast-language:EN-GB">\p\g<o:p></o:p></span></p>
    <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span style="color:#1F497D">Marty<o:p></o:p></span></p>
    <p class="MsoNormal"><span style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <div>
    <div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
    <p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:JA">From:</span></b><span lang="EN-US" style="mso-fareast-language:JA"> Adrian Williamson &lt;adrian.williamson@rationalcommerce.com&gt;

    <b>Sent:</b> 11 August 2021 15:11<br>
    <b>To:</b> Martin Bowes &lt;martin.bowes@ndph.ox.ac.uk&gt;; roy.hann@rationalcommerce.com<br>
    <b>Subject:</b> RE: [Info-ingres] Convert hex string to an integer<o:p></o:p></span></p>
    </div>
    </div>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal"><a href="https://docs.actian.com/actianx/11.2/index.html#page/RelSum%2FScalar_User-defined_Functions_(UDFs).htm%23wwconnect_header">https://docs.actian.com/actianx/11.2/index.html#page/RelSum%2FScalar_User-defined_Functions_(UDFs).
    htm%23wwconnect_header</a><o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">UDF not OME¡¦<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <div>
    <div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
    <p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-GB"> Adrian Williamson &lt;<a href="mailto:adrian.williamson@rationalcommerce.com">adrian.williamson@
    rationalcommerce.com</a>&gt;

    <b>Sent:</b> 11 August 2021 15:07<br>
    <b>To:</b> 'Martin Bowes' &lt;<a href="mailto:martin.bowes@ndph.ox.ac.uk">martin.bowes@ndph.ox.ac.uk</a>&gt;; 'roy.hann@rationalcommerce.com' &lt;<a href="mailto:roy.hann@rationalcommerce.com">roy.hann@rationalcommerce.com</a>&gt;<br>
    <b>Subject:</b> RE: [Info-ingres] Convert hex string to an integer<o:p></o:p></span></p>
    </div>
    </div>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt;text-indent:-18.0pt;mso-list:l1 level1 lfo3">
    <![if !supportLists]><span style="font-family:Wingdings"><span style="mso-list:Ignore">¨ª<span style="font:7.0pt &quot;Times New Roman&quot;">&nbsp;
    </span></span></span><![endif]>after compiling with no errors I¡¯m not too sure what more I have to do.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Ship it and let the customers find the bugs?<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Te He.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Good work Marty.<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Did I read somewhere you can extend Ingres using Perl or Java or basically something else other than ¡®C¡¯?<o:p></o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <div>
    <div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
    <p class="MsoNormal"><b><span lang="EN-US" style="mso-fareast-language:EN-GB">From:</span></b><span lang="EN-US" style="mso-fareast-language:EN-GB">
    <a href="mailto:info-ingres-bounces@lists.planetingres.org">info-ingres-bounces@lists.planetingres.org</a> &lt;<a href="mailto:info-ingres-bounces@lists.planetingres.org">info-ingres-bounces@lists.planetingres.org</a>&gt;
    <b>On Behalf Of </b>Martin Bowes<br>
    <b>Sent:</b> 11 August 2021 14:21<br>
    <b>To:</b> <a href="mailto:info-ingres@lists.planetingres.org">info-ingres@lists.planetingres.org</a><br>
    <b>Subject:</b> [Info-ingres] Convert hex string to an integer<o:p></o:p></span></p>
    </div>
    </div>
    <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
    <p class="MsoNormal">Hi All,<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">There has got to be an easier&nbsp; way¡¦.<o:p></o:p></p> <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">Given a string which represents a hex value, convert it to an integer of a given size.<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">The only solution I¡¯ve come up with is by making an OME function. See attached.<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">Here is how I would describe that function¡¦<o:p></o:p></p>
    <p class="MsoNormal">hex2int(hexString, integerSize)<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">Convert the indicated hex string into a signed integer of the given size. Case is ignored.<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">Two¡¯s complement is respected and hence when converting to integer1 the string ¡®FF¡¯ becomes -1. However the same string converted to integer2 becomes 255.<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal" style="margin-left:36.0pt">The hex string may be prefixed with ¡®0x¡¯, ¡®&#43;0x¡¯, or ¡®-0x¡¯. But in the case of ¡®-0x¡¯ there is the possibility of a double negative if the string converts to a negative integer.<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">And here is some sample output¡¦<o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('FFFD', 8)\g</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦£¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¤</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦¢col1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ¦¢</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦§¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦©</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦¢&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 65533¦¢</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦¦¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¡¦¥</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(1 row)</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('FFFD', 22)\g</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">E_OME001 hex2int(): Invalid size '22' specified. It must be one of 1, 2,</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; 4, 8</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; (Tue Aug 10 14:47:58 2021)</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('FFFD', 2)\g</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦£¦¡¦¡¦¡¦¡¦¡¦¡¦¤</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦¢col1&nbsp; ¦¢</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦§¦¡¦¡¦¡¦¡¦¡¦¡¦©</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦¢&nbsp;&nbsp;&nbsp; -3¦¢</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">¦¦¦¡¦¡¦¡¦¡¦¡¦¡¦¥</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">(1 row)</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">select hex2int('garbage', 8)\g</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">Executing . . .</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">E_OME001 hex2int(): Non hex character 'g' found in string.</span><o:p></o:p></p>
    <p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:&quot;Lucida Console&quot;">&nbsp;&nbsp;&nbsp; (Wed Aug 11 14:08:29 2021)</span><o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">So the questions are:<o:p></o:p></p>
    <ol style="margin-top:0cm" start="1" type="1">
    <li class="MsoNormal" style="mso-list:l3 level1 lfo6">Can anyone do this in simple SQL? If so, how?<o:p></o:p></li><li class="MsoNormal" style="mso-list:l3 level1 lfo6">Could people have a quick look over the C code and give me some feedback please. I¡¯m
    not a C coder and after compiling with no errors I¡¯m not too sure what more I have to do.<o:p></o:p></li></ol>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">Thanks,<o:p></o:p></p>
    <p class="MsoNormal">&nbsp;<o:p></o:p></p>
    <p class="MsoNormal">Marty<o:p></o:p></p>
    </div>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)