[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Text Variable Overflow?
Bill,
String variables are limited to 32767 in SQR. You can't get around
this fact.
However, you may be able to concatenate several of these together
to form your image. Suppose that the largest image size you'd
consider is 320K. This would be about 640K when expressed as a
hex string. Instead of putting all the hex characters into a
single string, you could put them into a collection of 20 strings
and then concatenate them in the sql statement:
begin-sql
update my_image_table
set image_data =
$hex_00 || $hex_01 || $hex_02 || $hex_03 || $hex_04 ||
$hex_05 || $hex_06 || $hex_07 || $hex_08 || $hex_09 ||
$hex_10 || $hex_11 || $hex_12 || $hex_13 || $hex_14 ||
$hex_15 || $hex_16 || $hex_17 || $hex_18 || $hex_19 ||
where image_id = #image_id
end-sql
The trick would be to add some boring logic to your program
that decides which of the $hex_xx variables to add things
to.
Ray
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Good evening!
>
> I'm working on a small SQR to load an image into a DB2 table, using a sample
> program as a template (thoughtfully 'donated' by Ray O. - Thanks!)
>
> I've run into a small snag though. According to everything I've read, text
> variables ($image_data) can have any length, depending on system memory. My
> program dies when the length of my $image_data variable tries to exceed
> 32767 characters. Here is the error message from my log file:
>
> (SQR 4749) An attempt was made to move 32768 characters into
> '$image_data'.
> The maximum allowed is 32767 characters.
>
> I'm at a loss as to what the problem is! Any ideas? Thanks in advance for
> any and all help!!
>
> --
> William Beckner -- Stunt Programmer (Just call me "Bill")
> Illinois Central College, Rm L141 -- East Peoria, IL 61635-0001
> PH: (309) 694-8419 -- FAX: (309) 694-8995
> "Everything is unimportant in some way."
>
----------------------------------------------------------------------
Ray Ontko rayo@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788
Ray Ontko & Co. Software Consulting Services http://www.ontko.com/