Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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: ecpg_prepare.patch
Description: application/octet-stream (28.0 KB)

In response to

Responses

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group