Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Could not allocate enough memory ( Fetch a Blob column from a MS-SQL(7) table. SQL)

Reply
Thread Tools

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

 
 
Steve
Guest
Posts: n/a
 
      11-27-2003
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


 
Reply With Quote
 
 
 
 
Sam Holden
Guest
Posts: n/a
 
      11-28-2003
On Thu, 27 Nov 2003 18:46:14 -0500, Steve <> wrote:
> 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.

--
Sam Holden
 
Reply With Quote
 
 
 
 
Steve
Guest
Posts: n/a
 
      11-28-2003
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" <> wrote in message
news:. ..
> On Thu, 27 Nov 2003 18:46:14 -0500, Steve <> wrote:
> > 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.
>
> --
> Sam Holden



 
Reply With Quote
 
Sam Holden
Guest
Posts: n/a
 
      11-28-2003
On Thu, 27 Nov 2003 20:21:00 -0500, Steve <> wrote:
> 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.

--
Sam Holden
 
Reply With Quote
 
James Willmore
Guest
Posts: n/a
 
      11-28-2003
On 28 Nov 2003 01:44:26 GMT
(Sam Holden) wrote:
> On Thu, 27 Nov 2003 20:21:00 -0500, Steve <>
> wrote:
> > 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


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
L A county says enough is enough richard Computer Support 7 02-26-2008 03:27 AM
Enough is enough... Imhotep Computer Security 16 09-28-2005 03:36 PM
Is there a method to fetch the last value stored in a DB column with out having to read in the entire column? DeWitt Phillips ASP .Net 2 12-12-2003 11:29 AM
Enough is enough.... ajacobs2 Digital Photography 33 10-05-2003 12:14 PM
Resolution - when is Enough ENOUGH? (a personal view) VT Digital Photography 43 09-12-2003 11:15 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57