@@ -651,7 +651,6 @@ conn_is_datestyle_ok(PGconn *pgconn)
651651RAISES_NEG int
652652conn_setup (connectionObject * self , PGconn * pgconn )
653653{
654- PGresult * pgres = NULL ;
655654 char * error = NULL ;
656655 int rv = -1 ;
657656
@@ -678,11 +677,10 @@ conn_setup(connectionObject *self, PGconn *pgconn)
678677 if (!dsn_has_replication (self -> dsn ) && !conn_is_datestyle_ok (self -> pgconn )) {
679678 int res ;
680679 Py_UNBLOCK_THREADS ;
681- res = pq_set_guc_locked (self , "datestyle" , "ISO" ,
682- & pgres , & error , & _save );
680+ res = pq_set_guc_locked (self , "datestyle" , "ISO" , & error , & _save );
683681 Py_BLOCK_THREADS ;
684682 if (res < 0 ) {
685- pq_complete_error (self , & pgres , & error );
683+ pq_complete_error (self , & error );
686684 goto unlock ;
687685 }
688686 }
@@ -1225,7 +1223,6 @@ conn_set_session(connectionObject *self, int autocommit,
12251223 int isolevel , int readonly , int deferrable )
12261224{
12271225 int rv = -1 ;
1228- PGresult * pgres = NULL ;
12291226 char * error = NULL ;
12301227 int want_autocommit = autocommit == SRV_STATE_UNCHANGED ?
12311228 self -> autocommit : autocommit ;
@@ -1256,21 +1253,21 @@ conn_set_session(connectionObject *self, int autocommit,
12561253 if (isolevel != SRV_STATE_UNCHANGED ) {
12571254 if (0 > pq_set_guc_locked (self ,
12581255 "default_transaction_isolation" , srv_isolevels [isolevel ],
1259- & pgres , & error , & _save )) {
1256+ & error , & _save )) {
12601257 goto endlock ;
12611258 }
12621259 }
12631260 if (readonly != SRV_STATE_UNCHANGED ) {
12641261 if (0 > pq_set_guc_locked (self ,
12651262 "default_transaction_read_only" , srv_state_guc [readonly ],
1266- & pgres , & error , & _save )) {
1263+ & error , & _save )) {
12671264 goto endlock ;
12681265 }
12691266 }
12701267 if (deferrable != SRV_STATE_UNCHANGED ) {
12711268 if (0 > pq_set_guc_locked (self ,
12721269 "default_transaction_deferrable" , srv_state_guc [deferrable ],
1273- & pgres , & error , & _save )) {
1270+ & error , & _save )) {
12741271 goto endlock ;
12751272 }
12761273 }
@@ -1281,21 +1278,21 @@ conn_set_session(connectionObject *self, int autocommit,
12811278 if (self -> isolevel != ISOLATION_LEVEL_DEFAULT ) {
12821279 if (0 > pq_set_guc_locked (self ,
12831280 "default_transaction_isolation" , "default" ,
1284- & pgres , & error , & _save )) {
1281+ & error , & _save )) {
12851282 goto endlock ;
12861283 }
12871284 }
12881285 if (self -> readonly != STATE_DEFAULT ) {
12891286 if (0 > pq_set_guc_locked (self ,
12901287 "default_transaction_read_only" , "default" ,
1291- & pgres , & error , & _save )) {
1288+ & error , & _save )) {
12921289 goto endlock ;
12931290 }
12941291 }
12951292 if (self -> server_version >= 90100 && self -> deferrable != STATE_DEFAULT ) {
12961293 if (0 > pq_set_guc_locked (self ,
12971294 "default_transaction_deferrable" , "default" ,
1298- & pgres , & error , & _save )) {
1295+ & error , & _save )) {
12991296 goto endlock ;
13001297 }
13011298 }
@@ -1320,7 +1317,7 @@ conn_set_session(connectionObject *self, int autocommit,
13201317 Py_END_ALLOW_THREADS ;
13211318
13221319 if (rv < 0 ) {
1323- pq_complete_error (self , & pgres , & error );
1320+ pq_complete_error (self , & error );
13241321 goto exit ;
13251322 }
13261323
@@ -1339,7 +1336,6 @@ conn_set_session(connectionObject *self, int autocommit,
13391336RAISES_NEG int
13401337conn_set_client_encoding (connectionObject * self , const char * pgenc )
13411338{
1342- PGresult * pgres = NULL ;
13431339 char * error = NULL ;
13441340 int res = -1 ;
13451341 char * clean_enc = NULL ;
@@ -1356,12 +1352,12 @@ conn_set_client_encoding(connectionObject *self, const char *pgenc)
13561352
13571353 /* abort the current transaction, to set the encoding ouside of
13581354 transactions */
1359- if ((res = pq_abort_locked (self , & pgres , & error , & _save ))) {
1355+ if ((res = pq_abort_locked (self , & error , & _save ))) {
13601356 goto endlock ;
13611357 }
13621358
13631359 if ((res = pq_set_guc_locked (self , "client_encoding" , clean_enc ,
1364- & pgres , & error , & _save ))) {
1360+ & error , & _save ))) {
13651361 goto endlock ;
13661362 }
13671363
@@ -1370,7 +1366,7 @@ conn_set_client_encoding(connectionObject *self, const char *pgenc)
13701366 Py_END_ALLOW_THREADS ;
13711367
13721368 if (res < 0 ) {
1373- pq_complete_error (self , & pgres , & error );
1369+ pq_complete_error (self , & error );
13741370 goto exit ;
13751371 }
13761372
@@ -1396,18 +1392,17 @@ conn_set_client_encoding(connectionObject *self, const char *pgenc)
13961392RAISES_NEG int
13971393conn_tpc_begin (connectionObject * self , xidObject * xid )
13981394{
1399- PGresult * pgres = NULL ;
14001395 char * error = NULL ;
14011396
14021397 Dprintf ("conn_tpc_begin: starting transaction" );
14031398
14041399 Py_BEGIN_ALLOW_THREADS ;
14051400 pthread_mutex_lock (& self -> lock );
14061401
1407- if (pq_begin_locked (self , & pgres , & error , & _save ) < 0 ) {
1402+ if (pq_begin_locked (self , & error , & _save ) < 0 ) {
14081403 pthread_mutex_unlock (& (self -> lock ));
14091404 Py_BLOCK_THREADS ;
1410- pq_complete_error (self , & pgres , & error );
1405+ pq_complete_error (self , & error );
14111406 return -1 ;
14121407 }
14131408
@@ -1430,7 +1425,6 @@ conn_tpc_begin(connectionObject *self, xidObject *xid)
14301425RAISES_NEG int
14311426conn_tpc_command (connectionObject * self , const char * cmd , xidObject * xid )
14321427{
1433- PGresult * pgres = NULL ;
14341428 char * error = NULL ;
14351429 PyObject * tid = NULL ;
14361430 const char * ctid ;
@@ -1446,10 +1440,10 @@ conn_tpc_command(connectionObject *self, const char *cmd, xidObject *xid)
14461440 pthread_mutex_lock (& self -> lock );
14471441
14481442 if (0 > (rv = pq_tpc_command_locked (self , cmd , ctid ,
1449- & pgres , & error , & _save ))) {
1443+ & error , & _save ))) {
14501444 pthread_mutex_unlock (& self -> lock );
14511445 Py_BLOCK_THREADS ;
1452- pq_complete_error (self , & pgres , & error );
1446+ pq_complete_error (self , & error );
14531447 goto exit ;
14541448 }
14551449
0 commit comments