6
6
*
7
7
* Copyright (c) 1994, Regents of the University of California
8
8
*
9
- * $Id: libpq-fe.h,v 1.5 1996/07/31 18:40:12 scrappy Exp $
9
+ * $Id: libpq-fe.h,v 1.5.2.1 1996/08/28 01:13:37 scrappy Exp $
10
10
*
11
11
*-------------------------------------------------------------------------
12
12
*/
@@ -45,7 +45,7 @@ typedef enum {
45
45
} ExecStatusType ;
46
46
47
47
/* string descriptions of the ExecStatusTypes */
48
- extern char * pgresStatus [];
48
+ extern const char * pgresStatus [];
49
49
50
50
/*
51
51
* POSTGRES backend dependent Constants.
@@ -83,6 +83,9 @@ typedef struct pgresAttDesc {
83
83
For binary tuples, the first four bytes of the value is the size,
84
84
and the bytes afterwards are the value. The binary value is
85
85
not guaranteed to be null-terminated. In fact, it can have embedded nulls*/
86
+
87
+ #define NULL_LEN (-1) /* pg_result len for NULL value */
88
+
86
89
typedef struct pgresAttValue {
87
90
int len ; /* length in bytes of the value */
88
91
char * value ; /* actual value */
@@ -144,8 +147,8 @@ typedef struct _PQprintOpt PQprintOpt;
144
147
145
148
/* === in fe-connect.c === */
146
149
/* make a new client connection to the backend */
147
- extern PGconn * PQsetdb (char * pghost , char * pgport , char * pgoptions ,
148
- char * pgtty , char * dbName );
150
+ extern PGconn * PQsetdb (const char * pghost , const char * pgport , const char * pgoptions ,
151
+ const char * pgtty , const char * dbName );
149
152
/* close the current connection and free the PGconn data structure */
150
153
extern void PQfinish (PGconn * conn );
151
154
/* close the current connection and restablish a new one with the same
@@ -163,27 +166,28 @@ extern void PQtrace(PGconn *conn, FILE* debug_port);
163
166
extern void PQuntrace (PGconn * conn );
164
167
165
168
/* === in fe-exec.c === */
166
- extern PGresult * PQexec (PGconn * conn , char * query );
169
+ extern PGresult * PQexec (PGconn * conn , const char * query );
167
170
extern int PQgetline (PGconn * conn , char * string , int length );
168
171
extern int PQendcopy (PGconn * conn );
169
- extern void PQputline (PGconn * conn , char * string );
172
+ extern void PQputline (PGconn * conn , const char * string );
170
173
extern ExecStatusType PQresultStatus (PGresult * res );
171
174
extern int PQntuples (PGresult * res );
172
175
extern int PQnfields (PGresult * res );
173
176
extern char * PQfname (PGresult * res , int field_num );
174
- extern int PQfnumber (PGresult * res , char * field_name );
177
+ extern int PQfnumber (PGresult * res , const char * field_name );
175
178
extern Oid PQftype (PGresult * res , int field_num );
176
179
extern int2 PQfsize (PGresult * res , int field_num );
177
180
extern char * PQcmdStatus (PGresult * res );
178
- extern char * PQoidStatus (PGresult * res );
181
+ extern const char * PQoidStatus (PGresult * res );
179
182
extern char * PQgetvalue (PGresult * res , int tup_num , int field_num );
180
183
extern int PQgetlength (PGresult * res , int tup_num , int field_num );
184
+ extern int PQgetisnull (PGresult * res , int tup_num , int field_num );
181
185
extern void PQclear (PGresult * res );
182
186
/* PQdisplayTuples() is a better version of PQprintTuples() */
183
187
extern void PQdisplayTuples (PGresult * res ,
184
188
FILE * fp , /* where to send the output */
185
189
int fillAlign , /* pad the fields with spaces */
186
- char * fieldSep , /* field separator */
190
+ const char * fieldSep , /* field separator */
187
191
int printHeader , /* display headers? */
188
192
int quiet );
189
193
extern void PQprintTuples (PGresult * res ,
@@ -207,7 +211,7 @@ extern PGresult* PQfn(PGconn* conn,
207
211
int nargs );
208
212
/* === in fe-auth.c === */
209
213
extern MsgType fe_getauthsvc (char * PQerrormsg );
210
- extern void fe_setauthsvc (char * name , char * PQerrormsg );
214
+ extern void fe_setauthsvc (const char * name , char * PQerrormsg );
211
215
extern char * fe_getauthname (char * PQerrormsg );
212
216
213
217
/* === in fe-misc.c === */
@@ -217,8 +221,8 @@ extern char *fe_getauthname(char* PQerrormsg);
217
221
*/
218
222
extern int pqGets (char * s , int maxlen , FILE * stream , FILE * debug );
219
223
extern int pqGetnchar (char * s , int maxlen , FILE * stream , FILE * debug );
220
- extern int pqPutnchar (char * s , int maxlen , FILE * stream , FILE * debug );
221
- extern int pqPuts (char * s , FILE * stream , FILE * debug );
224
+ extern int pqPutnchar (const char * s , int maxlen , FILE * stream , FILE * debug );
225
+ extern int pqPuts (const char * s , FILE * stream , FILE * debug );
222
226
extern int pqGetc (FILE * stream , FILE * debug );
223
227
/* get a n-byte integer from the stream into result */
224
228
/* returns 0 if successful */
0 commit comments