Could not allocate enough memory ( Fetch a Blob column from a MS-SQL(7) table. SQL)

S

Steve

I am trying to fetch a Blob column from a MS-SQL(7) table. SQL
Select terminates with and error:

"SQL ERR on: Select viewcontent from NewProfile where ID='Prof2' and
CUSTID='sandy'"

SQL-Err:[911] [4] [0] "Could not allocate enough memory (-1 bytes) for
column 1.

'viewcontent' is a Blob (Image) field in MS-SQL (ver 7.0)
can anyone Help?

B.Ghassemlou
 
S

Sam Holden

I am trying to fetch a Blob column from a MS-SQL(7) table. SQL
Select terminates with and error:

"SQL ERR on: Select viewcontent from NewProfile where ID='Prof2' and
CUSTID='sandy'"

SQL-Err:[911] [4] [0] "Could not allocate enough memory (-1 bytes) for
column 1.

'viewcontent' is a Blob (Image) field in MS-SQL (ver 7.0)
can anyone Help?

That's not a perl error message, and I see no Perl code.
 
S

Steve

Well I thought Memory allocation was by perl.
anyway here is the code, it fails on line 2 and dies on line 6

$SqlString ="Select viewcontent from NewProfile where ID='Prof2' and
CUSTID='sandy' ";
if(($dbh->Sql( $SqlString )))
{
$ErrMsg = 'SQL-Err:'.$dbh->Error();
print "SQL ERR on: $SqlString $ErrMsg <BR>";
die
};
$dbh->FetchRow();
{
undef %Data;
%Data = $dbh->DataHash();
$FldContent=$Data{$_[1]};


Sam Holden said:
I am trying to fetch a Blob column from a MS-SQL(7) table. SQL
Select terminates with and error:

"SQL ERR on: Select viewcontent from NewProfile where ID='Prof2' and
CUSTID='sandy'"

SQL-Err:[911] [4] [0] "Could not allocate enough memory (-1 bytes) for
column 1.

'viewcontent' is a Blob (Image) field in MS-SQL (ver 7.0)
can anyone Help?

That's not a perl error message, and I see no Perl code.
 
S

Sam Holden

Well I thought Memory allocation was by perl.
anyway here is the code, it fails on line 2 and dies on line 6

$SqlString ="Select viewcontent from NewProfile where ID='Prof2' and
CUSTID='sandy' ";
if(($dbh->Sql( $SqlString )))
{
$ErrMsg = 'SQL-Err:'.$dbh->Error();
print "SQL ERR on: $SqlString $ErrMsg <BR>";
die
};
$dbh->FetchRow();
{
undef %Data;
%Data = $dbh->DataHash();
$FldContent=$Data{$_[1]};

I don't know what type of object $dbh is, and DBI certainly doesn't
use the methods you use above (and that's the only one I have experience with).

So check the documentation of the module to see what it says about it.

One thing I do note, is that you are doing error handling when the Sql() method
returns a true value. That seems like a very badly designed module if that is
how it's meant to be done. If it isn't then of course you will get random error
messages when you retrieve error messages when no error has occurred.

[snip full quote, including sig]

Please don't do that, quote the parts you are replying to and put
your reply below them.
 
J

James Willmore

On 28 Nov 2003 01:44:26 GMT

You have a 'die' statment by itself. Every time you enter this part
of the 'if' loop, the script will die. It's better to do something
like:

die "An error occured\nSQL: $SqlString\nError: ",$dbh->Error(),"\n"
unless ($dbh->Sql($SqlString));

I'll leave it up to you to find a good place to put this line. I can
tell you that this should remove the need for an if loop.

Go back and read the docs more closely :)

HTH

--
Jim

Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.

a fortune quote ...
The typewriting machine, when played with expression, is no more
annoying than the piano when played by a sister or near relation.
-- Oscar Wilde
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top