Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f63ba5c

Browse files
committed
Fix WARN->NOTICE in docs. Change libpgeasy connection parameters to use
PQconnectdb() style connections.
1 parent ba26aee commit f63ba5c

18 files changed

+43
-111
lines changed

contrib/findoidjoins/findoidjoins.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ main(int argc, char **argv)
2222
char attname[256];
2323
char typname[256];
2424
int count;
25+
char optstr[256];
2526

2627
if (argc != 2)
2728
halt("Usage: %s database\n", argv[0]);
2829

29-
connectdb(NULL, NULL, NULL, NULL, argv[1]);
30+
snprintf(optstr, 256, "dbname=%s", argv[1]);
31+
connectdb(optstr);
32+
3033
on_error_continue();
3134
on_error_stop();
3235

doc/src/sgml/libpgeasy.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpgeasy.sgml,v 2.2 2000/04/27 18:45:43 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/Attic/libpgeasy.sgml,v 2.3 2000/05/18 14:24:31 momjian Exp $
33
-->
44

55
<chapter id="pgeasy-chapter">
@@ -35,7 +35,7 @@ PGresult *doquery(char *query);
3535

3636
<listitem>
3737
<para>
38-
PGconn *connectdb();
38+
PGconn *connectdb(char *options);
3939
</para>
4040
</listitem>
4141

@@ -108,7 +108,7 @@ void unset_result(PGresult *oldres);
108108
</para>
109109

110110
<para>
111-
For <literal>select</literal> queries, <function>fetch</function>
111+
For <literal>SELECT</literal> queries, <function>fetch</function>
112112
allows you to pass pointers as parameters, and on return the variables
113113
are filled with data from the binary cursor you opened. These binary
114114
cursors can not be used if you are running the

doc/src/sgml/pltcl.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.3 2000/03/31 06:17:21 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.4 2000/05/18 14:24:32 momjian Exp $
33
-->
44

55
<chapter>
@@ -303,7 +303,7 @@ CREATE TRIGGER trig_mytab_modcount BEFORE INSERT OR UPDATE ON mytab
303303
<term>elog <replaceable>level</replaceable> <replaceable>msg</replaceable></term>
304304
<listitem>
305305
<para>
306-
Fire a log message. Possible levels are NOTICE, WARN, ERROR,
306+
Fire a log message. Possible levels are NOTICE, ERROR,
307307
FATAL, DEBUG and NOIND
308308
like for the <function>elog</function> C function.
309309
</para>

doc/src/sgml/ref/drop_aggregate.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_aggregate.sgml,v 1.6 1999/07/22 15:09:10 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_aggregate.sgml,v 1.7 2000/05/18 14:24:32 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -80,7 +80,7 @@ DROP
8080
</varlistentry>
8181
<varlistentry>
8282
<term><computeroutput>
83-
WARN RemoveAggregate: aggregate '<replaceable class="parameter">agg</replaceable>' for '<replaceable class="parameter">type</replaceable>' does not exist
83+
NOTICE RemoveAggregate: aggregate '<replaceable class="parameter">agg</replaceable>' for '<replaceable class="parameter">type</replaceable>' does not exist
8484
</computeroutput></term>
8585
<listitem>
8686
<para>

doc/src/sgml/ref/drop_function.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_function.sgml,v 1.7 1999/07/22 15:09:10 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_function.sgml,v 1.8 2000/05/18 14:24:33 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -77,7 +77,7 @@ DROP
7777
</varlistentry>
7878
<varlistentry>
7979
<term><computeroutput>
80-
WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable>" ("<replaceable class="parameter">types</replaceable>") does not exist
80+
NOTICE RemoveFunction: Function "<replaceable class="parameter">name</replaceable>" ("<replaceable class="parameter">types</replaceable>") does not exist
8181
</computeroutput></term>
8282
<listitem>
8383
<para>

