X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2BDBF3A5E81 for ; Mon, 6 Dec 2004 04:18:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73157-04 for ; Mon, 6 Dec 2004 04:18:34 +0000 (GMT) Received: from titan.iphotel.com.br (unknown [200.198.186.25]) by svr1.postgresql.org (Postfix) with ESMTP id 14EC83A5E76 for ; Mon, 6 Dec 2004 04:18:26 +0000 (GMT) Received: from [200.171.79.161] (helo=paulo) by titan.iphotel.com.br with asmtp (Exim 4.34) id 1CbA0Z-0004VS-V5 for pgsql-sql@postgresql.org; Mon, 06 Dec 2004 01:57:56 -0200 Message-ID: <000a01c4db4a$a10049b0$0100a8c0@paulo> From: "Paulo Assis" To: Subject: Postgesql 8 beta 5: ecpg and date type - Access violations Date: Mon, 6 Dec 2004 02:18:22 -0200 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0007_01C4DB39.DC4D78A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.028 tagged_above=0 required=5 tests=HTML_60_70, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200412/45 X-Sequence-Number: 19665 This is a multi-part message in MIME format. ------=_NextPart_000_0007_01C4DB39.DC4D78A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi, There is an "access violation" caused by ecpgtypes when using date = fields and ecpg. Everything was runnig ok with dates rangin from 2000 - 2004, but this = acces violation occurs when the date with th year 1968 appears. Looking at my program, I can see that this happens inside the SELECT = into :data_admissao; where "data_admissao" is a date type. When I remove this field from the select, then it works. Here is the steps to reproduce the error: PostgreSQL 8.0.0 beta5 Windows XP Professional MingW Table: CREATE TABLE funcionarios ( id int4 NOT NULL, nome varchar(40) NOT NULL, data_admissao date NOT NULL, funcao int4 NOT NULL, CONSTRAINT funcionarios_pkey PRIMARY KEY (id) )=20 WITHOUT OIDS; Data: INSERT INTO fpcadfun VALUES (111,'SILVA','1968-01-19',10); Program: class funcionario { ... }; typedef std::vector funcionario_type; bool db_ler_funcionarios( funcionario_type &funcs ) { funcs.clear(); EXEC SQL BEGIN DECLARE SECTION; int id; VARCHAR nome[40]; date data_admissao; int funcao; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE func_cur CURSOR FOR SELECT id, nome, data_admissao, funcao FROM funcionarios ORDER BY id; EXEC SQL OPEN func_cur; EXEC SQL WHENEVER NOT FOUND DO break; char *txt_adm; =20 while(true) { EXEC SQL FETCH NEXT FROM func_cur INTO :id, :nome, :data_admissao, :funcao; txt_adm =3D PGTYPESdate_to_asc(data_admissao); funcionario f( id, nome.arr, txt_adm, funcao ); funcs.push_back(f); free(txt_adm); } EXEC SQL CLOSE func_cur; return true; } The access violation occurs at the bold line. I'm using mingw to compile = this program. Please fell free to ask for any other question or comment about this = error. I hope that I could give my 2 cents for this incredible RDMS. Best Regards, Paulo Assis ------=_NextPart_000_0007_01C4DB39.DC4D78A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi,
 
There is an "access violation" caused = by ecpgtypes=20 when using date fields and ecpg.
Everything was runnig ok with dates = rangin from=20 2000 - 2004, but this acces violation
occurs when the date with th year 1968=20 appears.
 
Looking at my program, I can see that = this happens=20 inside the SELECT into :data_admissao;
where "data_admissao" is a date = type.
When I remove this field from the = select, then it=20 works.
 
Here is the steps to reproduce the=20 error:
 
PostgreSQL 8.0.0 beta5
Windows XP Professional
MingW
 
Table:
CREATE TABLE = funcionarios
(
  id int4=20 NOT NULL,
  nome varchar(40) NOT NULL,
  data_admissao = date NOT=20 NULL,
  funcao int4 NOT NULL,
  CONSTRAINT = funcionarios_pkey=20 PRIMARY KEY (id)
)
WITHOUT OIDS;
 
Data:
INSERT INTO fpcadfun VALUES=20 (111,'SILVA','1968-01-19',10);
 
Program:
class funcionario { ... };
typedef std::vector<funcionario>=20 funcionario_type;
 
bool db_ler_funcionarios( = funcionario_type=20 &funcs )
{
 funcs.clear();
 
 EXEC SQL BEGIN DECLARE = SECTION;
 int=20 id;
 VARCHAR nome[40];
 date data_admissao;
 int = funcao;
 EXEC SQL END DECLARE SECTION;
 
 EXEC SQL DECLARE func_cur CURSOR=20 FOR
 SELECT id, nome, data_admissao, funcao
 FROM = funcionarios=20 ORDER BY id;
 
 EXEC SQL OPEN = func_cur;
 EXEC SQL=20 WHENEVER NOT FOUND DO break;
 
 char = *txt_adm;
 
 while(true)
 {
  EXEC SQL = FETCH NEXT=20 FROM func_cur INTO
   :id, :nome, = :data_admissao,=20 :funcao;
  txt_adm =3D=20 PGTYPESdate_to_asc(data_admissao);
  funcionario f( id, = nome.arr,=20 txt_adm, funcao=20 );
  funcs.push_back(f);
  free(txt_adm);
&n= bsp;}
 EXEC=20 SQL CLOSE func_cur;
 return true;
}
The access violation occurs at the bold = line. I'm=20 using mingw to compile this
program.
 
Please fell free to ask for any other = question or=20 comment about this error.
 
I hope that I could give my 2 cents for = this=20 incredible RDMS.
 
Best Regards,
Paulo Assis
 
------=_NextPart_000_0007_01C4DB39.DC4D78A0--