Re: [WIP] RE: DECLARE STATEMENT setting up a connection in ECPG

From: "Ideriha, Takeshi" <ideriha(dot)takeshi(at)jp(dot)fujitsu(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [WIP] RE: DECLARE STATEMENT setting up a connection in ECPG
Date: 2017-02-07 08:59:03
Message-ID: 4E72940DA2BF16479384A86D54D0988A56598DBF@G01JPEXMBKW04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

> By the way, I have been able to crash your patch when running the regression

> tests:

> (lldb) bt

> * thread #1: tid = 0x0000, 0x00007fff89a828b0

> libsystem_platform.dylib`_platform_strcmp + 176, stop reason = signal SIGSTOP

> * frame #0: 0x00007fff89a828b0 libsystem_platform.dylib`_platform_strcmp +

> 176

> frame #1: 0x000000010c835bc3

> libecpg.6.dylib`ecpg_release_declared_statement(connection_name="con3")

> + 83 at prepare.c:740

> frame #2: 0x000000010c838103

> libecpg.6.dylib`ECPGdisconnect(lineno=81, connection_name="ALL") + 179 at

> connect.c:697

> frame #3: 0x000000010c811922 declare`main(argc=1,

> argv=0x00007fff533ee320) + 434 at declare.pgc:81

> frame #4: 0x00007fff932345ad libdyld.dylib`start + 1

>

> You also need to add in src/interfaces/ecpg/test/sql/.gitignore new entries

> related to the files you are adding and that get generated.

Thank you very much for your test. I fixed this memory leak bug, and fixed .gitignore.

I also fixed some code style to fit coding conventions,

and splited my patch into 4 parts to improve readability:

* 001_declareStmt_preproc_v3.patch

* 002_declareStmt_ecpglib_v3.patch

* 003_declareStmt_doc_v3.patch

* 004_declareStmt_test_v3.patch

Here is a short summary:

[001_declareStmt_preproc_v3.patch]

This enables ecpg to pre-process "DECLARE prepared_name STATEMENT".

prepared_name is buffered to g_declared_list to check duplication of prepared_name.

After pre-processed, "DECLARE STATEMENT" is translated to ECPGdeclare().

And CUSRSOR STAETEMENT such as OPEN/FETCH/CLOSE cursor is translated into ECPGopen()/ECPGfetch()/ECPGclose().

These new function is defined at 002_declareStmt_ecpglib_v3.patch.

[002_declareStmt_ecpglib_v3.patch]

This patch mainly implements ECPGdeclare(), ECPGopen(), ECPGfetch(), ECPGclose().

ECPGdeclare() links the declared name and connection name.

Handling CURSOR things are originally done by ECPGdo().

But in order to handle connection linked to declared name,

the functions such as ECPGopen(), ECPGfetch()and ECPGclose() are introduced and these functions wraps ecpg_do().

[003_declareStmt_doc_v3.patch]

Docs. I wrote the DECLARE STATEMENT itself.

And added another example to ecpg-set-connection.

[004_declareStmt_test_v3.patch]

Regression test and answers.

I made them but I'm thinking these include too much test cases, don't they?

So I'm planning to make it smaller.

regards,

Ideriha Takeshi

Attachment Content-Type Size
001_declareStmt_preproc_v3.patch application/octet-stream 17.6 KB
002_declareStmt_ecpglib_v3.patch application/octet-stream 23.5 KB
003_declareStmt_doc_v3.patch application/octet-stream 4.2 KB
004_declareStmt_test_v3.patch application/octet-stream 287.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2017-02-07 09:22:40 Backport of pg_statistics typos fix
Previous Message Okano, Naoki 2017-02-07 08:11:17 Re: Adding the optional clause 'AS' in CREATE TRIGGER