Subject Re: [IBO] POSTING DATA from a TIBOQUERY Field inhibits use of the Query fields. (with image)
Author Helen Borrie
At 06:06 AM 3/11/2006, you wrote:
>Hi All,
>
>I have the same problem when my TiboQuery is in dsinsert state, but only
>because my program have an IMAGE blob field 80 binary. If I don't load an
>image, all right. But if I load an image, the record is inserted, saved in
>database, but lost informations im my DBedits e DBgrid although the record
>remain.

Your problem has two causes.

1. Your set has only one possible record (SELECT FIRST 1). This
means that, when the dataset is refreshed, you will not see your new
record. The dataset will always return that same record, i.e. the FIRST 1.

2. A blob is not an ordinary database field, it is a "soup of
bytes". The database cannot store it unless you first convert it to
a blob. This is easier to do in native IBO than in the
VCL-compatible components, but you can do it. In native IBO you can
assign an image object directly to a field of type
TIB_ColumnBlob. In the VCL, the steps are not as well
encapsulated: you need to assign your image object to a stream and
then assign that stream to a TBlobStream, then assign that to your
TBlobField. See the Delphi help on these two classes.

(Note also that your blob is NOT an "IMAGE blob field 80 binary", it
is an untyped soup of bytes of unknown size. The "SEGMENT SIZE 80"
in your declaration is an irrelevant artifact.)

- please see further comments in-line.


>See my SQL Select
>
>SELECT FIRST 1
> CLIENTE.CODIGO
> , CLIENTE.CLIENTE
> , CLIENTE.CONTATO
> , CLIENTE.TIPO
> , CLIENTE.CNPJ
> , CLIENTE.IE
> , CLIENTE.CPF
> , CLIENTE.CI
> , CLIENTE.ENDERECO
> , CLIENTE.COMPLEMENTO
> , CLIENTE.CODBAIRRO
> , CLIENTE.CODCIDADE
> , CLIENTE.CEP
> , CLIENTE.FONE
> , CLIENTE.FAX
> , CLIENTE.DESDE
> , CLIENTE.ANIVERSARIO
> , CLIENTE.CONTATO1
> , CLIENTE.EMAIL1
> , CLIENTE.MSN1
> , CLIENTE.SKYPE1
> , CLIENTE.FONECONTATO1
> , CLIENTE.CONTATO2
> , CLIENTE.EMAIL2
> , CLIENTE.MSN2
> , CLIENTE.SKYPE2
> , CLIENTE.FONECONTATO2
> , CLIENTE.LIMITEVALORFATUR
> , CLIENTE.RESPFINANFATUR
> , CLIENTE.FOTO
> , CLIENTE.OBS
> , BAIRRO.BAIRRO
> , CIDADE.CIDADE
> , CIDADE.UF
>FROM CLIENTE
>LEFT JOIN BAIRRO ON CLIENTE.CODBAIRRO=BAIRRO.CODIGO
>LEFT JOIN CIDADE ON CLIENTE.CODCIDADE=CIDADE.CODIGO
>ORDER BY CLIENTE.CODIGO
>
>See my SLQ Insert:
>
>INSERT INTO CLIENTE(
> CODIGO,
> CLIENTE,
> CONTATO,
> TIPO,
> CNPJ,
> IE,
> CPF,
> CI,
> ENDERECO,
> COMPLEMENTO,
> CODBAIRRO,
> CODCIDADE,
> CEP,
> FONE,
> FAX,
> DESDE,
> ANIVERSARIO,
> CONTATO1,
> EMAIL1,
> MSN1,
> SKYPE1,
> FONECONTATO1,
> CONTATO2,
> EMAIL2,
> MSN2,
> SKYPE2,
> FONECONTATO2,
> LIMITEVALORFATUR,
> RESPFINANFATUR,
> FOTO,
> OBS)
>VALUES (
> :CODIGO,
> :CLIENTE,
> :CONTATO,
> :TIPO,
> :CNPJ,
> :IE,
> :CPF,
> :CI,
> :ENDERECO,
> :COMPLEMENTO,
> :CODBAIRRO,
> :CODCIDADE,
> :CEP,
> :FONE,
> :FAX,
> :DESDE,
> :ANIVERSARIO,
> :CONTATO1,
> :EMAIL1,
> :MSN1,
> :SKYPE1,
> :FONECONTATO1,
> :CONTATO2,
> :EMAIL2,
> :MSN2,
> :SKYPE2,
> :FONECONTATO2,
> :LIMITEVALORFATUR,
> :RESPFINANFATUR,
> :FOTO,
> :OBS)

You will need to code the "business" for passing your image into your
FOTO object during the BeforePost.

>Some configurations
>isolation = tiCommitted
>CommitAction=caInvalidateCursor
>Autocommit = I Try with true and false

Tip: Make Autocommit false always when working with large
blobs. When updating and deleting records with blobs, Autocommit
causes a large build-up of garbage that can use up a lot of resources.

Helen