Add missing const qualifier in ECPG

From: Qingqing Zhou <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-patches(at)postgresql(dot)org
Subject: Add missing const qualifier in ECPG
Date: 2005-11-12 22:20:29
Message-ID: Pine.LNX.4.58.0511121717150.8837@eon.cs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Add missing const qualifier to (char *) parameters in ECPG. Per reported
by Tomasz Ostrowski.

Regards,
Qingqing

---

Index: ecpglib/descriptor.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v
retrieving revision 1.12
diff -c -r1.12 descriptor.c
*** ecpglib/descriptor.c 29 Aug 2004 05:06:59 -0000 1.12
--- ecpglib/descriptor.c 12 Nov 2005 22:11:18 -0000
***************
*** 49,55 ****
}

bool
! ECPGget_desc_header(int lineno, char *desc_name, int *count)
{
PGresult *ECPGresult;
struct sqlca_t *sqlca = ECPGget_sqlca();
--- 49,55 ----
}

bool
! ECPGget_desc_header(int lineno, const char *desc_name, int *count)
{
PGresult *ECPGresult;
struct sqlca_t *sqlca = ECPGget_sqlca();
***************
*** 188,194 ****
}

bool
! ECPGget_desc(int lineno, char *desc_name, int index,...)
{
va_list args;
PGresult *ECPGresult;
--- 188,194 ----
}

bool
! ECPGget_desc(int lineno, const char *desc_name, int index,...)
{
va_list args;
PGresult *ECPGresult;
***************
*** 431,437 ****
}

bool
! ECPGset_desc_header(int lineno, char *desc_name, int count)
{
struct descriptor *desc;

--- 431,437 ----
}

bool
! ECPGset_desc_header(int lineno, const char *desc_name, int count)
{
struct descriptor *desc;

***************
*** 452,458 ****
}

bool
! ECPGset_desc(int lineno, char *desc_name, int index,...)
{
va_list args;
struct descriptor *desc;
--- 452,458 ----
}

