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

    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?

    Steve, Nov 27, 2003
    1. Advertisements

  2. Steve

    Sam Holden Guest

    That's not a perl error message, and I see no Perl code.
    Sam Holden, Nov 28, 2003
    1. Advertisements

  3. Steve

    Steve Guest

    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>";
    undef %Data;
    %Data = $dbh->DataHash();

    Steve, Nov 28, 2003
  4. Steve

    Sam Holden Guest

    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, Nov 28, 2003
  5. 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

    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 :)



    Copyright notice: all code written by the author in this post is
    released under the GPL.
    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
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.