Subject | RE: [firebird-support] question about blob type |
---|---|
Author | Storage Box |
Post date | 2004-12-08T22:18:43Z |
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
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!?)
_____
From: Helen Borrie [mailto:helebor@...]
Sent: Wednesday, December 08, 2004 2:43 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] question about blob type
At 01:03 PM 8/12/2004 -0700, you wrote:
sub_type 1.
unreferenced value from any SQL operation.
NULL. This is generally unsafe unless you set a default -- and what
default would you set for a non-text blob?
As for the subtype, the engine doesn't know or care what is inside a blob -
you could store a jpeg in a text blob or an html file in a default
blob. Your applications will complain when they get the wrong sort of
data, though.
./hb
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://us.ard.yahoo.com/SIG=1292e11aj/M=298184.5639630.6699735.3001176/D=gr
oups/S=1705115386:HM/EXP=1102628591/A=2434971/R=0/SIG=11eeoolb0/*http://www.
netflix.com/Default?mqso=60185400> click here
<http://us.adserver.yahoo.com/l?M=298184.5639630.6699735.3001176/D=groups/S=
:HM/A=2434971/rand=829051678>
_____
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]
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
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!?)
_____
From: Helen Borrie [mailto:helebor@...]
Sent: Wednesday, December 08, 2004 2:43 PM
To: firebird-support@yahoogroups.com
Subject: Re: [firebird-support] question about blob type
At 01:03 PM 8/12/2004 -0700, you wrote:
>A couple of questions about blob-types.Yes, the default is sub_type 0 so this is what you get if you don't specify
>
>Can I specify a blob as just a "blob"?
sub_type 1.
>Yes: if you want a text blob you have to specify it.
>for example, in a table can I have a field defined as:
>
>....
>blob_field blob not null,
>.....
>
>...or do I have to specify sub_type and other options like so:
>
>.....
>blob_field blob segment sub_type text segment size 1024 not null,
>.....
>It's a column so you have to specify it. You can never return an
>And, when referring to that field in a stored procedure parameter, can I
>just call it a "blob"? For example:
>
>CREATE PROCEDURE sel_prod_by_prod_option_id
>
>(
>
>product_option_id int
>
>)
>
>returns
>
>(
>
>product_id_ int,
>
>product_name_ varchar(50),
>
>product_num_ varchar(50),
>
>synopsis_ varchar(500),
>
>description_ blob,
>
>.................,
>
>...or would I also have to specify all options?
unreferenced value from any SQL operation.
>other
>I ask because I think my C# code is throwing exceptions (I can find no
>reason why it wouldn't work) - when I try to insert into a table w/ a blobProbably your exception is coming from defining the blob column as NOT
>field simply defined as "blob", without sub_type or segment options.
NULL. This is generally unsafe unless you set a default -- and what
default would you set for a non-text blob?
As for the subtype, the engine doesn't know or care what is inside a blob -
you could store a jpeg in a text blob or an html file in a default
blob. Your applications will complain when they get the wrong sort of
data, though.
./hb
Yahoo! Groups Sponsor
ADVERTISEMENT
<http://us.ard.yahoo.com/SIG=1292e11aj/M=298184.5639630.6699735.3001176/D=gr
oups/S=1705115386:HM/EXP=1102628591/A=2434971/R=0/SIG=11eeoolb0/*http://www.
netflix.com/Default?mqso=60185400> click here
<http://us.adserver.yahoo.com/l?M=298184.5639630.6699735.3001176/D=groups/S=
:HM/A=2434971/rand=829051678>
_____
Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/firebird-support/
* To unsubscribe from this group, send an email to:
firebird-support-unsubscribe@yahoogroups.com
<mailto:firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> .
[Non-text portions of this message have been removed]