Home  >  Article  >  Backend Development  >  sql server 2000 download Solution to the TEXT field being truncated when querying SQL Server or Sybase in PHP

sql server 2000 download Solution to the TEXT field being truncated when querying SQL Server or Sybase in PHP

WBOY
WBOYOriginal
2016-07-29 08:39:28830browse

Author: Wenlong Wu
1. For MS SQL SERVER database
There are two solutions, as follows:
Modify php.ini to achieve: Open php.ini, you can see two options: mssql.textsize and mssql.textlimit:
; Valid range 0 - 2147483647. Default = 4096.
  ;mssql.textlimit = 4096
 That is, often The encountered one is truncated to 4K, change it to the appropriate size, remove the preceding semicolon, then save and restart the WEB server.
  From the above two options, we can see that the range is: 0 - 2147483647 bytes. In fact, -1 is also acceptable. Check the PHP source code and you will find that -1 means unlimited:)
if (MS_SQL_G(textlimit) != - 1) {
  sprintf(buffer, "%li", MS_SQL_G(textlimit));
  if (DBSETOPT(mssql.link, DBTEXTLIMIT, buffer)==FAIL) {
  efree(hashed_details);
  dbfreelogin(mssql.login) ; U Return_false;
}}}
if (ms_sql_g (textSize)! = -1) {
Sprintf (buffer, "Set TextSize %li", ms_sql_g (TextSize));
dbcmd (mssql. link, buffer);
dbsqlexec(mssql.link);
  dbresults(mssql.link);
  }
  Execute SET TEXTSIZE before query in PHP Right size: Just do it before SELECT
  mssql_query("SET TEXTSIZE 65536");
  PHP from above You can see in the source code that SET TEXTSIZE is actually executed:)
 Second, for the Sybase database
  Since this extension does not have options like SQL SERVER to configure in php.ini, the only way is to use the second method above, that is:
 Executed before SELECT
  sybase_query("SET TEXTSIZE 65536");
The above introduces the solution to the TEXT field being truncated when querying SQL Server or Sybase in PHP, including the content of sql server 2000 download. I hope it will be helpful to friends who are interested in PHP tutorials.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn