php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13654 Truncated "text" content returned by next_record( )
Submitted: 2001-10-12 10:32 UTC Modified: 2002-05-21 23:06 UTC
From: dennist at k2ia dot com Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.6 OS: W2K Advanced Server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dennist at k2ia dot com
New email:
PHP Version: OS:

 

 [2001-10-12 10:32 UTC] dennist at k2ia dot com
I use PHPLIB-7.2d and use the db_odbc.inc to connect to an ODBC compliant database (MSSQLServer 7.0), I observed that when a query is performed to retrieve information for a "text" type of field, the data gets truncated at a certain point.

But when the same data is inserted into the database manually using the native DB Server application tools like T-SQL, the data is saved in the database.

When i inspected the code that performs the insertion, it uses the following piece:

 function next_record() {
    $this->Record = array();
    $stat      = odbc_fetch_into($this->Query_ID, ++$this->Row, &$this->Record);
    if (!$stat) {
      if ($this->Auto_Free) {
	    odbc_free_result($this->Query_ID);
        $this->Query_ID = 0;
	  };
    } else {
      // add to Record[<key>]
      $count = odbc_num_fields($this->Query_ID);
      for ($i=1; $i<=$count; $i++)
        $this->Record[strtolower(odbc_field_name ($this->Query_ID, $i)) ] = $this->Record[ $i - 1 ];
    }
    return $stat;
  }


Apparently the active function used to retrieve the data is odbc_fetch_into()

The following is the sample text i inserted using the 
$db->query() method just in case you want to test it...

-----------------------------------------
<b>We give you basic investment information to help you make the choices to attain financial independence.<br><br>
</b><b>WHEN TO BUY:</b><br>When to buy is probably the toughest decision an investor has 
                  to make. Investors try so hard to gather as much information 
                  as possible and then carefully consolidate them into an investment 
                  decision. But it may still turn out to be a wrong decision because 
                  many studies have shown that short-term security price movement 
                  is random rather than predictable. However, this does not mean 
                  that being lucky is the only way to succeed. A systematic way 
                  of making investment can minimize the effect of short-term market 
                  fluctuation.
<p>
<p>
<b>THE POWER OF REGULAR INVESTING</b>
<br>
Dollar Cost Averaging is a long-term savings strategy based on constant buying.  The idea is to invest a fixed dollar amount on a regular basis for a long term of at least 5 to 10 years.  This way, the contributor profit from the long-term growth in market.  
<p>
When you contribute regularly, you need not worry about market timing.  In fact, you may even gain a better opportunity to make profit when the market goes down.  Should that happen, you could actually buy more units and average down your cost of investment.  
<p>
<b>When the market later recovers and historically it always does, these additional unit then transform into greater capital gain.</b>  
<p>
<p><b>THE BENEFIT OF DIVERSIFICATION</b>
<br>
Diversification is the strategy of combining a number of different investments together in a portfolio to minimize investment risk.  In simple terms, to avoid putting <b>all your eggs in one basket.</b>
<p><b>Asset Diversification</b> - Different assets react to market movements in different ways.  By holding a mixture of such assets in a portfolio, the investment risk can be reduced through this diversification.
<p>
<b>Geographical Diversification</b> -  Assets also react to market developments in different ways depending on their geographical location.  This is because economic cycles, currency valuation and industrial developments generally vary from country to country.  Thus, by investing internationally, it is possible to avoid putting all your eggs in one country basket.  
<p>
<p>
<b>THE BENEFIT OF LONG TERM INVESTMENT</b>
<br>
Investing in the stock market over the longer term can provide a greater return on your investment that putting your money on cash deposit and can provide a significant real return.  That is, the returns obtained are a good protection against the eroding effect that inflation can have on capital over the long term.  
<p>
With stock market investment, there is always an element of volatility, which can be unnerving to investors.  Even investors familiar with the concept that the value of investments can fall as well as rise, are likely to feel uncomfortable in time of market volatility.
<p>
One of the most powerful ways to help reduce market risk is to invest for the long term.  In spite of the volatility, stocks held over the longer time periods have consistently provided positive total returns.  Taking a long-term view allows your investment longer to grow and this should make up for any short-term fluctuations.  
<p>
KEY POINTS:<br>
?	Most stock market corrections become insignificant over the longer term<br>
?	Long-term investment allows short-term volatility to be smoothed out.<br>
?	Long-term investment allows your investment to provide a real return.<br> 
<p>
<p>
<b>THE BENEFIT OF TIME IN THE MARKET</b>
<br>The markets rises and falls are part of the normal stock market cycle.  It is very difficult to predict stock market movements and trying to time the market over the short term, even for professionals, is rarely effective, as market rallies and declines occur in unanticipated spurts and it can be easy to miss the gains.  
<p>
Despite the ups and downs of the market, stocks have been having such a great time and we are duplicating <b>We give you basic investment information to help you make the choices to attain financial independence.<br><br>
</b><b>WHEN TO BUY:</b><br>When to buy is probably the toughest decision an investor has 
                  to make. Investors try so hard to gather as much information 
                  as possible and then carefully consolidate them into an investment 
                  decision. But it may still turn out to be a wrong decision because 
                  many studies have shown that short-term security price movement 
                  is random rather than predictable. However, this does not mean 
                  that being lucky is the only way to succeed. A systematic way 
                  of making investment can minimize the effect of short-term market 
                  fluctuation.
