@@ -387,15 +387,10 @@ static const char uri_designator[] = "postgresql://";
387
387
static const char short_uri_designator [] = "postgres://" ;
388
388
389
389
static bool connectOptions1 (PGconn * conn , const char * conninfo );
390
- static bool connectOptions2 (PGconn * conn );
391
- static int connectDBStart (PGconn * conn );
392
- static int connectDBComplete (PGconn * conn );
393
390
static PGPing internal_ping (PGconn * conn );
394
- static PGconn * makeEmptyPGconn (void );
395
391
static void pqFreeCommandQueue (PGcmdQueueEntry * queue );
396
392
static bool fillPGconn (PGconn * conn , PQconninfoOption * connOptions );
397
393
static void freePGconn (PGconn * conn );
398
- static void closePGconn (PGconn * conn );
399
394
static void release_conn_addrinfo (PGconn * conn );
400
395
static int store_conn_addrinfo (PGconn * conn , struct addrinfo * addrlist );
401
396
static void sendTerminateConn (PGconn * conn );
@@ -644,8 +639,8 @@ pqDropServerData(PGconn *conn)
644
639
* PQconnectStart or PQconnectStartParams (which differ in the same way as
645
640
* PQconnectdb and PQconnectdbParams) and PQconnectPoll.
646
641
*
647
- * Internally, the static functions connectDBStart, connectDBComplete
648
- * are part of the connection procedure.
642
+ * The non-exported functions pqConnectDBStart, pqConnectDBComplete are
643
+ * part of the connection procedure implementation .
649
644
*/
650
645
651
646
/*
@@ -678,7 +673,7 @@ PQconnectdbParams(const char *const *keywords,
678
673
PGconn * conn = PQconnectStartParams (keywords , values , expand_dbname );
679
674
680
675
if (conn && conn -> status != CONNECTION_BAD )
681
- (void ) connectDBComplete (conn );
676
+ (void ) pqConnectDBComplete (conn );
682
677
683
678
return conn ;
684
679
}
@@ -731,7 +726,7 @@ PQconnectdb(const char *conninfo)
731
726
PGconn * conn = PQconnectStart (conninfo );
732
727
733
728
if (conn && conn -> status != CONNECTION_BAD )
734
- (void ) connectDBComplete (conn );
729
+ (void ) pqConnectDBComplete (conn );
735
730
736
731
return conn ;
737
732
}
@@ -785,7 +780,7 @@ PQconnectStartParams(const char *const *keywords,
785
780
* to initialize conn->errorMessage to empty. All subsequent steps during
786
781
* connection initialization will only append to that buffer.
787
782
*/
788
- conn = makeEmptyPGconn ();
783
+ conn = pqMakeEmptyPGconn ();
789
784
if (conn == NULL )
790
785
return NULL ;
791
786
@@ -819,15 +814,15 @@ PQconnectStartParams(const char *const *keywords,
819
814
/*
820
815
* Compute derived options
821
816
*/
822
- if (!connectOptions2 (conn ))
817
+ if (!pqConnectOptions2 (conn ))
823
818
return conn ;
824
819
825
820
/*
826
821
* Connect to the database
827
822
*/
828
- if (!connectDBStart (conn ))
823
+ if (!pqConnectDBStart (conn ))
829
824
{
830
- /* Just in case we failed to set it in connectDBStart */
825
+ /* Just in case we failed to set it in pqConnectDBStart */
831
826
conn -> status = CONNECTION_BAD ;
832
827
}
833
828
@@ -863,7 +858,7 @@ PQconnectStart(const char *conninfo)
863
858
* to initialize conn->errorMessage to empty. All subsequent steps during
864
859
* connection initialization will only append to that buffer.
865
860
*/
866
- conn = makeEmptyPGconn ();
861
+ conn = pqMakeEmptyPGconn ();
867
862
if (conn == NULL )
868
863
return NULL ;
869
864
@@ -876,15 +871,15 @@ PQconnectStart(const char *conninfo)
876
871
/*
877
872
* Compute derived options
878
873
*/
879
- if (!connectOptions2 (conn ))
874
+ if (!pqConnectOptions2 (conn ))
880
875
return conn ;
881
876
882
877
/*
883
878
* Connect to the database
884
879
*/
885
- if (!connectDBStart (conn ))
880
+ if (!pqConnectDBStart (conn ))
886
881
{
887
- /* Just in case we failed to set it in connectDBStart */
882
+ /* Just in case we failed to set it in pqConnectDBStart */
888
883
conn -> status = CONNECTION_BAD ;
889
884
}
890
885
@@ -895,7 +890,7 @@ PQconnectStart(const char *conninfo)
895
890
* Move option values into conn structure
896
891
*
897
892
* Don't put anything cute here --- intelligence should be in
898
- * connectOptions2 ...
893
+ * pqConnectOptions2 ...
899
894
*
900
895
* Returns true on success. On failure, returns false and sets error message.
901
896
*/
@@ -933,7 +928,7 @@ fillPGconn(PGconn *conn, PQconninfoOption *connOptions)
933
928
*
934
929
* Internal subroutine to set up connection parameters given an already-
935
930
* created PGconn and a conninfo string. Derived settings should be
936
- * processed by calling connectOptions2 next. (We split them because
931
+ * processed by calling pqConnectOptions2 next. (We split them because
937
932
* PQsetdbLogin overrides defaults in between.)
938
933
*
939
934
* Returns true if OK, false if trouble (in which case errorMessage is set
@@ -1055,15 +1050,15 @@ libpq_prng_init(PGconn *conn)
1055
1050
}
1056
1051
1057
1052
/*
1058
- * connectOptions2
1053
+ * pqConnectOptions2
1059
1054
*
1060
1055
* Compute derived connection options after absorbing all user-supplied info.
1061
1056
*
1062
1057
* Returns true if OK, false if trouble (in which case errorMessage is set
1063
1058
* and so is conn->status).
1064
1059
*/
1065
- static bool
1066
- connectOptions2 (PGconn * conn )
1060
+ bool
1061
+ pqConnectOptions2 (PGconn * conn )
1067
1062
{
1068
1063
int i ;
1069
1064
@@ -1822,7 +1817,7 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
1822
1817
* to initialize conn->errorMessage to empty. All subsequent steps during
1823
1818
* connection initialization will only append to that buffer.
1824
1819
*/
1825
- conn = makeEmptyPGconn ();
1820
+ conn = pqMakeEmptyPGconn ();
1826
1821
if (conn == NULL )
1827
1822
return NULL ;
1828
1823
@@ -1901,14 +1896,14 @@ PQsetdbLogin(const char *pghost, const char *pgport, const char *pgoptions,
1901
1896
/*
1902
1897
* Compute derived options
1903
1898
*/
1904
- if (!connectOptions2 (conn ))
1899
+ if (!pqConnectOptions2 (conn ))
1905
1900
return conn ;
1906
1901
1907
1902
/*
1908
1903
* Connect to the database
1909
1904
*/
1910
- if (connectDBStart (conn ))
1911
- (void ) connectDBComplete (conn );
1905
+ if (pqConnectDBStart (conn ))
1906
+ (void ) pqConnectDBComplete (conn );
1912
1907
1913
1908
return conn ;
1914
1909
@@ -2277,14 +2272,14 @@ setTCPUserTimeout(PGconn *conn)
2277
2272
}
2278
2273
2279
2274
/* ----------
2280
- * connectDBStart -
2275
+ * pqConnectDBStart -
2281
2276
* Begin the process of making a connection to the backend.
2282
2277
*
2283
2278
* Returns 1 if successful, 0 if not.
2284
2279
* ----------
2285
2280
*/
2286
- static int
2287
- connectDBStart (PGconn * conn )
2281
+ int
2282
+ pqConnectDBStart (PGconn * conn )
2288
2283
{
2289
2284
if (!conn )
2290
2285
return 0 ;
@@ -2347,14 +2342,14 @@ connectDBStart(PGconn *conn)
2347
2342
2348
2343
2349
2344
/*
2350
- * connectDBComplete
2345
+ * pqConnectDBComplete
2351
2346
*
2352
2347
* Block and complete a connection.
2353
2348
*
2354
2349
* Returns 1 on success, 0 on failure.
2355
2350
*/
2356
- static int
2357
- connectDBComplete (PGconn * conn )
2351
+ int
2352
+ pqConnectDBComplete (PGconn * conn )
2358
2353
{
2359
2354
PostgresPollingStatusType flag = PGRES_POLLING_WRITING ;
2360
2355
time_t finish_time = ((time_t ) - 1 );
@@ -2704,7 +2699,7 @@ PQconnectPoll(PGconn *conn)
2704
2699
* combining it with the insertion.
2705
2700
*
2706
2701
* We don't need to initialize conn->prng_state here, because that
2707
- * already happened in connectOptions2 .
2702
+ * already happened in pqConnectOptions2 .
2708
2703
*/
2709
2704
for (int i = 1 ; i < conn -> naddr ; i ++ )
2710
2705
{
@@ -4181,7 +4176,7 @@ internal_ping(PGconn *conn)
4181
4176
4182
4177
/* Attempt to complete the connection */
4183
4178
if (conn -> status != CONNECTION_BAD )
4184
- (void ) connectDBComplete (conn );
4179
+ (void ) pqConnectDBComplete (conn );
4185
4180
4186
4181
/* Definitely OK if we succeeded */
4187
4182
if (conn -> status != CONNECTION_BAD )
@@ -4233,11 +4228,11 @@ internal_ping(PGconn *conn)
4233
4228
4234
4229
4235
4230
/*
4236
- * makeEmptyPGconn
4231
+ * pqMakeEmptyPGconn
4237
4232
* - create a PGconn data structure with (as yet) no interesting data
4238
4233
*/
4239
- static PGconn *
4240
- makeEmptyPGconn (void )
4234
+ PGconn *
4235
+ pqMakeEmptyPGconn (void )
4241
4236
{
4242
4237
PGconn * conn ;
4243
4238
@@ -4330,7 +4325,7 @@ makeEmptyPGconn(void)
4330
4325
* freePGconn
4331
4326
* - free an idle (closed) PGconn data structure
4332
4327
*
4333
- * NOTE: this should not overlap any functionality with closePGconn ().
4328
+ * NOTE: this should not overlap any functionality with pqClosePGconn ().
4334
4329
* Clearing/resetting of transient state belongs there; what we do here is
4335
4330
* release data that is to be held for the life of the PGconn structure.
4336
4331
* If a value ought to be cleared/freed during PQreset(), do it there not here.
@@ -4517,15 +4512,15 @@ sendTerminateConn(PGconn *conn)
4517
4512
}
4518
4513
4519
4514
/*
4520
- * closePGconn
4515
+ * pqClosePGconn
4521
4516
* - properly close a connection to the backend
4522
4517
*
4523
4518
* This should reset or release all transient state, but NOT the connection
4524
4519
* parameters. On exit, the PGconn should be in condition to start a fresh
4525
4520
* connection with the same parameters (see PQreset()).
4526
4521
*/
4527
- static void
4528
- closePGconn (PGconn * conn )
4522
+ void
4523
+ pqClosePGconn (PGconn * conn )
4529
4524
{
4530
4525
/*
4531
4526
* If possible, send Terminate message to close the connection politely.
@@ -4568,7 +4563,7 @@ PQfinish(PGconn *conn)
4568
4563
{
4569
4564
if (conn )
4570
4565
{
4571
- closePGconn (conn );
4566
+ pqClosePGconn (conn );
4572
4567
freePGconn (conn );
4573
4568
}
4574
4569
}
@@ -4582,9 +4577,9 @@ PQreset(PGconn *conn)
4582
4577
{
4583
4578
if (conn )
4584
4579
{
4585
- closePGconn (conn );
4580
+ pqClosePGconn (conn );
4586
4581
4587
- if (connectDBStart (conn ) && connectDBComplete (conn ))
4582
+ if (pqConnectDBStart (conn ) && pqConnectDBComplete (conn ))
4588
4583
{
4589
4584
/*
4590
4585
* Notify event procs of successful reset.
@@ -4615,9 +4610,9 @@ PQresetStart(PGconn *conn)
4615
4610
{
4616
4611
if (conn )
4617
4612
{
4618
- closePGconn (conn );
4613
+ pqClosePGconn (conn );
4619
4614
4620
- return connectDBStart (conn );
4615
+ return pqConnectDBStart (conn );
4621
4616
}
4622
4617
4623
4618
return 0 ;
0 commit comments