Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit895a57b

Browse files
committed
Cleanup
1 parentd2331b4 commit895a57b

File tree

6 files changed

+20
-98
lines changed

6 files changed

+20
-98
lines changed

‎src/interfaces/odbc/connection.c

Lines changed: 13 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,11 @@ ConnectionClass *rv;
259259
rv->pg_version_major=0;
260260
rv->pg_version_minor=0;
261261

262-
263262
/*Initialize statement options to defaults */
264263
/*Statements under this conn will inherit these options */
265264

266265
InitializeStatementOptions(&rv->stmtOptions);
267266

268-
269267
}
270268
returnrv;
271269
}
@@ -303,7 +301,6 @@ CC_Destructor(ConnectionClass *self)
303301
free(self->col_info);
304302
}
305303

306-
307304
free(self);
308305

309306
mylog("exit CC_Destructor\n");
@@ -396,11 +393,8 @@ StatementClass *stmt;
396393
for (i=0;i<self->num_stmts;i++) {
397394
stmt=self->stmts[i];
398395
if (stmt) {
399-
400396
stmt->hdbc=NULL;/* prevent any more dbase interactions */
401-
402397
SC_Destructor(stmt);
403-
404398
self->stmts[i]=NULL;
405399
}
406400
}
@@ -461,7 +455,6 @@ char
461455
CC_connect(ConnectionClass*self,chardo_password)
462456
{
463457
StartupPacketsp;
464-
StartupPacket6_2sp62;
465458
QResultClass*res;
466459
SocketClass*sock;
467460
ConnInfo*ci=&(self->connInfo);
@@ -538,36 +531,20 @@ static char *func="CC_connect";
538531
}
539532
mylog("connection to the server socket succeeded.\n");
540533

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));
543535

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));
554537

555-
mylog("sizeof startup packet = %d\n",sizeof(StartupPacket));
538+
/* Send length of Authentication Block */
539+
SOCK_put_int(sock,4+sizeof(StartupPacket),4);
556540

557-
/* Send length of Authentication Block */
558-
SOCK_put_int(sock,4+sizeof(StartupPacket),4);
541+
sp.protoVersion= (ProtocolVersion)htonl(PG_PROTOCOL_LATEST);
559542

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);
564545

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);
571548

572549
mylog("sent the authentication block.\n");
573550

@@ -580,15 +557,14 @@ static char *func="CC_connect";
580557
mylog("sent the authentication block successfully.\n");
581558
}
582559

583-
584560
mylog("gonna do authentication\n");
585561

586562

587563
/* *************************************************** */
588564
/*Now get the authentication request from backend */
589565
/* *************************************************** */
590566