<p>
<p>
<b>THE POWER OF REGULAR INVESTING</b>
<br>
Dollar Cost Averaging is a long-term savings strategy based on constant buying.  The idea is to invest a fixed dollar amount on a regular basis for a long term of at least 5 to 10 years.  This way, the contributor profit from the long-term growth in market.  
<p>
When you contribute regularly, you need not worry about market timing.  In fact, you may even gain a better opportunity to make profit when the market goes down.  Should that happen, you could actually buy more units and average down your cost of investment.  
<p>
<b>When the market later recovers and historically it always does, these additional unit then transform into greater capital gain.</b>  
<p>
<p><b>THE BENEFIT OF DIVERSIFICATION</b>
<br>
Diversification is the strategy of combining a number of different investments together in a portfolio to minimize investment risk.  In simple terms, to avoid putting <b>all your eggs in one basket.</b>
<p><b>Asset Diversification</b> - Different assets react to market movements in different ways.  By holding a mixture of such assets in a portfolio, the investment risk can be reduced through this diversification.
<p>
<b>Geographical Diversification</b> -  Assets also react to market developments in different ways depending on their geographical location.  This is because economic cycles, currency valuation and industrial developments generally vary from country to country.  Thus, by investing internationally, it is possible to avoid putting all your eggs in one country basket.  
<p>
<p>
<b>THE BENEFIT OF LONG TERM INVESTMENT</b>
<br>
Investing in the stock market over the longer term can provide a greater return on your investment that putting your money on cash deposit and can provide a significant real return.  That is, the returns obtained are a good protection against the eroding effect that inflation can have on capital over the long term.  
<p>
With stock market investment, there is always an element of volatility, which can be unnerving to investors.  Even investors familiar with the concept that the value of investments can fall as well as rise, are likely to feel uncomfortable in time of market volatility.
<p>
One of the most powerful ways to help reduce market risk is to invest for the long term.  In spite of the volatility, stocks held over the longer time periods have consistently provided positive total returns.  Taking a long-term view allows your investment longer to grow and this should make up for any short-term fluctuations.  
<p>
KEY POINTS:<br>
?	Most stock market corrections become insignificant over the longer term<br>
?	Long-term investment allows short-term volatility to be smoothed out.<br>
?	Long-term investment allows your investment to provide a real return.<br> 
<p>
<p>
<b>THE BENEFIT OF TIME IN THE MARKET</b>
<br>The markets rises and falls are part of the normal stock market cycle.  It is very difficult to predict stock market movements and trying to time the market over the short term, even for professionals, is rarely effective, as market rallies and declines occur in unanticipated spurts and it can be easy to miss the gains.  
<p>
Despite the ups and downs of the market, stocks have been having such a great time and we are duplicating LAST;

-----------------------------------------

Pardon the content but this is for a content managed site....

Any notes on a workaround or why the method does not return the complete content?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-21 23:06 UTC] kalowsky@php.net
The type TEXT is not a valid ODBC v 2 or v3 type... it is a valid version 3.5 or 3.7 type though.  Unfortunatley PHP doesn't support either of those yet.  
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 13:01:31 2024 UTC