The solution for TEXT field truncation when SQL Server or Sybase is queried in PHP. Author: WenlongWu I. There are two solutions for MSSQLSERVER databases: modify php. ini: open php. ini, you can see mssql. textsize, mssql. textlimit two options: Author: Wenlong Wu
1. for ms SQL SERVER databases
There are two solutions:
Modify php. ini to achieve this: Open php. ini and you can see two options: mssql. textsize and mssql. textlimit:
; Valid range 0-2147483647. Default = 4096.
; Mssql. textlimit = 4096
; Valid range 0-2147483647. Default = 4096.
; Mssql. textsize = 4096
You can see that the default configuration is 4096 bytes, that is, the common request is truncated to 4 kB. change it to the appropriate size, remove the semicolon, and then save and restart the WEB server.
From the two options above, 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 indicates no limit :)
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 );
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 );
}
Run the set textsize command before querying in PHP: run the command before SELECT.
Mssql_query ("set textsize 65536 ");
From the above PHP source code, we can see that it is actually executing set textsize :)
II. for Sybase databases
Because this extension is not configurable in php. ini as in SQL SERVER, the preceding method is used only:
Run
Sybase_query ("set textsize 65536 ");
Http://www.bkjia.com/PHPjc/319932.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/319932.htmlTechArticleAuthor: Wenlong Wu I. There are two solutions for the ms SQL SERVER database: modify php. ini: open php. ini, you can see mssql. textsize, mssql. textlimit two options...