Files
gnatcoll-db/postgres/postgres_support.c
anisimko 5c77364d3d Fix case sensitivity of the prepared statement name
T315-007

Make prepare statement name case sensitive on postgres. Before this change
the name of prepared statement was sent to postgres server unquoted in
direct SQL statement PREPARE. As a result, the name was stored in lowercase
in the database server session. PQexecPrepared API call with the statement
name in original casing returned with error about failure to find the
prepared statement. To fix that, we use PQprepare call (available starting
from postgres version 8.0) or quoted name in direct SQL PREPARE statement in
older postgres versions.

Change-Id: I7ba455908de4d768f7bdc57102359ddfb5e6aaae
2020-03-20 18:48:30 +01:00

35 lines
1.9 KiB
C

/*----------------------------------------------------------------------------
-- G N A T C O L L --
-- --
-- Copyright (C) 2009-2020, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
----------------------------------------------------------------------------*/
#ifdef HAS_PQPREPARE
extern void* PQprepare(void); // Only the routine name matters here.
// Parameters and return value are defined in the Ada part.
void* gnatcoll_pqprepare = &PQprepare;
#else
void* gnatcoll_pqprepare = (void*)0;
#endif