591-
if ( !PROTOCOL_62(ci))do {
567+
do {
592568

593569
if (do_password)
594570
beresp='R';
@@ -671,7 +647,6 @@ static char *func="CC_connect";
671647

672648
}while (areq!=AUTH_REQ_OK);
673649

674-
675650
CC_clear_error(self);/* clear any password error */
676651

677652
/* 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
929904
until an 'I' is received
930905
*/
931906

932-
933907
SOCK_put_string(sock,"Q ");
934908
SOCK_flush_output(sock);
935909

@@ -1115,7 +1089,6 @@ int i;
11151089
SOCK_put_int(sock,fnid,4);
11161090
SOCK_put_int(sock,nargs,4);
11171091

1118-
11191092
mylog("send_function: done sending function\n");
11201093

11211094
for (i=0;i<nargs;++i) {
@@ -1127,8 +1100,6 @@ int i;
11271100
SOCK_put_int(sock,args[i].u.integer,4);
11281101
else
11291102
SOCK_put_n_char(sock, (char*)args[i].u.ptr,args[i].len);
1130-
1131-
11321103
}
11331104

11341105
mylog(" done sending args\n");
@@ -1378,19 +1349,9 @@ void
13781349
CC_initialize_pg_version(ConnectionClass*self)
13791350
{
13801351
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-
}elseif (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;
13941355
}
13951356
/*This function gets the version of PostgreSQL that we're connected to.
13961357
This is used to return the correct info in SQLGetInfo

‎src/interfaces/odbc/connection.h

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ typedef unsigned int ProtocolVersion;
106106

107107
#definePG_PROTOCOL(major,minor)(((major) << 16) | (minor))
108108
#definePG_PROTOCOL_LATESTPG_PROTOCOL(2, 0)
109-
#definePG_PROTOCOL_63PG_PROTOCOL(1, 0)
110-
#definePG_PROTOCOL_62PG_PROTOCOL(0, 0)
111109

112-
/*This startup packet is to support latest Postgres protocol(6.4, 6.3)*/
110+
/*This startup packet is to support latest Postgres protocol */
113111
typedefstruct_StartupPacket
114112
{
115113
ProtocolVersionprotoVersion;
@@ -121,18 +119,6 @@ typedef struct _StartupPacket
121119
}StartupPacket;
122120

123121

124-
/*This startup packet is to support pre-Postgres 6.3 protocol */
125-
typedefstruct_StartupPacket6_2
126-
{
127-
unsignedintauthtype;
128-
chardatabase[PATH_SIZE];
129-
charuser[NAMEDATALEN];
130-
charoptions[ARGV_SIZE];
131-
charexecfile[ARGV_SIZE];
132-
chartty[PATH_SIZE];
133-
}StartupPacket6_2;
134-
135-
136122
/*Structure to hold all the connection attributes for a specific
137123
connection (used for both registry and file, DSN and DRIVER)
138124
*/
@@ -157,12 +143,6 @@ typedef struct {
157143
charfocus_password;
158144
}ConnInfo;
159145

160-
/*Macro to determine is the connection using 6.2 protocol? */
161-
#definePROTOCOL_62(conninfo_)(strncmp((conninfo_)->protocol, PG62, strlen(PG62)) == 0)
162-
163-
/*Macro to determine is the connection using 6.3 protocol? */
164-
#definePROTOCOL_63(conninfo_)(strncmp((conninfo_)->protocol, PG63, strlen(PG63)) == 0)
165-
166146
/*
167147
*Macros to compare the server's version with a specified version
168148
*1st parameter: pointer to a ConnectionClass object

‎src/interfaces/odbc/dlg_specific.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,7 @@ char buf[128];
243243
CheckDlgButton(hdlg,DS_READONLY,atoi(ci->onlyread));
244244

245245
/*Protocol */
246-
if (strncmp(ci->protocol,PG62,strlen(PG62))==0)
247-
CheckDlgButton(hdlg,DS_PG62,1);
248-
elseif (strncmp(ci->protocol,PG63,strlen(PG63))==0)
249-
CheckDlgButton(hdlg,DS_PG63,1);
250-
else/* latest */
251-
CheckDlgButton(hdlg,DS_PG64,1);
246+
CheckDlgButton(hdlg,DS_PG64,1);
252247

253248

254249

@@ -281,12 +276,7 @@ char buf[128];
281276
sprintf(ci->onlyread,"%d",IsDlgButtonChecked(hdlg,DS_READONLY));
282277

283278
/*Protocol */
284-
if (IsDlgButtonChecked(hdlg,DS_PG62))
285-
strcpy(ci->protocol,PG62);
286-
elseif (IsDlgButtonChecked(hdlg,DS_PG63))
287-
strcpy(ci->protocol,PG63);
288-
else/* latest */
289-
strcpy(ci->protocol,PG64);
279+
strcpy(ci->protocol,PG64);
290280

291281
sprintf(ci->show_system_tables,"%d",IsDlgButtonChecked(hdlg,DS_SHOWSYSTEMTABLES));
292282

‎src/interfaces/odbc/psqlodbc.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Comments: See "notice.txt" for copyright and license information.
88
*
9-
* $Id: psqlodbc.h,v 1.30 2001/02/06 02:21:12 inoue Exp $
9+
* $Id: psqlodbc.h,v 1.31 2001/02/10 06:57:53 momjian Exp $
1010
*/
1111

1212
#ifndef__PSQLODBC_H__
@@ -91,8 +91,6 @@ typedef UInt4 Oid;
9191
/* Now that's 0, lets use this instead. DJP 24-1-2001 */
9292
#defineSTD_STATEMENT_LENMAX_MESSAGE_LEN
9393

94-
#definePG62"6.2"/* "Protocol" key setting to force Postgres 6.2 */
95-
#definePG63"6.3"/* "Protocol" key setting to force postgres 6.3 */
9694
#definePG64"6.4"
9795

9896
typedefstructConnectionClass_ConnectionClass;
@@ -132,8 +130,10 @@ typedef struct GlobalValues_
132130
charcancel_as_freestmt;
133131
charextra_systable_prefixes[MEDIUM_REGISTRY_LEN];
134132
charconn_settings[LARGE_REGISTRY_LEN];
133+
/* Protocol is not used anymore, but kept in case
134+
* it is useful in the future. bjm 2001-02-10
135+
*/
135136
charprotocol[SMALL_REGISTRY_LEN];
136-
137137
FILE*mylogFP;
138138
FILE*qlogFP;
139139
}GLOBAL_VALUES;

‎src/interfaces/odbc/resource.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#defineDS_SHOWOIDCOLUMN 1012
2020
#defineDS_FAKEOIDINDEX 1013
2121
#defineDRV_COMMLOG 1014
22-
#defineDS_PG62 1016
2322
#defineIDC_DATASOURCE 1018
2423
#defineDRV_OPTIMIZER 1019
2524
#defineDS_CONNSETTINGS 1020
@@ -48,7 +47,6 @@
4847
#defineIDC_OPTIONS 1054
4948
#defineDRV_KSQO 1055
5049
#defineDS_PG64 1057
51-
#defineDS_PG63 1058
5250

5351
/* Next default values for new objects */
5452

‎src/interfaces/odbc/statement.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -789,8 +789,6 @@ QueryInfo qi;
789789
CC_set_in_trans(conn);
790790
}
791791

792-
793-
794792
oldstatus=conn->status;
795793
conn->status=CONN_EXECUTING;
796794
self->status=STMT_EXECUTING;
@@ -829,11 +827,7 @@ QueryInfo qi;
829827

830828
self->result=CC_send_query(conn,fetch,&qi);
831829
}
832-
833830
mylog(" done sending the query:\n");
834-
835-
836-
837831
}
838832
else {/* not a SELECT statement so don't use a cursor */
839833
mylog(" it's NOT a select statement: stmt=%u\n",self);
@@ -850,7 +844,6 @@ QueryInfo qi;
850844
QR_Destructor(res);
851845
CC_set_no_trans(conn);
852846
}
853-
854847
}
855848

856849
conn->status=oldstatus;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp