Page 1 of 1

Error When a ZQuery Open a Image Blob Field Firebird 2.1

Posted: 10.06.2011, 15:56
by JavaPauloMG
Hi friends again,

I have a new problem when i open a VCL ZQuery, and the statment point to a blob field in table, and this fileld "LOGOMARCA" keep a image inside, the program give the error atach, i doing something wrong?

Thanks to all.

Script table

Code: Select all


/* Table: SCCLIENT, Owner: SYSDBA */

CREATE TABLE "SCCLIENT" 
(
  "COD"	 SMALLINT NOT NULL,
  "NOME"	 VARCHAR(70),
  "CGC"	 NUMERIC(14,0),
  "ENDERECO"	 VARCHAR(60),
  "BAIRRO"	 VARCHAR(70),
  "NUMERO"	 INTEGER,
  "CIDADE"	 VARCHAR(45),
  "CEP"	 INTEGER,
  "UF"	 VARCHAR(2),
  "TEC_RESP"	 SMALLINT,
  "ASSIST"	 SMALLINT,
  "NATUREZA"	 SMALLINT,
  "FONE"	 VARCHAR(45),
  "SITUACAO"	 VARCHAR(1),
  "REGIAO"	 SMALLINT,
  "FAX"	 VARCHAR(15),
  "CPF_D_C"	 NUMERIC(11,0),
  "EMAIL"	 VARCHAR(300),
  "REDE"	 VARCHAR(1),
  "SGHWIN"	 VARCHAR(1),
  "NOME_N"	 VARCHAR(70),
  "CGC_N"	 NUMERIC(14,0),
  "ENDERECO_N"	 VARCHAR(50),
  "BAIRRO_N"	 VARCHAR(40),
  "CIDADE_N"	 VARCHAR(40),
  "CEP_N"	 INTEGER,
  "UF_N"	 VARCHAR(2),
  "CELULAR"	 VARCHAR(45),
  "CONTATO"	 VARCHAR(70),
  "GERAR_PS"	 VARCHAR(1),
  "INF_PROV"	 BLOB SUB_TYPE TEXT SEGMENT SIZE 1,
  "REP_VEN"	 SMALLINT,
  "COM_VEN"	 SMALLINT,
  "REP_ASS"	 SMALLINT,
  "COM_ASS"	 SMALLINT,
  "PROVED_NOME"	 VARCHAR(30),
  "PROVED_EMAIL"	 VARCHAR(60),
  "DIRE_CLI_NOME"	 VARCHAR(30),
  "DIRE_CLI_EMAIL"	 VARCHAR(60),
  "ADMIN_NOME"	 VARCHAR(30),
  "ADMIN_EMAIL"	 VARCHAR(60),
  "INF_NOME"	 VARCHAR(30),
  "INF_EMAIL"	 VARCHAR(60),
  "CONSULT_NOME"	 VARCHAR(30),
  "CONSULT_EMAIL"	 VARCHAR(60),
  "BANCO"	 VARCHAR(1),
  "DISC_ITENS"	 CHAR(1),
  "DESC_IRF"	 VARCHAR(1),
  "RETORNO"	 VARCHAR(1),
  "DATA_RETORNO"	 DATE,
  "OBS"	 BLOB SUB_TYPE TEXT SEGMENT SIZE 1,
  "OBS_REA"	 BLOB SUB_TYPE TEXT SEGMENT SIZE 1,
  "TA_SENDO_ATEND"	 VARCHAR(1),
  "POR_QUEM"	 SMALLINT,
  "DIA_VCTO"	 SMALLINT,
  "COMP_EMIS"	 VARCHAR(1),
  "SENHA_M"	 VARCHAR(40),
  "FONE_FIN"	 VARCHAR(40),
  "EMAIL_FIN"	 VARCHAR(150),
  "CONTATO_FIN"	 VARCHAR(70),
  "OBS_PROCLI"	 BLOB SUB_TYPE TEXT SEGMENT SIZE 1,
  "NOME_E"	 VARCHAR(70),
  "CGC_E"	 NUMERIC(14,0),
  "ENDERECO_E"	 VARCHAR(50),
  "BAIRRO_E"	 VARCHAR(40),
  "CIDADE_E"	 VARCHAR(40),
  "CEP_E"	 INTEGER,
  "UF_E"	 VARCHAR(2),
  "AC_E"	 VARCHAR(50),
  "DESC_ISS"	 VARCHAR(1),
  "FAT_NOME"	 VARCHAR(30),
  "FAT_EMAIL"	 VARCHAR(60),
  "FIN_EMAIL"	 VARCHAR(60),
  "FIN_NOME"	 VARCHAR(30),
  "FIN_FONE"	 VARCHAR(15),
  "FAT_FONE"	 VARCHAR(15),
  "PROVED_FONE"	 VARCHAR(15),
  "DIRE_CLI_FONE"	 VARCHAR(15),
  "ADMIN_FONE"	 VARCHAR(15),
  "INF_FONE"	 VARCHAR(15),
  "CONSULT_FONE"	 VARCHAR(15),
  "INTERNET"	 SMALLINT,
  "EMAIL_GERAL"	 SMALLINT,
  "NUMERO_N"	 VARCHAR(10),
  "NUMERO_E"	 VARCHAR(10),
  "COBRA_ENCAR"	 VARCHAR(1),
  "GERENTE"	 SMALLINT,
  "CNES"	 INTEGER,
  "OBS_LANC"	 BLOB SUB_TYPE TEXT SEGMENT SIZE 1,
  "PERIODIC_ASSIST"	 SMALLINT,
  "EM_IMPLANTACAO"	 VARCHAR(1),
  "ESCRITORIO"	 CHAR(1),
  "VLR_KM"	 NUMERIC(8,2),
  "ORGAO_PUBLICO"	 CHAR(1),
  "CLASSIF"	 VARCHAR(1),
  "GRUPO_ATE"	 SMALLINT,
  "EMPRESA"	 CHAR(1),
  "COD_ANTERIOR"	 INTEGER,
  "DIRETOR"	 VARCHAR(40),
  "ATUALIZA"	 VARCHAR(255),
  "SGH"	 CHAR(1) NOT NULL,
  "SGO"	 CHAR(1) NOT NULL,
  "SGS"	 CHAR(1) NOT NULL,
  "ALIQ_ISS"	 NUMERIC(10,2),
  "SENHA_M_ANT"	 VARCHAR(40),
  "SENHA_M_POS"	 VARCHAR(40),
  "EM_ASSESSORIA"	 VARCHAR(1),
  "SENHA_EMISSAO_BOLETO"	 CHAR(40),
  "QTDE_HR_ACESSORIA"	 SMALLINT,
  "ID_TBINDICE"	 INTEGER,
  "LOGOMARCA"	 BLOB SUB_TYPE -1 SEGMENT SIZE 1,
CONSTRAINT "PK_SCCLIENT" PRIMARY KEY ("COD")
);
ALTER TABLE "SCCLIENT" ADD CONSTRAINT "FK_SCCLIENT_TBINDICE" FOREIGN KEY ("ID_TBINDICE") REFERENCES "TBINDICE" ("ID");
SET TERM ^ ;


/* Triggers only will work for SQL triggers */

CREATE TRIGGER "DEL_COMERC" FOR "SCCLIENT" 
ACTIVE AFTER DELETE POSITION 0
as
begin
  delete from schiscom where schiscom.cod=scclient.cod;
  delete from scpencom where scpencom.cod=scclient.cod;
  delete from sccomerc where sccomerc.cod=scclient.cod;
  delete from scvlrpro where scvlrpro.cod=scclient.cod;
end
 ^

COMMIT WORK ^
SET TERM ;^
The Code When the Error Ocorrurs

Code: Select all

  QryAll.Close;
  QryAll.SQL.Clear;
  QryAll.SQL.Add('select nome,cgc,endereco,bairro,numero,cidade,cep,uf,tec_resp,assist,');
  QryAll.SQL.Add('(select nome from sctecnic where cod=scclient.tec_resp) nome_t,');
  QryAll.SQL.Add('natureza,fone,situacao,regiao,fax,cpf_d_c,email,rede,sghwin,');
  QryAll.SQL.Add('nome_n,cgc_n,endereco_n,bairro_n,cidade_n,cep_n,uf_n,gerar_ps,inf_prov,');
  QryAll.SQL.Add('proved_nome,proved_email,proved_fone,dire_cli_nome,dire_cli_email,');
  QryAll.SQL.Add('dire_cli_fone,admin_nome,admin_email,admin_fone,inf_nome,inf_email,');
  QryAll.SQL.Add('inf_fone,fat_nome,fat_email,fat_fone,fin_nome,');
  QryAll.SQL.Add('fin_email,fin_fone,consult_nome,consult_email,consult_fone,gerente,cnes,');
  QryAll.SQL.Add('periodic_assist,em_implantacao,vlr_km,classif,grupo_ate,');
  QryAll.SQL.Add('(select nome from scgruate where cod=scclient.grupo_ate) nome_g, ');
  QryAll.SQL.Add('empresa,cod_anterior,sgh,sgo,sgs,em_assessoria,qtde_hr_acessoria,');
  QryAll.SQL.Add('logomarca ');
  QryAll.SQL.Add('from scclient where cod=:cod');
  QryAll.ParamByName('cod').AsInteger := cliente;
  QryAll.Open;
P.S : I still converting all applications DBX to Zeos, i using delphi 7, and nedd support to new firebird, and DBX still stop in time...

Problemn Solve

Posted: 13.06.2011, 20:39
by JavaPauloMG
Hi my friends, the erros only ocorrurs, when the subtype is negative, if i chance the subtype to zero (0), the error don't ocorrurs.

But the negative value for a subtype in a blob, is supported by firebird, it's a error on zeoslib?

Thanks to all.