Using BLOB in Informix 7.31 (Old version)
Posted in 2008
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Security, Permissions & Auditing
Dear all,
I did study a case shown as the following.
Background
In function Renewal Endorsement & Renewal Endorsement Letter, we need to sign
name on each letter that is not efficiency
Therefore, the functions need to print the digital signature on those letters
automatically.
Enhancement
(1) Prepare a digital signature files
In PC (Copy signature files from PC to UNIX server):
FTP transfer:
> ftp <unix_server_name>(Input login name and password)
> cd /data/grp/tmp/transfer
> put datefile1.jpg
> put datefile2.jpg
> bye
(2) Create a table signature with a field of BLOB type
CREATE TABLE signature
(
id_num INT,
sign_name BYTE
);
(3) Add records to table signature
I don't know how to insert from JPG files to the table above...
(4) Call the table signature and place the BLOB field to the report
template
In function Renewal Endorsement (A Informix 4GL program):
define f_sign_name1 byte,
f_sign_name2 byte
.
.
select sign_name into f_sign_name1
from signature
where id_num = 1
select sign_name into f_sign_name2
from signature
where id_num = 2
.
.
print column 1, "VP, Head of Group and Pensions";
print column 63, "VP & Appointed Actuary"
skip 1 line
print column 1, f_sign_name1;
print column 63, f_sign_name2
In function Renewal Endorsement Letter (A Informix 4GL program):
define f_sign_name1 byte,
f_sign_name2 byte
.
.
select sign_name into f_sign_name1
from signature
where id_num = 1
select sign_name into f_sign_name2
from signature
where id_num = 2
.
.
print column 1, "VP, Head of Group and Pensions";
print column 43, "VP & Appointed Actuary"
skip 1 line
print column 1, f_sign_name1;
print column 43, f_sign_name2
----------------------------------------------------------------------------
Hi all,
Do I miss something on my study case? Also, I don't know how insert those
image files to the table. Does anyone help me, please? Thank you so much!
Best Regards
Ron
Hi all, Would you guys give me a full completed example, please? Thank you very much! Regards Ron
On Jan 8, 2008 12:13 AM, NRON NRON <nron60@yahoo.com.hk> wrote:
> I did study a case shown as the following.
>
> Background
> In function Renewal Endorsement & Renewal Endorsement Letter, we need to sign
> name on each letter that is not efficiency
>
> Therefore, the functions need to print the digital signature on those letters
> automatically.
>
> Enhancement
> (1) Prepare a digital signature files
> In PC (Copy signature files from PC to UNIX server):
>
> FTP transfer:
> > ftp <unix_server_name>(Input login name and password)
> > cd /data/grp/tmp/transfer
> > put datefile1.jpg
> > put datefile2.jpg
> > bye
>
> (2) Create a table "signature" with a field of BLOB type
> CREATE TABLE signature
> (>
> id_num INT,
>
> sign_name BYTE
> );
>
> (3) Add records to table "signature"
> I don't know how to insert from JPG files to the table above...
Use LOCATE blobvar IN FILE 'filename' in your I4GL code, IIRC. At
least, look up LOCATE in the I4GL manual. You can probably use a
host variable in place of the literal.
> (4) Call the table "signature" and place the BLOB field to the report
> template
>
> In function Renewal Endorsement (A Informix 4GL program):
> define f_sign_name1 byte,
>
> f_sign_name2 byte
> ..
> ..
> select sign_name into f_sign_name1
> from signature
> where id_num = 1
>
> select sign_name into f_sign_name2
> from signature
> where id_num = 2
> ..
> ..
> print column 1, "VP, Head of Group and Pensions";
> print column 63, "VP & Appointed Actuary"
> skip 1 line
> print column 1, f_sign_name1;
> print column 63, f_sign_name2
You are going to need to do quite a lot of thinking here. If I4GL did
anything, it would spew forth a binary dump of the JPG file. Except
by miracle, your printer is not going to know that it should interpret
a bunch of JPG file bytes as a JPG file at some arbitrary point in the
report output.
You are likely to need to move to a considerably more complex system
for generating the letter. For example you could generate it as an
HTML document, and then arrange for some HTML rendering tool kit
(commonly known as a browser) to read that document and then print the
results. Or you could choose some other form of markup language for
the output of the I4GL report and pass that to the appropriate
formatter -- historically, that might have been troff; maybe LaTeX or
some XML-based formatting tool would be appropriate.
> [...]
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2007.0914 -- http://dbi.perl.org/
NB: Please do not use this email for correspondence.
I don't necessarily read it every week, even.