phpLens
 home  products examples manual  faq support forum  contact news  login store

Forums: phplens   adodb
Forums:   ADOdb Help & Dev:   Replies 
New ReplySearch
Topic: mssql blob field size 4096
author: shelley   created: 12-08-2002 12:11:47 PM
Can anyone tell me why my image keeps coming back with size 4096?
I have tried numerious attempts to override the sizing unsucessfully. I've supplied two code attempts to retrieve the complete image on mssql 7.0 DB. I've tried over the last few days many different combination of the code to override the max_length 4096. I've also, made all the changes to the php.ini file. I've also, downloaded the most recent ADOdb. And I have tried adding $cn->maxblobsize = 0; for a passthru which also doesn't work. I think this is why I'm only retrieving 1/2 the image.

First attempt:

header("Content-type: image/gif");
include_once("config.inc");
include_once("conn.inc");
$sku = $HTTP_GET_VARS['sku_cd'];
$sku="'".$sku."'";
$cmd5="SELECT img_image FROM flximage WHERE img_key = $sku AND img_type = 'sku'";

$rs5 = $cn->Execute($cmd5);
if (!$rs5){error_dis(21,"die","getimage.php");}
While (!$rs5->EOF){
$sku_image=$rs5->fields("img_image");
$rs5->MoveNext();
}
print ($sku_image);
// release resources
$cmd5='';
$rs5->close();
$cn->close();
?>

second attempt:

header("Content-type: image/gif");
include_once("config.inc");
include_once("conn.inc");
$cn->readonly = true;
$cn->maxblobsize = 0; //zero to pass through
$sku = $HTTP_GET_VARS['sku_cd'];
$sku="'".$sku."'";
$cmd5="SELECT img_image FROM flximage WHERE img_key = $sku AND img_type = 'sku'";

$rs5 = $cn->Execute($cmd5);
if (!$rs5){error_dis(21,"die","getimage.php");}
While (!$rs5->EOF){
$sku_image = new ADOFieldObject();
$sku_image = $rs5->FetchField("img_image"); $sku_image->max_length = '6144'; $rtn_val = $rs5->MetaType($sku_image->type,$sku_image->max_length,$sku_image);
$rs5->MoveNext();
}
print ($sku_image["img_image"]);
// release resources
$cmd5='';
$rs5->close();
$cn->close();
?>
Topic: Re:mssql blob field size 4096
author: John Lim   created: 12-08-2002 01:33:55 PM
Apparently the DB-Library used to build the MSSQL extension was designed for MS SQL Server 4.x, and updated for version 6.x. Microsoft has not updated the library since version 6.0.

These libraries do not support selecting more than 256 bytes from CHAR, VARCHAR, NCHAR or NVARCHAR fields, though INSERT and UPDATE still work fine though with large amounts of data. Many new types such as ntext, nvarchar, guid, char(8000) and varchar(8000) have been added to SQL Server 7 and SQL Server 2000; these new types are not supported.

However the text data type is supported, and the maximum size is controlled by the php.ini settings below. Both textlimit and textsize need to be set to the same value. Textlimit is the DB-Library setting, and textsize is the setting for SQL server.

mssql.textlimit=4096 ; valid range 0 - 2147483647 default=4096
mssql.textsize=4096 ; valid range 0 - 2147483647 default=4096

If you need support for large fields which are not of type text, it appears that your best alternative is accessing Microsoft SQL Server through ODBC or OLEDB.
Topic: Re:mssql blob field size 4096
author: shelley   created: 12-08-2002 05:11:27 PM
Hi John,

Yikes, that is a problem if we have to use the oledb or odbc Connection then we arn't portable to other O/S's.

Is there any way around this problem?

Shelley
Topic: Re:mssql blob field size 4096
author: MItchell T. Young   created: 12-08-2002 10:54:40 PM
How About using a text field then using base64_encode and base64_decode to insert and retrieve the image?

I don't know about MsSQL but this method does work on MySQL & PostgreSQL
Topic: Re:mssql blob field size 4096
author: shelley   created: 13-08-2002 12:52:10 PM
Do you know if I can do this at runtime? We can't change the field without a lot of additional problems at client sites. We also use the Table with other Software.

Shelley
Topic: Re:mssql blob field size 4096
author: Chris Wiegand   created: 13-04-2005 01:10:35 PM
Never mind, seems one should add --enable-msdblib to the ./configure command to fix this.
Topic: Re:mssql blob field size 4096
author: Chris Wiegand   created: 13-04-2005 01:12:16 PM
Argh, posted to the wrong thread, ignore my message above.
Topic: Re:mssql blob field size 4096
author: Bob   created: 18-04-2005 12:56:07 PM
Hi Shelley

Use ODBTP, http://odbtp.sourceforge.net. This will allow you to use the odbtp ADODb driver. ODBTP also supports the mssql extension with its odbtp/mssql hybrid extension. which will allow you to still use the mssql ADODb driver. See http://odbtp.sourceforge.net/phpext.html#mssql.

ODBTP fully supports all of SQL Server 2000's data types. You can also send and receive image data of any size without the use of any encoding and decoding schemes.
Topic: Re:mssql blob field size 4096
author: www.fiesto.com   created: 12-02-2007 04:27:25 AM
I spent 3 days to find this out. Wonder why such solution can't be found googling. Download adodb, then do this:

include('adodb/adodb.inc.php');

$host = 'hostname';
$user = 'username';
$pass = 'password';
$data = 'database';

$query = "SELECT image FROM table WHERE id='1'";
$conn =& ADONewConnection('odbc_mssql');
$dsn = "Driver={SQL Server};Server=$host;Database=$data;";
$conn->Connect($dsn,$user,$pass);
$rs = $conn->Execute($query);
$image = $rs->fields[0];
Topic: Re:mssql blob field size 4096
author: Davide   created: 04-03-2008 03:25:39 AM
look for set textsize (or something like it) in your mssql manual and query that string before of your query

and look for mssql.textsize in php.ini
Topic: Re:mssql blob field size 4096
author: Alejandro Vasquez   created: 21-03-2008 07:20:23 PM
I had the same problem using ADOdb and MSSQL...

Not idea why Text field is been truncated when I do a SELECT from the Database... it was because the mssql.textlimit and
mssql.textsize settings on my PHP.ini.

mssql.textlimit=4096 ; valid range 0 - 2147483647 default=4096
mssql.textsize=4096 ; valid range 0 - 2147483647 default=4096

Changing that to a correct value for my application solves the problem.

Thanks!!
Page 1
New ReplySearch

View Source

email: contact#phplens.com (change # to @)     telephone (malaysia): 60-3-7947 2888     fax (malaysia): 60-3-7947 2800