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

Discussion in 'Perl Misc' started by Steve, Nov 27, 2003.

  1. Steve

    Steve Guest

    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
     
    Steve, Nov 27, 2003
    #1
    1. Advertising

  2. Steve

    Sam Holden Guest

    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
     
    Sam Holden, Nov 28, 2003
    #2
    1. Advertising

  3. Steve

    Steve Guest

    Here is the Code

    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
     
    Steve, Nov 28, 2003
    #3
  4. Steve

    Sam Holden Guest

    Re: Here is the Code

    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
     
    Sam Holden, Nov 28, 2003
    #4
  5. Re: Here is the Code

    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
     
    James Willmore, Nov 28, 2003
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SFoley

    ASP.NET not using enough memory?

    SFoley, Jul 24, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    447
    Craig Scurlock
    Jul 29, 2003
  2. David Williams
    Replies:
    2
    Views:
    1,137
    Jacob Yang [MSFT]
    Aug 12, 2003
  3. savvy
    Replies:
    1
    Views:
    477
    savvy
    Jan 18, 2006
  4. JB
    Replies:
    1
    Views:
    862
    Alexey Smirnov
    Sep 23, 2009
  5. Bazil
    Replies:
    3
    Views:
    330
    William Herrera
    Nov 30, 2003
Loading...

Share This Page