<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!--P{margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p><span style="font-size: 10pt;">Thanks for your prompt response Dago. I will reach out to freetds with this question.</span></p>
<p><span style="font-size: 10pt;">By the way we are using the same version in RHEL as well.<br style="">
</span></p>
<p><br>
</p>
<div id="Signature">
<div class="BodyFragment"><font size="2">
<div class="PlainText">Thanks & Regards,<br>
Krishna Upadhyay<br>
Tata Consultancy Services<br>
</div>
</font></div>
</div>
<div style="word-wrap:break-word">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" color="#000000" face="Calibri, sans-serif"><b>From:</b> users <users-bounces+kupadhay=wiley.com@lists.opencsw.org> on behalf of Dagobert Michelsen <dam@opencsw.org><br>
<b>Sent:</b> 21 October 2016 13:47<br>
<b>To:</b> Questions and discussions<br>
<b>Subject:</b> Re: Special character issue connecting Mod lua to Sybase DB using Freetds</font>
<div> </div>
</div>
<div>Hi Krishna,
<div class=""><br class="">
<div>
<div class="">Am 21.10.2016 um 09:29 schrieb Upadhay, Krishna - Kolkata <<a href="mailto:kupadhay@wiley.com" class="">kupadhay@wiley.com</a>>:</div>
<blockquote type="cite" class=""><span class="" style="font-size:10pt; font-family:Calibri,Arial,Helvetica,sans-serif; background-color:rgb(255,255,255)">We are trying to fetch data from sybase DB through mod lua (in apache 2.4.23) using the freetds(downloaded
from</span><br class="">
<div class="">
<div class="" style="margin-top:0px; margin-bottom:0px; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span class="" style="font-size:10pt"><a href="https://www.opencsw.org/package/freetds/" class="">https://www.opencsw.org/package/freetds/</a>).<br class="">
<br class="">
OS details is: Oracle Solaris 10 8/11 s10s_u10wos_17b SPARC<br class="">
<br class="">
The lua module receives a key from the http request and looks up for the corresponding value from a sybase database table.<br class="">
The problem is in this database lookup. It's only a plain select query fetching a single value of type varchar.</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span class="" style="font-size:10pt">However, some random characters get appended to the retrieved value at the end when we recieve it in the lua module.<br class="">
<br class="">
We tried to gather a pattern of data for which we encountered the issue. If the character count of the string value that is fetched from DB is exactly 2^n, the data fetched is absolutely fine. Anything greater or less than that is appended with random characters
at the end. Following are few examples:<br class="">
<br class="">
-- 9 character varchar value in DB -> 0021/2015<br class="">
-- Data received in lua code -> 0021/2015<span class="" style="color:rgb(255,0,0)">h</span><br class="">
<br class="">
-- 17 character varchar value in DB -> 0021/2015/06/18/7<br class="">
-- Data received in lua code -> 0021/2015/06/18/7<span class="" style="color:rgb(255,0,0)">\x07\xc1\xd4</span><br class="">
<br class="">
-- 33 character varchar value in DB -> 0021/2015/06/18/732/10.1002-2Fabc<br class="">
-- Data received in lua code -> 0021/2015/06/18/732/10.1002-2Fabc<span class="" style="color:rgb(255,0,0)">\x02h</span><br class="" style="color:rgb(255,0,0)">
<br class="">
-- 65 character varchar value in DB -> 0021/2015/06/18/732/10.1002-2Fab0021/2015/06/18/732/10.1002-2Fabc<br class="">
-- Data received in lua code -> 0021/2015/06/18/732/10.1002-2Fab0021/2015/06/18/732/10.1002-2FabcY<span class="" style="color:rgb(255,0,0)">\x140</span><br class="">
<br class="">
Please note the following:<br class="">
1. The issue do not happen in a RHEL system<br class="">
2. The same functionality works fine if we lookup a similar table in MySQL.</span></div>
<div class="" style="margin-top:0px; margin-bottom:0px; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<br class="">
<span class="" style="font-size:10pt"></span></div>
<div class="" style="margin-top:0px; margin-bottom:0px; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<span class="" style="font-size:10pt">Any comments regarding the cause of this issue would be really helpful.<br class="">
</span></div>
</div>
</blockquote>
<div><br class="">
</div>
<div>This doesn’t sound like a packaging issue, are you using the same version on RHEL?</div>
<div>Maybe the FreeTDS people can help.</div>
<div><br class="">
</div>
<div><br class="">
</div>
<div>Best regards</div>
<div><br class="">
</div>
<div> — Dago</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div class="" style="margin-top:0px; margin-bottom:0px; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<br class="">
</div>
<div id="Signature" class="" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; font-style:normal; font-weight:normal; letter-spacing:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px; background-color:rgb(255,255,255)">
<div class="BodyFragment"><font class="" size="2">
<div class="PlainText">Thanks & Regards,<br class="">
Krishna Upadhyay<br class="">
Tata Consultancy Services<br class="">
</div>
</font></div>
</div>
</div>
</blockquote>
</div>
<br class="">
<div class="">
<div class="" style="color:rgb(0,0,0); font-family:Helvetica; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:2; text-indent:0px; text-transform:none; white-space:normal; widows:2; word-spacing:0px; word-wrap:break-word">
<div class=""><span class="" style="font-family:monospace">-- </span><br class="" style="font-family:monospace">
<span class="" style="font-family:monospace">"You don't become great by trying to be great, you become great by wanting to do something,</span><br class="" style="font-family:monospace">
<span class="" style="font-family:monospace">and then doing it so hard that you become great in the process." - xkcd #896</span></div>
</div>
</div>
<br class="">
</div>
</div>
</div>
</body>
</html>