Subject RE: [firebird-support] question about blob type
Author Helen Borrie
At 03:18 PM 8/12/2004 -0700, you wrote:

>Well, all of my blobs in this database are exactly the same (text) and the
>front-end validates that something is entered into it, every time.
>
>When I do a test insert, I provide a value, it still gives me an error.
>Here's an example:
>
>1. My Table:
>
>CREATE TABLE product
>(
> product_id int NOT NULL,
> product_name VARCHAR(50),
> product_num VARCHAR(50),
> synopsis VARCHAR(500),
> description blob sub_type text segment size 1024 not null,
> wholesale_price DECIMAL(9,2),
> unit_price DECIMAL(9,2),
> sale_price DECIMAL(9,2),
> weight DECIMAL(9,2),
> height DECIMAL(9,2),
> width DECIMAL(9,2),
> length_sz DECIMAL(9,2),
> insured_value DECIMAL(9,2),
> is_free_shipping CHAR(1) NOT NULL,
> shipping_amt DECIMAL(9,2),
> is_cross_sell DECIMAL(9,2) NOT NULL,
> thumbnail VARCHAR(100),
> photo VARCHAR(100),
>CONSTRAINT PK_product_id PRIMARY KEY (product_id)
>);
>
>
>2. My Stored Procedure:
>
>CREATE PROCEDURE ins_product
>(
> product_name VARCHAR(50),
> product_num VARCHAR(50),
> synopsis VARCHAR(500),
> description blob,
> wholesale_price DECIMAL(9, 2),
> unit_price DECIMAL(9, 2),
> sale_price DECIMAL(9, 2),
> weight DECIMAL(9, 2),
> height DECIMAL(9, 2),
> width DECIMAL(9, 2),
> length_sz DECIMAL(9, 2),
> insured_value DECIMAL(9, 2),
> is_free_shipping CHAR(1),
> shipping_amt DECIMAL(9, 2),
> is_cross_sell CHAR(1),
> thumbnail VARCHAR(100),
> photo VARCHAR(100)
>)
>returns
>(
> product_id_ int
>)
>AS
>begin
> product_id_ = GEN_ID(gen_product_id, 1);
>
> insert into
> product
> (
> product_id,
> product_name,
> product_num,
> description,
> synopsis,
> wholesale_price,
> unit_price,
> sale_price,
> weight,
> height,
> width,
> length_sz,
> insured_value,
> is_free_shipping,
> shipping_amt,
> is_cross_sell,
> thumbnail,
> photo
> )
> values
> (
> :product_id_,
> :product_name,
> :product_num,
> :description,
> :synopsis,
> :wholesale_price,
> :unit_price,
> :sale_price,
> :weight,
> :height,
> :width,
> :length_sz,
> :insured_value,
> :is_free_shipping,
> :shipping_amt,
> :is_cross_sell,
> :thumbnail,
> :photo
> );
>end
> ^
>
>3. How I Executed It:
>
>execute procedure ins_product
>(
> 'test prod',
> 'test prod num',
> 'test synopsis',
> 'test description, this is a blob field!',
> 10.99,
> 10.99,
> 10.99,
> 10.99,
> 10.99,
> 10.99,
> 10.99,
> 10.99,
> 'Y',
> 10.99,
> 'N',
> 'image.gif',
> 'image.gif'
>);
>
>4. Error:
>
>ISC ERROR CODE:335544384
>
>ISC ERROR MESSAGE:
>internal error
>

OK, this is simple. You define the input argument for description as a
blob, but you passed a string to it. Either redefine the input argument as
a varchar (valid up to 32,565 bytes in length) or pass a blob.

>
>You'll notice I defined what type of blob it should be in the table but did
>not define it for the sproc's parameter (not even sure if that matters!?)

It doesn't matter - the db engine doesn't care. But it does care if it is
expecting a blob and you pass a string.

./heLen