bool
! ECPGset_desc(int lineno, const char *desc_name, int index,...)
{
va_list args;
struct descriptor *desc;
Index: ecpglib/execute.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/ecpglib/execute.c,v
retrieving revision 1.43
diff -c -r1.43 execute.c
*** ecpglib/execute.c 15 Oct 2005 02:49:47 -0000 1.43
--- ecpglib/execute.c 12 Nov 2005 22:11:18 -0000
***************
*** 141,147 ****
* ind_offset - indicator offset
*/
static bool
! create_statement(int lineno, int compat, int force_indicator, struct connection * connection, struct statement ** stmt, char *query, va_list ap)
{
struct variable **list = &((*stmt)->inlist);
enum ECPGttype type;
--- 141,148 ----
* ind_offset - indicator offset
*/
static bool
! create_statement(int lineno, int compat, int force_indicator, struct connection * connection, struct statement ** stmt, const char
! *query, va_list ap)
{
struct variable **list = &((*stmt)->inlist);
enum ECPGttype type;
***************
*** 149,155 ****
if (!(*stmt = (struct statement *) ECPGalloc(sizeof(struct statement), lineno)))
return false;

! (*stmt)->command = query;
(*stmt)->connection = connection;
(*stmt)->lineno = lineno;
(*stmt)->compat = compat;
--- 150,156 ----
if (!(*stmt = (struct statement *) ECPGalloc(sizeof(struct statement), lineno)))
return false;

! (*stmt)->command = (char *)query;
(*stmt)->connection = connection;
(*stmt)->lineno = lineno;
(*stmt)->compat = compat;
***************
*** 1359,1365 ****
}

bool
! ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name, char *query,...)
{
va_list args;
struct statement *stmt;
--- 1360,1366 ----
}

bool
! ECPGdo(int lineno, int compat, int force_indicator, const char *connection_name, const char *query,...)
{
va_list args;
struct statement *stmt;
***************
*** 1417,1423 ****
ECPGdo_descriptor(int line, const char *connection,
const char *descriptor, const char *query)
{
! return ECPGdo(line, ECPG_COMPAT_PGSQL, true, connection, (char *) query, ECPGt_EOIT,
ECPGt_descriptor, descriptor, 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
--- 1418,1424 ----
ECPGdo_descriptor(int line, const char *connection,
const char *descriptor, const char *query)
{
! return ECPGdo(line, ECPG_COMPAT_PGSQL, true, connection, query, ECPGt_EOIT,
ECPGt_descriptor, descriptor, 0L, 0L, 0L,
ECPGt_NO_INDICATOR, NULL, 0L, 0L, 0L, ECPGt_EORT);
}
Index: ecpglib/prepare.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/ecpglib/prepare.c,v
retrieving revision 1.14
diff -c -r1.14 prepare.c
*** ecpglib/prepare.c 15 Oct 2005 02:49:47 -0000 1.14
--- ecpglib/prepare.c 12 Nov 2005 22:11:18 -0000
***************
*** 60,66 ****

/* handle the EXEC SQL PREPARE statement */
bool
! ECPGprepare(int lineno, char *name, char *variable)
{
struct statement *stmt;
struct prepared_statement *this;
--- 60,66 ----

/* handle the EXEC SQL PREPARE statement */
bool
! ECPGprepare(int lineno, const char *name, const char *variable)
{
struct statement *stmt;
struct prepared_statement *this;
***************
*** 112,118 ****

/* handle the EXEC SQL DEALLOCATE PREPARE statement */
bool
! ECPGdeallocate(int lineno, int c, char *name)
{
bool ret = ECPGdeallocate_one(lineno, name);
enum COMPAT_MODE compat = c;
--- 112,118 ----

/* handle the EXEC SQL DEALLOCATE PREPARE statement */
bool
! ECPGdeallocate(int lineno, int c, const char *name)
{
bool ret = ECPGdeallocate_one(lineno, name);
enum COMPAT_MODE compat = c;
***************
*** 133,139 ****
}

bool
! ECPGdeallocate_one(int lineno, char *name)
{
struct prepared_statement *this,
*prev;
--- 133,139 ----
}

bool
! ECPGdeallocate_one(int lineno, const char *name)
{
struct prepared_statement *this,
*prev;
Index: include/ecpglib.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/ecpg/include/ecpglib.h,v
retrieving revision 1.63
diff -c -r1.63 ecpglib.h
*** include/ecpglib.h 5 Jul 2004 09:45:53 -0000 1.63
--- include/ecpglib.h 12 Nov 2005 22:11:18 -0000
***************
*** 48,59 ****
bool ECPGsetcommit(int, const char *, const char *);
bool ECPGsetconn(int, const char *);
bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
! bool ECPGdo(int, int, int, const char *, char *,...);
bool ECPGtrans(int, const char *, const char *);
bool ECPGdisconnect(int, const char *);
! bool ECPGprepare(int, char *, char *);
! bool ECPGdeallocate(int, int, char *);
! bool ECPGdeallocate_one(int, char *);
bool ECPGdeallocate_all(int);
char *ECPGprepared_statement(const char *);

--- 48,59 ----
bool ECPGsetcommit(int, const char *, const char *);
bool ECPGsetconn(int, const char *);
bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
! bool ECPGdo(int, int, int, const char *, const char *,...);
bool ECPGtrans(int, const char *, const char *);
bool ECPGdisconnect(int, const char *);
! bool ECPGprepare(int, const char *, const char *);
! bool ECPGdeallocate(int, int, const char *);
! bool ECPGdeallocate_one(int, const char *);
bool ECPGdeallocate_all(int);
char *ECPGprepared_statement(const char *);

***************
*** 75,84 ****
bool ECPGallocate_desc(int line, const char *name);
void ECPGraise(int line, int code, const char *sqlstate, const char *str);
void ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat);
! bool ECPGget_desc_header(int, char *, int *);
! bool ECPGget_desc(int, char *, int,...);
! bool ECPGset_desc_header(int, char *, int);
! bool ECPGset_desc(int, char *, int,...);

void ECPGset_noind_null(enum ECPGttype, void *);
bool ECPGis_noind_null(enum ECPGttype, void *);
--- 75,84 ----
bool ECPGallocate_desc(int line, const char *name);
void ECPGraise(int line, int code, const char *sqlstate, const char *str);
void ECPGraise_backend(int line, PGresult *result, PGconn *conn, int compat);
! bool ECPGget_desc_header(int, const char *, int *);
! bool ECPGget_desc(int, const char *, int,...);
! bool ECPGset_desc_header(int, const char *, int);
! bool ECPGset_desc(int, const char *, int,...);

void ECPGset_noind_null(enum ECPGttype, void *);
bool ECPGis_noind_null(enum ECPGttype, void *);

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Peter Eisentraut 2005-11-12 23:14:01 Re: Add missing const qualifier in ECPG
Previous Message Tom Lane 2005-11-11 21:10:29 Re: Multi-table-unique-constraint