doc/src/sgml/ref/drop_sequence.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_sequence.sgml,v 1.6 1999/07/22 15:09:10 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_sequence.sgml,v 1.7 2000/05/18 14:24:33 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -69,7 +69,7 @@ DROP
6969
</varlistentry>
7070
<varlistentry>
7171
<term><computeroutput>
72-
WARN: Relation "<replaceable class="parameter">name</replaceable>" does not exist.
72+
NOTICE: Relation "<replaceable class="parameter">name</replaceable>" does not exist.
7373
</computeroutput></term>
7474
<listitem>
7575
<para>

doc/src/sgml/ref/set.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.42 2000/04/18 15:23:34 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.43 2000/05/18 14:24:33 momjian Exp $
33
Postgres documentation
44
-->
55

@@ -919,7 +919,7 @@ SET VARIABLE
919919

920920
<varlistentry>
921921
<term><computeroutput>
922-
WARN: Bad value for <replaceable class="parameter">variable</replaceable> (<replaceable class="parameter">value</replaceable>)
922+
NOTICE: Bad value for <replaceable class="parameter">variable</replaceable> (<replaceable class="parameter">value</replaceable>)
923923
</computeroutput></term>
924924
<listitem>
925925
<para>

doc/src/sgml/start.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.11 2000/05/02 20:01:52 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/start.sgml,v 1.12 2000/05/18 14:24:32 momjian Exp $
33
-->
44

55
<chapter id="start">
@@ -243,7 +243,7 @@ FATAL 1:Feb 17 23:19:55:process userid (2360) != database owner (268)
243243
the following:
244244
<programlisting>
245245
% createdb mydb
246-
WARN:user "your username" is not allowed to create/destroy databases
246+
NOTICE:user "your username" is not allowed to create/destroy databases
247247
createdb: database creation failed on mydb.
248248
</programlisting>
249249
</para>

doc/src/sgml/trigger.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ trigf()
423423
int ret, i;
424424

425425
if (!CurrentTriggerData)
426-
elog(WARN, "trigf: triggers are not initialized");
426+
elog(NOTICE, "trigf: triggers are not initialized");
427427

428428
/* tuple to return to Executor */
429429
if (TRIGGER_FIRED_BY_UPDATE(CurrentTriggerData->tg_event))
@@ -446,13 +446,13 @@ trigf()
446446

447447
/* Connect to SPI manager */
448448
if ((ret = SPI_connect()) < 0)
449-
elog(WARN, "trigf (fired %s): SPI_connect returned %d", when, ret);
449+
elog(NOTICE, "trigf (fired %s): SPI_connect returned %d", when, ret);
450450

451451
/* Get number of tuples in relation */
452452
ret = SPI_exec("select count(*) from ttest", 0);
453453

454454
if (ret < 0)
455-
elog(WARN, "trigf (fired %s): SPI_exec returned %d", when, ret);
455+
elog(NOTICE, "trigf (fired %s): SPI_exec returned %d", when, ret);
456456

457457
i = SPI_getbinval(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1, &amp;isnull);
458458

doc/src/sgml/xfunc.sgml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.14 2000/05/02 20:01:53 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/xfunc.sgml,v 1.15 2000/05/18 14:24:32 momjian Exp $
33
-->
44

55
<chapter id="xfunc">
@@ -253,7 +253,7 @@ CREATE FUNCTION new_emp() RETURNS EMP
253253

254254
<programlisting>
255255
<computeroutput>
256-
WARN::function declared to return type EMP does not retrieve (EMP.*)
256+
NOTICE::function declared to return type EMP does not retrieve (EMP.*)
257257
</computeroutput>
258258
</programlisting>
259259
</para>
@@ -286,7 +286,7 @@ SELECT name(new_emp()) AS nobody;
286286

287287
<programlisting>
288288
SELECT new_emp().name AS nobody;
289-
WARN:parser: syntax error at or near "."
289+
NOTICE:parser: syntax error at or near "."
290290
</programlisting>
291291
</para>
292292
</listitem>

