Do you know for sure that will always be the case? It would seem easier to plan for it now and using an array than wait for a year, or five, only to realize that something changed in the design or usage of your code and now more rows are required. If it always returns one row, then looping over it with one row shouldn't cause any problems.

No, you're right, it shouldn't and it probably won't. I'm just trying to avoid unnecessary clutter by sticking things in a loop when actually just fetching a single value. And this thing has piqued my curiosity ;o)

Doing multiple executes on one prepared statement (as you wrote) works as expected. Also replacing the

print $test->fetchrow_array()

with a

while($test->fetchrow_array()) { print; }

works just fine (i.e. it allows the script to run completely) and prints exactly the same as before which leads me to believe that FreeTDS suspects there being more data to fetch.

Thanks for your input!


In reply to Re^2: FreeTDS (Linux) vs. SQLSRV32.dll (Windows) via ODBC by pvbcharon
in thread FreeTDS (Linux) vs. SQLSRV32.dll (Windows) via ODBC by pvbcharon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.