@@ -259,13 +259,11 @@ ConnectionClass *rv;
259
259
rv -> pg_version_major = 0 ;
260
260
rv -> pg_version_minor = 0 ;
261
261
262
-
263
262
/* Initialize statement options to defaults */
264
263
/* Statements under this conn will inherit these options */
265
264
266
265
InitializeStatementOptions (& rv -> stmtOptions );
267
266
268
-
269
267
}
270
268
return rv ;
271
269
}
@@ -303,7 +301,6 @@ CC_Destructor(ConnectionClass *self)
303
301
free (self -> col_info );
304
302
}
305
303
306
-
307
304
free (self );
308
305
309
306
mylog ("exit CC_Destructor\n" );
@@ -396,11 +393,8 @@ StatementClass *stmt;
396
393
for (i = 0 ; i < self -> num_stmts ; i ++ ) {
397
394
stmt = self -> stmts [i ];
398
395
if (stmt ) {
399
-
400
396
stmt -> hdbc = NULL ; /* prevent any more dbase interactions */
401
-
402
397
SC_Destructor (stmt );
403
-
404
398
self -> stmts [i ] = NULL ;
405
399
}
406
400
}
461
455
CC_connect (ConnectionClass * self , char do_password )
462
456
{
463
457
StartupPacket sp ;
464
- StartupPacket6_2 sp62 ;
465
458
QResultClass * res ;
466
459
SocketClass * sock ;
467
460
ConnInfo * ci = & (self -> connInfo );
@@ -538,36 +531,20 @@ static char *func="CC_connect";
538
531
}
539
532
mylog ("connection to the server socket succeeded.\n" );
540
533
541
- if ( PROTOCOL_62 (ci )) {
542
- sock -> reverse = TRUE; /* make put_int and get_int work for 6.2 */
534
+ memset (& sp , 0 , sizeof (StartupPacket ));
543
535
544
- memset (& sp62 , 0 , sizeof (StartupPacket6_2 ));
545
- SOCK_put_int (sock , htonl (4 + sizeof (StartupPacket6_2 )), 4 );
546
- sp62 .authtype = htonl (NO_AUTHENTICATION );
547
- strncpy (sp62 .database , ci -> database , PATH_SIZE );
548
- strncpy (sp62 .user , ci -> username , NAMEDATALEN );
549
- SOCK_put_n_char (sock , (char * ) & sp62 , sizeof (StartupPacket6_2 ));
550
- SOCK_flush_output (sock );
551
- }
552
- else {
553
- memset (& sp , 0 , sizeof (StartupPacket ));
536
+ mylog ("sizeof startup packet = %d\n" , sizeof (StartupPacket ));
554
537
555
- mylog ("sizeof startup packet = %d\n" , sizeof (StartupPacket ));
538
+ /* Send length of Authentication Block */
539
+ SOCK_put_int (sock , 4 + sizeof (StartupPacket ), 4 );
556
540
557
- /* Send length of Authentication Block */
558
- SOCK_put_int (sock , 4 + sizeof (StartupPacket ), 4 );
541
+ sp .protoVersion = (ProtocolVersion ) htonl (PG_PROTOCOL_LATEST );
559
542
560
- if ( PROTOCOL_63 (ci ))
561
- sp .protoVersion = (ProtocolVersion ) htonl (PG_PROTOCOL_63 );
562
- else
563
- sp .protoVersion = (ProtocolVersion ) htonl (PG_PROTOCOL_LATEST );
543
+ strncpy (sp .database , ci -> database , SM_DATABASE );
544
+ strncpy (sp .user , ci -> username , SM_USER );
564
545
565
- strncpy (sp .database , ci -> database , SM_DATABASE );
566
- strncpy (sp .user , ci -> username , SM_USER );
567
-
568
- SOCK_put_n_char (sock , (char * ) & sp , sizeof (StartupPacket ));
569
- SOCK_flush_output (sock );
570
- }
546
+ SOCK_put_n_char (sock , (char * ) & sp , sizeof (StartupPacket ));
547
+ SOCK_flush_output (sock );
571
548
572
549
mylog ("sent the authentication block.\n" );
573
550
@@ -580,15 +557,14 @@ static char *func="CC_connect";
580
557
mylog ("sent the authentication block successfully.\n" );
581
558
}
582
559
583
-
584
560
mylog ("gonna do authentication\n" );
585
561
586
562
587
563
/* *************************************************** */
588
564
/* Now get the authentication request from backend */
589
565
/* *************************************************** */
590
566
591
- if ( ! PROTOCOL_62 ( ci )) do {
567
+ do {
592
568
593
569
if (do_password )
594
570
beresp = 'R' ;
@@ -671,7 +647,6 @@ static char *func="CC_connect";
671
647
672
648
} while (areq != AUTH_REQ_OK );
673
649
674
-
675
650
CC_clear_error (self ); /* clear any password error */
676
651
677
652
/* send an empty query in order to find out whether the specified */
@@ -929,7 +904,6 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont
929
904
until an 'I' is received
930
905
*/
931
906
932
-
933
907
SOCK_put_string (sock , "Q " );
934
908
SOCK_flush_output (sock );
935
909
@@ -1115,7 +1089,6 @@ int i;
1115
1089
SOCK_put_int (sock , fnid , 4 );
1116
1090
SOCK_put_int (sock , nargs , 4 );
1117
1091
1118
-
1119
1092
mylog ("send_function: done sending function\n" );
1120
1093
1121
1094
for (i = 0 ; i < nargs ; ++ i ) {
@@ -1127,8 +1100,6 @@ int i;
1127
1100
SOCK_put_int (sock , args [i ].u .integer , 4 );
1128
1101
else
1129
1102
SOCK_put_n_char (sock , (char * ) args [i ].u .ptr , args [i ].len );
1130
-
1131
-
1132
1103
}
1133
1104
1134
1105
mylog (" done sending args\n" );
@@ -1378,19 +1349,9 @@ void
1378
1349
CC_initialize_pg_version (ConnectionClass * self )
1379
1350
{
1380
1351
strcpy (self -> pg_version , self -> connInfo .protocol );
1381
- if (PROTOCOL_62 (& self -> connInfo )) {
1382
- self -> pg_version_number = (float ) 6.2 ;
1383
- self -> pg_version_major = 6 ;
1384
- self -> pg_version_minor = 2 ;
1385
- } else if (PROTOCOL_63 (& self -> connInfo )) {
1386
- self -> pg_version_number = (float ) 6.3 ;
1387
- self -> pg_version_major = 6 ;
1388
- self -> pg_version_minor = 3 ;
1389
- } else {
1390
- self -> pg_version_number = (float ) 6.4 ;
1391
- self -> pg_version_major = 6 ;
1392
- self -> pg_version_minor = 4 ;
1393
- }
1352
+ self -> pg_version_number = (float ) 6.4 ;
1353
+ self -> pg_version_major = 6 ;
1354
+ self -> pg_version_minor = 4 ;
1394
1355
}
1395
1356
/* This function gets the version of PostgreSQL that we're connected to.
1396
1357
This is used to return the correct info in SQLGetInfo
0 commit comments