Thread-safe PREPARE in ecpg

From: ITAGAKI Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: pgsql-patches(at)postgresql(dot)org, Michael Meskes <meskes(at)postgresql(dot)org>
Subject: Thread-safe PREPARE in ecpg
Date: 2007-09-25 06:22:13
Message-ID: 20070925150815.F3F8.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Here is a WIP patch to make prepared statements thread-safe in ecpg.
The variable prep_stmts was global but not protected by any locks.
I divided it into per-connection field so that we can access prepared
statements separately in each thread.

I needed to change the following exported functions, but it will
introduce an incompatibility issue. It might be ok for CVS HEAD,
but I'd like to port the fix to back versions. Do you have any
thoughts on how we can accomplish this better?

From:
- bool ECPGdeallocate(int, int, const char *name);
- bool ECPGdeallocate_all(int, int);
- char *ECPGprepared_statement(const char *name, int);
To:
- bool ECPGdeallocate(int, int, const char *connection_name, const char *name);
- bool ECPGdeallocate_all(int, int, const char *connection_name);
- char *ECPGprepared_statement(const char *connection_name, const char *name, int);
(connection_name argument is added.)

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center

Attachment Content-Type Size
ecpg_prepare.patch application/octet-stream 28.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chuck McDevitt 2007-09-25 06:58:54 Re: Suggestion for MSVC build
Previous Message Tom Lane 2007-09-25 03:51:47 Re: MSVC build scripts status

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2007-09-25 07:34:35 Re: [HACKERS] 'Waiting on lock'
Previous Message Jaime Casanova 2007-09-25 02:26:36 Re: [HACKERS] 'Waiting on lock'