doc/src/sgml/xtypes.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ complex_in(char *str)
5555
double x, y;
5656
Complex *result;
5757
if (sscanf(str, " ( %lf , %lf )", &amp;x, &amp;y) != 2) {
58-
elog(WARN, "complex_in: error in parsing
58+
elog(NOTICE, "complex_in: error in parsing
5959
return NULL;
6060
}
6161
result = (Complex *)palloc(sizeof(Complex));

src/interfaces/libpgeasy/examples/Makefile

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
# Makefile for pgeasy examples
55
#
66
# IDENTIFICATION
7-
# $Header: /cvsroot/pgsql/src/interfaces/libpgeasy/examples/Attic/Makefile,v 1.1 1999/10/11 18:03:01 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/interfaces/libpgeasy/examples/Attic/Makefile,v 1.2 2000/05/18 14:24:37 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

11+
CFLAGS=-I/usr/local/pgsql/include
1112
TARGET = pginsert pgwordcount pgnulltest
12-
LDFLAGS = -lpgeasy
13+
LDFLAGS = -L/usr/local/pgsql/lib -lpgeasy
1314

1415
all : $(TARGET)
1516

src/interfaces/libpgeasy/examples/pginsert.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ main(int argc, char **argv)
2323
avarchar[51],
2424
atext[51];
2525
time_t aabstime;
26+
char optstr[256];
2627

2728
if (argc != 2)
2829
halt("Usage: %s database\n", argv[0]);
2930

30-
connectdb(NULL, NULL, NULL, NULL, argv[1]);
31+
snprintf(optstr, 256, "dbname=%s", argv[1]);
32+
connectdb(optstr);
3133

3234
on_error_continue();
3335
doquery("DROP TABLE testfetch");

src/interfaces/libpgeasy/examples/pgnulltest.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ main(int argc, char **argv)
3434
avarchar_null,
3535
atext_null,
3636
aabstime_null;
37+
char optstr[256];
3738

3839
if (argc != 2)
3940
halt("Usage: %s database\n", argv[0]);
4041

41-
connectdb(NULL, NULL, NULL, NULL, argv[1]);
42+
snprintf(optstr, 256, "dbname=%s", argv[1]);
43+
connectdb(optstr);
4244

4345
on_error_continue();
4446
doquery("DROP TABLE testfetch");

src/interfaces/libpgeasy/examples/pgwordcount.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ main(int argc, char **argv)
1515
int row = 0;
1616
int count;
1717
char line[4000];
18+
char optstr[256];
1819

1920
if (argc != 2)
2021
halt("Usage: %s database\n", argv[0]);
2122

22-
connectdb(NULL, NULL, NULL, NULL, argv[1]);
23+
snprintf(optstr, 256, "dbname=%s", argv[1]);
24+
connectdb(optstr);
25+
2326
on_error_continue();
2427
doquery("DROP TABLE words");
2528
on_error_stop();

src/interfaces/libpgeasy/libpgeasy.3

-71
This file was deleted.

src/interfaces/libpgeasy/libpgeasy.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,12 @@ static int tuple;
4444
**
4545
*/
4646
PGconn *
47-
connectdb(char *pghost,
48-
char *pgport,
49-
char *pgoptions,
50-
char *pgtty,
51-
char *dbName)
47+
connectdb(char *options)
5248
{
5349
/* make a connection to the database */
54-
conn = PQsetdb(pghost, pgport, pgoptions, pgtty, dbName);
50+
conn = PQconnectdb(options);
5551
if (PQstatus(conn) == CONNECTION_BAD)
56-
halt("Connection to database '%s' failed.\n%s\n", dbName,
52+
halt("Connection to database using '%s' failed.\n%s\n", options,
5753
PQerrorMessage(conn));
5854
return conn;
5955
}

src/interfaces/libpgeasy/libpgeasy.h

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@
44
*/
55

66
PGresult *doquery(char *query);
7-
PGconn *connectdb(char *pghost,
8-
char *pgport,
9-
char *pgoptions,
10-
char *pgtty,
11-
char *dbName);
7+
PGconn *connectdb(char *options);
128
void disconnectdb(void);
139
int fetch(void *param,...);
1410
int fetchwithnulls(void *param,...);

0 commit comments

Comments
 (0)