Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
895a57bd
Commit
895a57bd
authored
Feb 10, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
d2331b4e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
98 deletions
+20
-98
src/interfaces/odbc/connection.c
src/interfaces/odbc/connection.c
+13
-52
src/interfaces/odbc/connection.h
src/interfaces/odbc/connection.h
+1
-21
src/interfaces/odbc/dlg_specific.c
src/interfaces/odbc/dlg_specific.c
+2
-12
src/interfaces/odbc/psqlodbc.h
src/interfaces/odbc/psqlodbc.h
+4
-4
src/interfaces/odbc/resource.h
src/interfaces/odbc/resource.h
+0
-2
src/interfaces/odbc/statement.c
src/interfaces/odbc/statement.c
+0
-7
No files found.
src/interfaces/odbc/connection.c
View file @
895a57bd
...
@@ -259,13 +259,11 @@ ConnectionClass *rv;
...
@@ -259,13 +259,11 @@ ConnectionClass *rv;
rv
->
pg_version_major
=
0
;
rv
->
pg_version_major
=
0
;
rv
->
pg_version_minor
=
0
;
rv
->
pg_version_minor
=
0
;
/* Initialize statement options to defaults */
/* Initialize statement options to defaults */
/* Statements under this conn will inherit these options */
/* Statements under this conn will inherit these options */
InitializeStatementOptions
(
&
rv
->
stmtOptions
);
InitializeStatementOptions
(
&
rv
->
stmtOptions
);
}
}
return
rv
;
return
rv
;
}
}
...
@@ -303,7 +301,6 @@ CC_Destructor(ConnectionClass *self)
...
@@ -303,7 +301,6 @@ CC_Destructor(ConnectionClass *self)
free
(
self
->
col_info
);
free
(
self
->
col_info
);
}
}
free
(
self
);
free
(
self
);
mylog
(
"exit CC_Destructor
\n
"
);
mylog
(
"exit CC_Destructor
\n
"
);
...
@@ -396,11 +393,8 @@ StatementClass *stmt;
...
@@ -396,11 +393,8 @@ StatementClass *stmt;
for
(
i
=
0
;
i
<
self
->
num_stmts
;
i
++
)
{
for
(
i
=
0
;
i
<
self
->
num_stmts
;
i
++
)
{
stmt
=
self
->
stmts
[
i
];
stmt
=
self
->
stmts
[
i
];
if
(
stmt
)
{
if
(
stmt
)
{
stmt
->
hdbc
=
NULL
;
/* prevent any more dbase interactions */
stmt
->
hdbc
=
NULL
;
/* prevent any more dbase interactions */
SC_Destructor
(
stmt
);
SC_Destructor
(
stmt
);
self
->
stmts
[
i
]
=
NULL
;
self
->
stmts
[
i
]
=
NULL
;
}
}
}
}
...
@@ -461,7 +455,6 @@ char
...
@@ -461,7 +455,6 @@ char
CC_connect
(
ConnectionClass
*
self
,
char
do_password
)
CC_connect
(
ConnectionClass
*
self
,
char
do_password
)
{
{
StartupPacket
sp
;
StartupPacket
sp
;
StartupPacket6_2
sp62
;
QResultClass
*
res
;
QResultClass
*
res
;
SocketClass
*
sock
;
SocketClass
*
sock
;
ConnInfo
*
ci
=
&
(
self
->
connInfo
);
ConnInfo
*
ci
=
&
(
self
->
connInfo
);
...
@@ -538,18 +531,6 @@ static char *func="CC_connect";
...
@@ -538,18 +531,6 @@ static char *func="CC_connect";
}
}
mylog
(
"connection to the server socket succeeded.
\n
"
);
mylog
(
"connection to the server socket succeeded.
\n
"
);
if
(
PROTOCOL_62
(
ci
))
{
sock
->
reverse
=
TRUE
;
/* make put_int and get_int work for 6.2 */
memset
(
&
sp62
,
0
,
sizeof
(
StartupPacket6_2
));
SOCK_put_int
(
sock
,
htonl
(
4
+
sizeof
(
StartupPacket6_2
)),
4
);
sp62
.
authtype
=
htonl
(
NO_AUTHENTICATION
);
strncpy
(
sp62
.
database
,
ci
->
database
,
PATH_SIZE
);
strncpy
(
sp62
.
user
,
ci
->
username
,
NAMEDATALEN
);
SOCK_put_n_char
(
sock
,
(
char
*
)
&
sp62
,
sizeof
(
StartupPacket6_2
));
SOCK_flush_output
(
sock
);
}
else
{
memset
(
&
sp
,
0
,
sizeof
(
StartupPacket
));
memset
(
&
sp
,
0
,
sizeof
(
StartupPacket
));
mylog
(
"sizeof startup packet = %d
\n
"
,
sizeof
(
StartupPacket
));
mylog
(
"sizeof startup packet = %d
\n
"
,
sizeof
(
StartupPacket
));
...
@@ -557,9 +538,6 @@ static char *func="CC_connect";
...
@@ -557,9 +538,6 @@ static char *func="CC_connect";
/* Send length of Authentication Block */
/* Send length of Authentication Block */
SOCK_put_int
(
sock
,
4
+
sizeof
(
StartupPacket
),
4
);
SOCK_put_int
(
sock
,
4
+
sizeof
(
StartupPacket
),
4
);
if
(
PROTOCOL_63
(
ci
))
sp
.
protoVersion
=
(
ProtocolVersion
)
htonl
(
PG_PROTOCOL_63
);
else
sp
.
protoVersion
=
(
ProtocolVersion
)
htonl
(
PG_PROTOCOL_LATEST
);
sp
.
protoVersion
=
(
ProtocolVersion
)
htonl
(
PG_PROTOCOL_LATEST
);
strncpy
(
sp
.
database
,
ci
->
database
,
SM_DATABASE
);
strncpy
(
sp
.
database
,
ci
->
database
,
SM_DATABASE
);
...
@@ -567,7 +545,6 @@ static char *func="CC_connect";
...
@@ -567,7 +545,6 @@ static char *func="CC_connect";
SOCK_put_n_char
(
sock
,
(
char
*
)
&
sp
,
sizeof
(
StartupPacket
));
SOCK_put_n_char
(
sock
,
(
char
*
)
&
sp
,
sizeof
(
StartupPacket
));
SOCK_flush_output
(
sock
);
SOCK_flush_output
(
sock
);
}
mylog
(
"sent the authentication block.
\n
"
);
mylog
(
"sent the authentication block.
\n
"
);
...
@@ -580,7 +557,6 @@ static char *func="CC_connect";
...
@@ -580,7 +557,6 @@ static char *func="CC_connect";
mylog
(
"sent the authentication block successfully.
\n
"
);
mylog
(
"sent the authentication block successfully.
\n
"
);
}
}
mylog
(
"gonna do authentication
\n
"
);
mylog
(
"gonna do authentication
\n
"
);
...
@@ -588,7 +564,7 @@ static char *func="CC_connect";
...
@@ -588,7 +564,7 @@ static char *func="CC_connect";
/* Now get the authentication request from backend */
/* Now get the authentication request from backend */
/* *************************************************** */
/* *************************************************** */
if
(
!
PROTOCOL_62
(
ci
))
do
{
do
{
if
(
do_password
)
if
(
do_password
)
beresp
=
'R'
;
beresp
=
'R'
;
...
@@ -671,7 +647,6 @@ static char *func="CC_connect";
...
@@ -671,7 +647,6 @@ static char *func="CC_connect";
}
while
(
areq
!=
AUTH_REQ_OK
);
}
while
(
areq
!=
AUTH_REQ_OK
);
CC_clear_error
(
self
);
/* clear any password error */
CC_clear_error
(
self
);
/* clear any password error */
/* send an empty query in order to find out whether the specified */
/* 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,7 +904,6 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; /* QR_set_command() dups this string so dont
until an 'I' is received
until an 'I' is received
*/
*/
SOCK_put_string
(
sock
,
"Q "
);
SOCK_put_string
(
sock
,
"Q "
);
SOCK_flush_output
(
sock
);
SOCK_flush_output
(
sock
);
...
@@ -1115,7 +1089,6 @@ int i;
...
@@ -1115,7 +1089,6 @@ int i;
SOCK_put_int
(
sock
,
fnid
,
4
);
SOCK_put_int
(
sock
,
fnid
,
4
);
SOCK_put_int
(
sock
,
nargs
,
4
);
SOCK_put_int
(
sock
,
nargs
,
4
);
mylog
(
"send_function: done sending function
\n
"
);
mylog
(
"send_function: done sending function
\n
"
);
for
(
i
=
0
;
i
<
nargs
;
++
i
)
{
for
(
i
=
0
;
i
<
nargs
;
++
i
)
{
...
@@ -1127,8 +1100,6 @@ int i;
...
@@ -1127,8 +1100,6 @@ int i;
SOCK_put_int
(
sock
,
args
[
i
].
u
.
integer
,
4
);
SOCK_put_int
(
sock
,
args
[
i
].
u
.
integer
,
4
);
else
else
SOCK_put_n_char
(
sock
,
(
char
*
)
args
[
i
].
u
.
ptr
,
args
[
i
].
len
);
SOCK_put_n_char
(
sock
,
(
char
*
)
args
[
i
].
u
.
ptr
,
args
[
i
].
len
);
}
}
mylog
(
" done sending args
\n
"
);
mylog
(
" done sending args
\n
"
);
...
@@ -1378,19 +1349,9 @@ void
...
@@ -1378,19 +1349,9 @@ void
CC_initialize_pg_version
(
ConnectionClass
*
self
)
CC_initialize_pg_version
(
ConnectionClass
*
self
)
{
{
strcpy
(
self
->
pg_version
,
self
->
connInfo
.
protocol
);
strcpy
(
self
->
pg_version
,
self
->
connInfo
.
protocol
);
if
(
PROTOCOL_62
(
&
self
->
connInfo
))
{
self
->
pg_version_number
=
(
float
)
6
.
2
;
self
->
pg_version_major
=
6
;
self
->
pg_version_minor
=
2
;
}
else
if
(
PROTOCOL_63
(
&
self
->
connInfo
))
{
self
->
pg_version_number
=
(
float
)
6
.
3
;
self
->
pg_version_major
=
6
;
self
->
pg_version_minor
=
3
;
}
else
{
self
->
pg_version_number
=
(
float
)
6
.
4
;
self
->
pg_version_number
=
(
float
)
6
.
4
;
self
->
pg_version_major
=
6
;
self
->
pg_version_major
=
6
;
self
->
pg_version_minor
=
4
;
self
->
pg_version_minor
=
4
;
}
}
}
/* This function gets the version of PostgreSQL that we're connected to.
/* This function gets the version of PostgreSQL that we're connected to.
This is used to return the correct info in SQLGetInfo
This is used to return the correct info in SQLGetInfo
...
...
src/interfaces/odbc/connection.h
View file @
895a57bd
...
@@ -106,10 +106,8 @@ typedef unsigned int ProtocolVersion;
...
@@ -106,10 +106,8 @@ typedef unsigned int ProtocolVersion;
#define PG_PROTOCOL(major, minor) (((major) << 16) | (minor))
#define PG_PROTOCOL(major, minor) (((major) << 16) | (minor))
#define PG_PROTOCOL_LATEST PG_PROTOCOL(2, 0)
#define PG_PROTOCOL_LATEST PG_PROTOCOL(2, 0)
#define PG_PROTOCOL_63 PG_PROTOCOL(1, 0)
#define PG_PROTOCOL_62 PG_PROTOCOL(0, 0)
/* This startup packet is to support latest Postgres protocol
(6.4, 6.3)
*/
/* This startup packet is to support latest Postgres protocol */
typedef
struct
_StartupPacket
typedef
struct
_StartupPacket
{
{
ProtocolVersion
protoVersion
;
ProtocolVersion
protoVersion
;
...
@@ -121,18 +119,6 @@ typedef struct _StartupPacket
...
@@ -121,18 +119,6 @@ typedef struct _StartupPacket
}
StartupPacket
;
}
StartupPacket
;
/* This startup packet is to support pre-Postgres 6.3 protocol */
typedef
struct
_StartupPacket6_2
{
unsigned
int
authtype
;
char
database
[
PATH_SIZE
];
char
user
[
NAMEDATALEN
];
char
options
[
ARGV_SIZE
];
char
execfile
[
ARGV_SIZE
];
char
tty
[
PATH_SIZE
];
}
StartupPacket6_2
;
/* Structure to hold all the connection attributes for a specific
/* Structure to hold all the connection attributes for a specific
connection (used for both registry and file, DSN and DRIVER)
connection (used for both registry and file, DSN and DRIVER)
*/
*/
...
@@ -157,12 +143,6 @@ typedef struct {
...
@@ -157,12 +143,6 @@ typedef struct {
char
focus_password
;
char
focus_password
;
}
ConnInfo
;
}
ConnInfo
;
/* Macro to determine is the connection using 6.2 protocol? */
#define PROTOCOL_62(conninfo_) (strncmp((conninfo_)->protocol, PG62, strlen(PG62)) == 0)
/* Macro to determine is the connection using 6.3 protocol? */
#define PROTOCOL_63(conninfo_) (strncmp((conninfo_)->protocol, PG63, strlen(PG63)) == 0)
/*
/*
* Macros to compare the server's version with a specified version
* Macros to compare the server's version with a specified version
* 1st parameter: pointer to a ConnectionClass object
* 1st parameter: pointer to a ConnectionClass object
...
...
src/interfaces/odbc/dlg_specific.c
View file @
895a57bd
...
@@ -243,11 +243,6 @@ char buf[128];
...
@@ -243,11 +243,6 @@ char buf[128];
CheckDlgButton
(
hdlg
,
DS_READONLY
,
atoi
(
ci
->
onlyread
));
CheckDlgButton
(
hdlg
,
DS_READONLY
,
atoi
(
ci
->
onlyread
));
/* Protocol */
/* Protocol */
if
(
strncmp
(
ci
->
protocol
,
PG62
,
strlen
(
PG62
))
==
0
)
CheckDlgButton
(
hdlg
,
DS_PG62
,
1
);
else
if
(
strncmp
(
ci
->
protocol
,
PG63
,
strlen
(
PG63
))
==
0
)
CheckDlgButton
(
hdlg
,
DS_PG63
,
1
);
else
/* latest */
CheckDlgButton
(
hdlg
,
DS_PG64
,
1
);
CheckDlgButton
(
hdlg
,
DS_PG64
,
1
);
...
@@ -281,11 +276,6 @@ char buf[128];
...
@@ -281,11 +276,6 @@ char buf[128];
sprintf
(
ci
->
onlyread
,
"%d"
,
IsDlgButtonChecked
(
hdlg
,
DS_READONLY
));
sprintf
(
ci
->
onlyread
,
"%d"
,
IsDlgButtonChecked
(
hdlg
,
DS_READONLY
));
/* Protocol */
/* Protocol */
if
(
IsDlgButtonChecked
(
hdlg
,
DS_PG62
))
strcpy
(
ci
->
protocol
,
PG62
);
else
if
(
IsDlgButtonChecked
(
hdlg
,
DS_PG63
))
strcpy
(
ci
->
protocol
,
PG63
);
else
/* latest */
strcpy
(
ci
->
protocol
,
PG64
);
strcpy
(
ci
->
protocol
,
PG64
);
sprintf
(
ci
->
show_system_tables
,
"%d"
,
IsDlgButtonChecked
(
hdlg
,
DS_SHOWSYSTEMTABLES
));
sprintf
(
ci
->
show_system_tables
,
"%d"
,
IsDlgButtonChecked
(
hdlg
,
DS_SHOWSYSTEMTABLES
));
...
...
src/interfaces/odbc/psqlodbc.h
View file @
895a57bd
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Comments: See "notice.txt" for copyright and license information.
* Comments: See "notice.txt" for copyright and license information.
*
*
* $Id: psqlodbc.h,v 1.3
0 2001/02/06 02:21:12 inoue
Exp $
* $Id: psqlodbc.h,v 1.3
1 2001/02/10 06:57:53 momjian
Exp $
*/
*/
#ifndef __PSQLODBC_H__
#ifndef __PSQLODBC_H__
...
@@ -91,8 +91,6 @@ typedef UInt4 Oid;
...
@@ -91,8 +91,6 @@ typedef UInt4 Oid;
/* Now that's 0, lets use this instead. DJP 24-1-2001 */
/* Now that's 0, lets use this instead. DJP 24-1-2001 */
#define STD_STATEMENT_LEN MAX_MESSAGE_LEN
#define STD_STATEMENT_LEN MAX_MESSAGE_LEN
#define PG62 "6.2"
/* "Protocol" key setting to force Postgres 6.2 */
#define PG63 "6.3"
/* "Protocol" key setting to force postgres 6.3 */
#define PG64 "6.4"
#define PG64 "6.4"
typedef
struct
ConnectionClass_
ConnectionClass
;
typedef
struct
ConnectionClass_
ConnectionClass
;
...
@@ -132,8 +130,10 @@ typedef struct GlobalValues_
...
@@ -132,8 +130,10 @@ typedef struct GlobalValues_
char
cancel_as_freestmt
;
char
cancel_as_freestmt
;
char
extra_systable_prefixes
[
MEDIUM_REGISTRY_LEN
];
char
extra_systable_prefixes
[
MEDIUM_REGISTRY_LEN
];
char
conn_settings
[
LARGE_REGISTRY_LEN
];
char
conn_settings
[
LARGE_REGISTRY_LEN
];
/* Protocol is not used anymore, but kept in case
* it is useful in the future. bjm 2001-02-10
*/
char
protocol
[
SMALL_REGISTRY_LEN
];
char
protocol
[
SMALL_REGISTRY_LEN
];
FILE
*
mylogFP
;
FILE
*
mylogFP
;
FILE
*
qlogFP
;
FILE
*
qlogFP
;
}
GLOBAL_VALUES
;
}
GLOBAL_VALUES
;
...
...
src/interfaces/odbc/resource.h
View file @
895a57bd
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
#define DS_SHOWOIDCOLUMN 1012
#define DS_SHOWOIDCOLUMN 1012
#define DS_FAKEOIDINDEX 1013
#define DS_FAKEOIDINDEX 1013
#define DRV_COMMLOG 1014
#define DRV_COMMLOG 1014
#define DS_PG62 1016
#define IDC_DATASOURCE 1018
#define IDC_DATASOURCE 1018
#define DRV_OPTIMIZER 1019
#define DRV_OPTIMIZER 1019
#define DS_CONNSETTINGS 1020
#define DS_CONNSETTINGS 1020
...
@@ -48,7 +47,6 @@
...
@@ -48,7 +47,6 @@
#define IDC_OPTIONS 1054
#define IDC_OPTIONS 1054
#define DRV_KSQO 1055
#define DRV_KSQO 1055
#define DS_PG64 1057
#define DS_PG64 1057
#define DS_PG63 1058
/* Next default values for new objects */
/* Next default values for new objects */
...
...
src/interfaces/odbc/statement.c
View file @
895a57bd
...
@@ -789,8 +789,6 @@ QueryInfo qi;
...
@@ -789,8 +789,6 @@ QueryInfo qi;
CC_set_in_trans
(
conn
);
CC_set_in_trans
(
conn
);
}
}
oldstatus
=
conn
->
status
;
oldstatus
=
conn
->
status
;
conn
->
status
=
CONN_EXECUTING
;
conn
->
status
=
CONN_EXECUTING
;
self
->
status
=
STMT_EXECUTING
;
self
->
status
=
STMT_EXECUTING
;
...
@@ -829,11 +827,7 @@ QueryInfo qi;
...
@@ -829,11 +827,7 @@ QueryInfo qi;
self
->
result
=
CC_send_query
(
conn
,
fetch
,
&
qi
);
self
->
result
=
CC_send_query
(
conn
,
fetch
,
&
qi
);
}
}
mylog
(
" done sending the query:
\n
"
);
mylog
(
" done sending the query:
\n
"
);
}
}
else
{
/* not a SELECT statement so don't use a cursor */
else
{
/* not a SELECT statement so don't use a cursor */
mylog
(
" it's NOT a select statement: stmt=%u
\n
"
,
self
);
mylog
(
" it's NOT a select statement: stmt=%u
\n
"
,
self
);
...
@@ -850,7 +844,6 @@ QueryInfo qi;
...
@@ -850,7 +844,6 @@ QueryInfo qi;
QR_Destructor
(
res
);
QR_Destructor
(
res
);
CC_set_no_trans
(
conn
);
CC_set_no_trans
(
conn
);
}
}
}
}
conn
->
status
=
oldstatus
;
conn
->
status
=
oldstatus
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment