Subject | Re: [firebird-support] Blob not found |
---|---|
Author | Mark Rotteveel |
Post date | 2009-10-14T13:49:44Z |
I don't know the perl-bindings, but most likely with the way you are
inserting, the blob is treated as a VARCHAR instead of a blob and
therefor you are confronted with the size limit of VARCHARs.
Most likely you need to prepare a blob object, use that in the insert
and then stream the blob to the server before the commit/execute.
Mark
andreas.parslow wrote:
Mark Rotteveel
inserting, the blob is treated as a VARCHAR instead of a blob and
therefor you are confronted with the size limit of VARCHARs.
Most likely you need to prepare a blob object, use that in the insert
and then stream the blob to the server before the commit/execute.
Mark
andreas.parslow wrote:
> Hi--
>
> I'm using Firebird for the first time, after previously only using MySQL. I'm trying to insert a language file from the Opera browser into a BLOB field, but i either get "BLOB not found" or "invalid BLOB ID". The last error is if i convert the file to utf8 before inserting.
>
> The code i'm using is (in perl):
>
> ------------
> open my $file, '<', 'en.lng';
> binmode $file;
> my $full_file = '';
> while (<$file>) {
> $full_file .= $_;
> }
> close $file;
>
> my $inserted = $sql->do(
> 'INSERT INTO blobtest(test) VALUES(?)',
> $full_file
> );
> $sql->commit();
> ------------
>
> This gives me the "BLOB not found" error. Adding
> $full_file = Encode::encode('utf8', $full_file);
> before the insert-statement makes the error "invalid BLOB ID".
>
> The info about the database and table:
> ------------
> Database: /var/db/fortesting.db
> Owner: SYSDBA
> PAGE_SIZE 4096
> Number of DB pages allocated = 285
> Sweep interval = 20000
> Forced Writes are OFF
> Transaction - oldest = 57
> Transaction - oldest active = 58
> Transaction - oldest snapshot = 58
> Transaction - Next = 61
> Default Character set: NONE
>
> show table test;
> TEST BLOB segment 80, subtype UNKNOWN Nullable
> ------------
>
> The file "en.lng" is the standard language file for the Opera Browser, and contains 272874 bytes. One thing i've noticed is that the insert works fine if i cut most of the file so it's 65534 bytes. At 65535 bytes the error shows up again. You can find the language file here: hxxp://www.opera.com/download/languagefiles/.
>
> So the question is what i could be doing wrong here, and what do i need to do to insert the file into the BLOB field?
> Thanks in advance for any help.
Mark Rotteveel