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
5ad62747
Commit
5ad62747
authored
Feb 10, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More ODBC formatting cleanup.
parent
08265ef9
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
145 additions
and
363 deletions
+145
-363
src/interfaces/odbc/bind.c
src/interfaces/odbc/bind.c
+5
-10
src/interfaces/odbc/columninfo.c
src/interfaces/odbc/columninfo.c
+0
-4
src/interfaces/odbc/connection.c
src/interfaces/odbc/connection.c
+5
-18
src/interfaces/odbc/convert.c
src/interfaces/odbc/convert.c
+0
-33
src/interfaces/odbc/dlg_specific.c
src/interfaces/odbc/dlg_specific.c
+2
-9
src/interfaces/odbc/drvconn.c
src/interfaces/odbc/drvconn.c
+2
-5
src/interfaces/odbc/environ.c
src/interfaces/odbc/environ.c
+3
-7
src/interfaces/odbc/execute.c
src/interfaces/odbc/execute.c
+8
-30
src/interfaces/odbc/info.c
src/interfaces/odbc/info.c
+13
-44
src/interfaces/odbc/lobj.c
src/interfaces/odbc/lobj.c
+0
-1
src/interfaces/odbc/misc.c
src/interfaces/odbc/misc.c
+0
-2
src/interfaces/odbc/options.c
src/interfaces/odbc/options.c
+4
-12
src/interfaces/odbc/parse.c
src/interfaces/odbc/parse.c
+0
-15
src/interfaces/odbc/pgtypes.c
src/interfaces/odbc/pgtypes.c
+81
-79
src/interfaces/odbc/psqlodbc.c
src/interfaces/odbc/psqlodbc.c
+2
-3
src/interfaces/odbc/qresult.c
src/interfaces/odbc/qresult.c
+0
-11
src/interfaces/odbc/results.c
src/interfaces/odbc/results.c
+13
-40
src/interfaces/odbc/setup.c
src/interfaces/odbc/setup.c
+5
-9
src/interfaces/odbc/socket.c
src/interfaces/odbc/socket.c
+0
-5
src/interfaces/odbc/statement.c
src/interfaces/odbc/statement.c
+2
-22
src/interfaces/odbc/tuplelist.c
src/interfaces/odbc/tuplelist.c
+0
-4
No files found.
src/interfaces/odbc/bind.c
View file @
5ad62747
...
...
@@ -35,7 +35,7 @@
/* Bind parameters on a statement handle */
RETCODE
SQL_API
RETCODE
SQL_API
SQLBindParameter
(
HSTMT
hstmt
,
UWORD
ipar
,
...
...
@@ -156,7 +156,7 @@ SQLBindParameter(
/* - - - - - - - - - */
/* Associate a user-supplied buffer with a database column. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLBindCol
(
HSTMT
hstmt
,
UWORD
icol
,
...
...
@@ -192,7 +192,6 @@ SQLBindCol(
/* If the bookmark column is being bound, then just save it */
if
(
icol
==
0
)
{
if
(
rgbValue
==
NULL
)
{
stmt
->
bookmark
.
buffer
=
NULL
;
...
...
@@ -268,7 +267,7 @@ SQLBindCol(
/* it is best to say this function is not supported and let the application assume a */
/* data type (most likely varchar). */
RETCODE
SQL_API
RETCODE
SQL_API
SQLDescribeParam
(
HSTMT
hstmt
,
UWORD
ipar
,
...
...
@@ -322,7 +321,7 @@ SQLDescribeParam(
/* Sets multiple values (arrays) for the set of parameter markers. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLParamOptions
(
HSTMT
hstmt
,
UDWORD
crow
,
...
...
@@ -345,7 +344,7 @@ SQLParamOptions(
/* like it does for SQLDescribeParam is that some applications don't care and try */
/* to call it anyway. */
/* If the statement does not have parameters, it should just return 0. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLNumParams
(
HSTMT
hstmt
,
SWORD
FAR
*
pcpar
)
...
...
@@ -382,10 +381,8 @@ SQLNumParams(
}
else
{
for
(
i
=
0
;
i
<
strlen
(
stmt
->
statement
);
i
++
)
{
if
(
stmt
->
statement
[
i
]
==
'?'
&&
!
in_quote
)
(
*
pcpar
)
++
;
else
...
...
@@ -436,7 +433,6 @@ extend_bindings(StatementClass * stmt, int num_columns)
/* entries into the new structure */
if
(
stmt
->
bindings_allocated
<
num_columns
)
{
new_bindings
=
create_empty_bindings
(
num_columns
);
if
(
!
new_bindings
)
{
...
...
@@ -461,7 +457,6 @@ extend_bindings(StatementClass * stmt, int num_columns)
stmt
->
bindings
=
new_bindings
;
stmt
->
bindings_allocated
=
num_columns
;
}
/* There is no reason to zero out extra bindings if there are */
/* more than needed. If an app has allocated extra bindings, */
...
...
src/interfaces/odbc/columninfo.c
View file @
5ad62747
...
...
@@ -77,7 +77,6 @@ CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn)
/* now read in the descriptions */
for
(
lf
=
0
;
lf
<
new_num_fields
;
lf
++
)
{
SOCK_get_string
(
sock
,
new_field_name
,
MAX_MESSAGE_LEN
);
new_adtid
=
(
Oid
)
SOCK_get_int
(
sock
,
4
);
new_adtsize
=
(
Int2
)
SOCK_get_int
(
sock
,
2
);
...
...
@@ -85,7 +84,6 @@ CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn)
/* If 6.4 protocol, then read the atttypmod field */
if
(
PG_VERSION_GE
(
conn
,
6
.
4
))
{
mylog
(
"READING ATTTYPMOD
\n
"
);
new_atttypmod
=
(
Int4
)
SOCK_get_int
(
sock
,
4
);
...
...
@@ -93,7 +91,6 @@ CI_read_fields(ColumnInfoClass * self, ConnectionClass * conn)
new_atttypmod
-=
4
;
if
(
new_atttypmod
<
0
)
new_atttypmod
=
-
1
;
}
mylog
(
"CI_read_fields: fieldname='%s', adtid=%d, adtsize=%d, atttypmod=%d
\n
"
,
new_field_name
,
new_adtid
,
new_adtsize
,
new_atttypmod
);
...
...
@@ -146,7 +143,6 @@ void
CI_set_field_info
(
ColumnInfoClass
*
self
,
int
field_num
,
char
*
new_name
,
Oid
new_adtid
,
Int2
new_adtsize
,
Int4
new_atttypmod
)
{
/* check bounds */
if
((
field_num
<
0
)
||
(
field_num
>=
self
->
num_fields
))
return
;
...
...
src/interfaces/odbc/connection.c
View file @
5ad62747
...
...
@@ -34,7 +34,7 @@
extern
GLOBAL_VALUES
globals
;
RETCODE
SQL_API
RETCODE
SQL_API
SQLAllocConnect
(
HENV
henv
,
HDBC
FAR
*
phdbc
)
...
...
@@ -75,7 +75,7 @@ SQLAllocConnect(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLConnect
(
HDBC
hdbc
,
UCHAR
FAR
*
szDSN
,
...
...
@@ -132,7 +132,7 @@ SQLConnect(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLBrowseConnect
(
HDBC
hdbc
,
UCHAR
FAR
*
szConnStrIn
,
...
...
@@ -151,7 +151,7 @@ SQLBrowseConnect(
/* - - - - - - - - - */
/* Drop any hstmts open on hdbc and disconnect from database */
RETCODE
SQL_API
RETCODE
SQL_API
SQLDisconnect
(
HDBC
hdbc
)
{
...
...
@@ -191,7 +191,7 @@ SQLDisconnect(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLFreeConnect
(
HDBC
hdbc
)
{
...
...
@@ -239,7 +239,6 @@ CC_Constructor()
if
(
rv
!=
NULL
)
{
rv
->
henv
=
NULL
;
/* not yet associated with an environment */
rv
->
errormsg
=
NULL
;
...
...
@@ -280,7 +279,6 @@ CC_Constructor()
/* Statements under this conn will inherit these options */
InitializeStatementOptions
(
&
rv
->
stmtOptions
);
}
return
rv
;
}
...
...
@@ -289,7 +287,6 @@ CC_Constructor()
char
CC_Destructor
(
ConnectionClass
*
self
)
{
mylog
(
"enter CC_Destructor, self=%u
\n
"
,
self
);
if
(
self
->
status
==
CONN_EXECUTING
)
...
...
@@ -380,7 +377,6 @@ CC_abort(ConnectionClass * self)
QR_Destructor
(
res
);
else
return
FALSE
;
}
return
TRUE
;
...
...
@@ -499,12 +495,10 @@ CC_connect(ConnectionClass * self, char do_password)
mylog
(
"%s: entering...
\n
"
,
func
);
if
(
do_password
)
sock
=
self
->
sock
;
/* already connected, just authenticate */
else
{
qlog
(
"Global Options: Version='%s', fetch=%d, socket=%d, unknown_sizes=%d, max_varchar_size=%d, max_longvarchar_size=%d
\n
"
,
POSTGRESDRIVERVERSION
,
globals
.
fetch_max
,
...
...
@@ -606,7 +600,6 @@ CC_connect(ConnectionClass * self, char do_password)
do
{
if
(
do_password
)
beresp
=
'R'
;
else
...
...
@@ -690,7 +683,6 @@ CC_connect(ConnectionClass * self, char do_password)
self
->
errornumber
=
CONN_INVALID_AUTHENTICATION
;
return
0
;
}
}
while
(
areq
!=
AUTH_REQ_OK
);
CC_clear_error
(
self
);
/* clear any password error */
...
...
@@ -738,7 +730,6 @@ CC_connect(ConnectionClass * self, char do_password)
mylog
(
"%s: returning...
\n
"
,
func
);
return
1
;
}
char
...
...
@@ -955,7 +946,6 @@ CC_send_query(ConnectionClass * self, char *query, QueryInfo * qi)
}
else
{
char
clear
=
0
;
mylog
(
"send_query: ok - 'C' - %s
\n
"
,
cmdbuffer
);
...
...
@@ -1187,7 +1177,6 @@ CC_send_function(ConnectionClass * self, int fnid, void *result_buf, int *actual
for
(
i
=
0
;
i
<
nargs
;
++
i
)
{
mylog
(
" arg[%d]: len = %d, isint = %d, integer = %d, ptr = %u
\n
"
,
i
,
args
[
i
].
len
,
args
[
i
].
isint
,
args
[
i
].
u
.
integer
,
args
[
i
].
u
.
ptr
);
SOCK_put_int
(
sock
,
args
[
i
].
len
,
4
);
...
...
@@ -1343,7 +1332,6 @@ CC_send_settings(ConnectionClass * self)
status
=
FALSE
;
mylog
(
"%s: result %d, status %d from set geqo
\n
"
,
func
,
result
,
status
);
}
/* KSQO */
...
...
@@ -1354,7 +1342,6 @@ CC_send_settings(ConnectionClass * self)
status
=
FALSE
;
mylog
(
"%s: result %d, status %d from set ksqo
\n
"
,
func
,
result
,
status
);
}
/* Global settings */
...
...
src/interfaces/odbc/convert.c
View file @
5ad62747
...
...
@@ -185,16 +185,11 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
/* pcbValueOffset is for computing any pcbValue location */
if
(
bind_size
>
0
)
{
pcbValueOffset
=
rgbValueOffset
=
(
bind_size
*
bind_row
);
}
else
{
pcbValueOffset
=
bind_row
*
sizeof
(
SDWORD
);
rgbValueOffset
=
bind_row
*
cbValueMax
;
}
memset
(
&
st
,
0
,
sizeof
(
SIMPLE_TIME
));
...
...
@@ -238,7 +233,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
*********************************************************************/
switch
(
field_type
)
{
/*
* $$$ need to add parsing for date/time/timestamp strings in
* PG_TYPE_CHAR,VARCHAR $$$
...
...
@@ -255,10 +249,7 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
case
PG_TYPE_DATETIME
:
case
PG_TYPE_TIMESTAMP
:
if
(
strnicmp
(
value
,
"invalid"
,
7
)
!=
0
)
{
sscanf
(
value
,
"%4d-%2d-%2d %2d:%2d:%2d"
,
&
st
.
y
,
&
st
.
m
,
&
st
.
d
,
&
st
.
hh
,
&
st
.
mm
,
&
st
.
ss
);
}
else
{
/* The timestamp is invalid so set
* something conspicuous, like the epoch */
...
...
@@ -365,8 +356,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
if
(
fCType
==
SQL_C_CHAR
)
{
/* Special character formatting as required */
/*
...
...
@@ -447,7 +436,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
if
(
cbValueMax
>
0
)
{
copy_len
=
(
len
>=
cbValueMax
)
?
cbValueMax
-
1
:
len
;
/* Copy the data */
...
...
@@ -474,7 +462,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
}
else
{
/*
* for SQL_C_CHAR, it's probably ok to leave currency symbols in.
* But to convert to numeric types, it is necessary to get rid of
...
...
@@ -624,7 +611,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
if
(
stmt
->
current_col
>=
0
)
{
/* No more data left for this column */
if
(
stmt
->
bindings
[
stmt
->
current_col
].
data_left
==
0
)
return
COPY_NO_DATA_FOUND
;
...
...
@@ -642,7 +628,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
/* First call to SQLGetData so initialize data_left */
else
stmt
->
bindings
[
stmt
->
current_col
].
data_left
=
len
;
}
if
(
cbValueMax
>
0
)
...
...
@@ -677,7 +662,6 @@ copy_and_convert_field(StatementClass * stmt, Int4 field_type, void *value, Int2
*
(
SDWORD
*
)
((
char
*
)
pcbValue
+
pcbValueOffset
)
=
len
;
return
result
;
}
...
...
@@ -748,7 +732,6 @@ copy_statement_with_parameters(StatementClass * stmt)
for
(
opos
=
0
;
opos
<
oldstmtlen
;
opos
++
)
{
/* Squeeze carriage-return/linefeed pairs to linefeed only */
if
(
old_statement
[
opos
]
==
'\r'
&&
opos
+
1
<
oldstmtlen
&&
old_statement
[
opos
+
1
]
==
'\n'
)
...
...
@@ -955,7 +938,6 @@ copy_statement_with_parameters(StatementClass * stmt)
mylog
(
"m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d
\n
"
,
st
.
m
,
st
.
d
,
st
.
y
,
st
.
hh
,
st
.
mm
,
st
.
ss
);
break
;
}
default:
/* error */
...
...
@@ -1065,14 +1047,9 @@ copy_statement_with_parameters(StatementClass * stmt)
case
SQL_LONGVARBINARY
:
if
(
stmt
->
parameters
[
param_number
].
data_at_exec
)
{
lobj_oid
=
stmt
->
parameters
[
param_number
].
lobj_oid
;
}
else
{
/* begin transaction if needed */
if
(
!
CC_is_in_trans
(
stmt
->
hdbc
))
{
...
...
@@ -1188,9 +1165,7 @@ copy_statement_with_parameters(StatementClass * stmt)
new_statement
[
npos
++
]
=
'\''
;
/* Close Quote */
break
;
}
}
/* end, for */
/* make sure new_statement is always null-terminated */
...
...
@@ -1253,7 +1228,6 @@ convert_escape(char *value)
}
else
if
(
strcmp
(
key
,
"fn"
)
==
0
)
{
/*
* Function invocation Separate off the func name, skipping
* trailing whitespace.
...
...
@@ -1304,7 +1278,6 @@ convert_escape(char *value)
}
return
escape
;
}
...
...
@@ -1473,7 +1446,6 @@ conv_from_octal(unsigned char *s)
y
+=
(
s
[
i
]
-
48
)
*
(
int
)
pow
(
8
,
3
-
i
);
return
y
;
}
unsigned
int
...
...
@@ -1485,7 +1457,6 @@ conv_from_hex(unsigned char *s)
for
(
i
=
1
;
i
<=
2
;
i
++
)
{
if
(
s
[
i
]
>=
'a'
&&
s
[
i
]
<=
'f'
)
val
=
s
[
i
]
-
'a'
+
10
;
else
if
(
s
[
i
]
>=
'A'
&&
s
[
i
]
<=
'F'
)
...
...
@@ -1563,7 +1534,6 @@ convert_to_pgbinary(unsigned char *in, char *out, int len)
strcpy
(
&
out
[
o
],
conv_to_octal
(
in
[
i
]));
o
+=
5
;
}
}
mylog
(
"convert_to_pgbinary: returning %d, out='%.*s'
\n
"
,
o
,
o
,
out
);
...
...
@@ -1661,7 +1631,6 @@ convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
if
(
!
bindInfo
||
bindInfo
->
data_left
==
-
1
)
{
/* begin transaction if needed */
if
(
!
CC_is_in_trans
(
stmt
->
hdbc
))
{
...
...
@@ -1700,7 +1669,6 @@ convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
retval
=
lo_lseek
(
stmt
->
hdbc
,
stmt
->
lobj_fd
,
0L
,
SEEK_END
);
if
(
retval
>=
0
)
{
left
=
lo_tell
(
stmt
->
hdbc
,
stmt
->
lobj_fd
);
if
(
bindInfo
)
bindInfo
->
data_left
=
left
;
...
...
@@ -1804,5 +1772,4 @@ convert_lo(StatementClass * stmt, void *value, Int2 fCType, PTR rgbValue,
return
result
;
}
src/interfaces/odbc/dlg_specific.c
View file @
5ad62747
...
...
@@ -49,7 +49,6 @@ extern GLOBAL_VALUES globals;
void
SetDlgStuff
(
HWND
hdlg
,
ConnInfo
*
ci
)
{
/*
* If driver attribute NOT present, then set the datasource name and
* description
...
...
@@ -81,7 +80,7 @@ GetDlgStuff(HWND hdlg, ConnInfo * ci)
int
CALLBACK
int
CALLBACK
driver_optionsProc
(
HWND
hdlg
,
WORD
wMsg
,
WPARAM
wParam
,
...
...
@@ -223,13 +222,12 @@ driver_optionsProc(HWND hdlg,
break
;
}
}
return
FALSE
;
}
int
CALLBACK
int
CALLBACK
ds_optionsProc
(
HWND
hdlg
,
WORD
wMsg
,
WPARAM
wParam
,
...
...
@@ -351,7 +349,6 @@ makeConnectString(char *connect_string, ConnInfo * ci)
void
copyAttributes
(
ConnInfo
*
ci
,
char
*
attribute
,
char
*
value
)
{
if
(
stricmp
(
attribute
,
"DSN"
)
==
0
)
strcpy
(
ci
->
dsn
,
value
);
...
...
@@ -398,7 +395,6 @@ copyAttributes(ConnInfo * ci, char *attribute, char *value)
}
mylog
(
"copyAttributes: DSN='%s',server='%s',dbase='%s',user='%s',passwd='%s',port='%s',onlyread='%s',protocol='%s', conn_settings='%s')
\n
"
,
ci
->
dsn
,
ci
->
server
,
ci
->
database
,
ci
->
username
,
ci
->
password
,
ci
->
port
,
ci
->
onlyread
,
ci
->
protocol
,
ci
->
conn_settings
);
}
void
...
...
@@ -520,7 +516,6 @@ getDSNinfo(ConnInfo * ci, char overwrite)
qlog
(
" translation_dll='%s',translation_option='%s'
\n
"
,
ci
->
translation_dll
,
ci
->
translation_option
);
}
...
...
@@ -778,7 +773,6 @@ getGlobalDefaults(char *section, char *filename, char override)
/* Dont allow override of an override! */
if
(
!
override
)
{
/*
* ConnSettings is stored in the driver section and per datasource
* for override
...
...
@@ -805,7 +799,6 @@ getGlobalDefaults(char *section, char *filename, char override)
strcpy
(
globals
.
protocol
,
temp
);
else
strcpy
(
globals
.
protocol
,
DEFAULT_PROTOCOL
);
}
}
...
...
src/interfaces/odbc/drvconn.c
View file @
5ad62747
...
...
@@ -65,7 +65,7 @@ extern HINSTANCE NEAR s_hModule;/* Saved module handle. */
extern
GLOBAL_VALUES
globals
;
RETCODE
SQL_API
RETCODE
SQL_API
SQLDriverConnect
(
HDBC
hdbc
,
HWND
hwnd
,
...
...
@@ -147,7 +147,6 @@ dialog:
ci
->
port
[
0
]
==
'\0'
||
password_required
)
{
dialog_result
=
dconn_DoDialog
(
hwnd
,
ci
);
if
(
dialog_result
!=
SQL_SUCCESS
)
return
dialog_result
;
...
...
@@ -216,7 +215,6 @@ dialog:
if
(
szConnStrOut
)
{
/*
* Return the completed string to the caller. The correct method
* is to only construct the connect string if a dialog was put up,
...
...
@@ -269,7 +267,7 @@ dconn_DoDialog(HWND hwnd, ConnInfo * ci)
}
BOOL
FAR
PASCAL
BOOL
FAR
PASCAL
dconn_FDriverConnectProc
(
HWND
hdlg
,
UINT
wMsg
,
...
...
@@ -390,7 +388,6 @@ dconn_get_connect_attributes(UCHAR FAR * connect_string, ConnInfo * ci)
/* Copy the appropriate value to the conninfo */
copyAttributes
(
ci
,
attribute
,
value
);
}
...
...
src/interfaces/odbc/environ.c
View file @
5ad62747
...
...
@@ -22,7 +22,7 @@
ConnectionClass
*
conns
[
MAX_CONNECTIONS
];
RETCODE
SQL_API
RETCODE
SQL_API
SQLAllocEnv
(
HENV
FAR
*
phenv
)
{
static
char
*
func
=
"SQLAllocEnv"
;
...
...
@@ -41,7 +41,7 @@ SQLAllocEnv(HENV FAR * phenv)
return
SQL_SUCCESS
;
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLFreeEnv
(
HENV
henv
)
{
static
char
*
func
=
"SQLFreeEnv"
;
...
...
@@ -62,7 +62,7 @@ SQLFreeEnv(HENV henv)
/* Returns the next SQL error information. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLError
(
HENV
henv
,
HDBC
hdbc
,
...
...
@@ -212,7 +212,6 @@ SQLError(
}
mylog
(
" szSqlState = '%s', szError='%s'
\n
"
,
szSqlState
,
szErrorMsg
);
}
else
{
...
...
@@ -227,7 +226,6 @@ SQLError(
return
SQL_NO_DATA_FOUND
;
}
return
SQL_SUCCESS
;
}
else
if
(
SQL_NULL_HDBC
!=
hdbc
)
{
...
...
@@ -322,7 +320,6 @@ SQLError(
/* general error */
break
;
}
}
else
{
...
...
@@ -337,7 +334,6 @@ SQLError(
return
SQL_NO_DATA_FOUND
;
}
return
SQL_SUCCESS
;
}
else
if
(
SQL_NULL_HENV
!=
henv
)
{
...
...
src/interfaces/odbc/execute.c
View file @
5ad62747
...
...
@@ -39,7 +39,7 @@ extern GLOBAL_VALUES globals;
/* Perform a Prepare on the SQL statement */
RETCODE
SQL_API
RETCODE
SQL_API
SQLPrepare
(
HSTMT
hstmt
,
UCHAR
FAR
*
szSqlStr
,
SDWORD
cbSqlStr
)
...
...
@@ -133,7 +133,7 @@ SQLPrepare(HSTMT hstmt,
/* Performs the equivalent of SQLPrepare, followed by SQLExecute. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLExecDirect
(
HSTMT
hstmt
,
UCHAR
FAR
*
szSqlStr
,
...
...
@@ -195,7 +195,7 @@ SQLExecDirect(
}
/* Execute a prepared SQL statement */
RETCODE
SQL_API
RETCODE
SQL_API
SQLExecute
(
HSTMT
hstmt
)
{
...
...
@@ -274,7 +274,6 @@ SQLExecute(
if
((
stmt
->
prepare
&&
stmt
->
status
!=
STMT_READY
)
||
(
stmt
->
status
!=
STMT_ALLOCATED
&&
stmt
->
status
!=
STMT_READY
))
{
stmt
->
errornumber
=
STMT_STATUS_ERROR
;
stmt
->
errormsg
=
"The handle does not point to a statement that is ready to be executed"
;
SC_log_error
(
func
,
""
,
stmt
);
...
...
@@ -321,14 +320,13 @@ SQLExecute(
return
SC_execute
(
stmt
);
}
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLTransact
(
HENV
henv
,
HDBC
hdbc
,
...
...
@@ -363,7 +361,6 @@ SQLTransact(
if
(
conn
&&
conn
->
henv
==
henv
)
if
(
SQLTransact
(
henv
,
(
HDBC
)
conn
,
fType
)
!=
SQL_SUCCESS
)
return
SQL_ERROR
;
}
return
SQL_SUCCESS
;
}
...
...
@@ -371,15 +368,9 @@ SQLTransact(
conn
=
(
ConnectionClass
*
)
hdbc
;
if
(
fType
==
SQL_COMMIT
)
{
stmt_string
=
"COMMIT"
;
}
else
if
(
fType
==
SQL_ROLLBACK
)
{
stmt_string
=
"ROLLBACK"
;
}
else
{
conn
->
errornumber
=
CONN_INVALID_ARGUMENT_NO
;
...
...
@@ -391,7 +382,6 @@ SQLTransact(
/* If manual commit and in transaction, then proceed. */
if
(
!
CC_is_in_autocommit
(
conn
)
&&
CC_is_in_trans
(
conn
))
{
mylog
(
"SQLTransact: sending on conn %d '%s'
\n
"
,
conn
,
stmt_string
);
res
=
CC_send_query
(
conn
,
stmt_string
,
NULL
);
...
...
@@ -418,7 +408,7 @@ SQLTransact(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLCancel
(
HSTMT
hstmt
)
/* Statement to cancel. */
{
...
...
@@ -447,8 +437,6 @@ SQLCancel(
*/
if
(
stmt
->
data_at_exec
<
0
)
{
/*
* MAJOR HACK for Windows to reset the driver manager's cursor
* state: Because of what seems like a bug in the Odbc driver
...
...
@@ -490,7 +478,6 @@ SQLCancel(
stmt
->
put_data
=
FALSE
;
return
SQL_SUCCESS
;
}
/* - - - - - - - - - */
...
...
@@ -498,7 +485,7 @@ SQLCancel(
/* Returns the SQL string as modified by the driver. */
/* Currently, just copy the input string without modification */
/* observing buffer limits and truncation. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLNativeSql
(
HDBC
hdbc
,
UCHAR
FAR
*
szSqlStrIn
,
...
...
@@ -552,7 +539,7 @@ SQLNativeSql(
/* Supplies parameter data at execution time. Used in conjuction with */
/* SQLPutData. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLParamData
(
HSTMT
hstmt
,
PTR
FAR
*
prgbValue
)
...
...
@@ -663,7 +650,7 @@ SQLParamData(
/* Supplies parameter data at execution time. Used in conjunction with */
/* SQLParamData. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLPutData
(
HSTMT
hstmt
,
PTR
rgbValue
,
...
...
@@ -720,7 +707,6 @@ SQLPutData(
/* Handle Long Var Binary with Large Objects */
if
(
current_param
->
SQLType
==
SQL_LONGVARBINARY
)
{
/* begin transaction if needed */
if
(
!
CC_is_in_trans
(
stmt
->
hdbc
))
{
...
...
@@ -774,7 +760,6 @@ SQLPutData(
retval
=
lo_write
(
stmt
->
hdbc
,
stmt
->
lobj_fd
,
rgbValue
,
cbValue
);
mylog
(
"lo_write: cbValue=%d, wrote %d bytes
\n
"
,
cbValue
,
retval
);
}
else
{
/* for handling text fields and small
...
...
@@ -814,17 +799,14 @@ SQLPutData(
if
(
current_param
->
SQLType
==
SQL_LONGVARBINARY
)
{
/* the large object fd is in EXEC_buffer */
retval
=
lo_write
(
stmt
->
hdbc
,
stmt
->
lobj_fd
,
rgbValue
,
cbValue
);
mylog
(
"lo_write(2): cbValue = %d, wrote %d bytes
\n
"
,
cbValue
,
retval
);
*
current_param
->
EXEC_used
+=
cbValue
;
}
else
{
buffer
=
current_param
->
EXEC_buffer
;
if
(
cbValue
==
SQL_NTS
)
...
...
@@ -845,11 +827,9 @@ SQLPutData(
/* reassign buffer incase realloc moved it */
current_param
->
EXEC_buffer
=
buffer
;
}
else
if
(
cbValue
>
0
)
{
old_pos
=
*
current_param
->
EXEC_used
;
*
current_param
->
EXEC_used
+=
cbValue
;
...
...
@@ -871,14 +851,12 @@ SQLPutData(
/* reassign buffer incase realloc moved it */
current_param
->
EXEC_buffer
=
buffer
;
}
else
{
SC_log_error
(
func
,
"bad cbValue"
,
stmt
);
return
SQL_ERROR
;
}
}
}
...
...
src/interfaces/odbc/info.c
View file @
5ad62747
...
...
@@ -58,7 +58,7 @@ extern GLOBAL_VALUES globals;
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLGetInfo
(
HDBC
hdbc
,
UWORD
fInfoType
,
...
...
@@ -698,7 +698,6 @@ SQLGetInfo(
if
(
rgbInfoValue
)
{
if
(
len
==
2
)
*
((
WORD
*
)
rgbInfoValue
)
=
(
WORD
)
value
;
else
if
(
len
==
4
)
...
...
@@ -715,7 +714,7 @@ SQLGetInfo(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLGetTypeInfo
(
HSTMT
hstmt
,
SWORD
fSqlType
)
...
...
@@ -812,7 +811,7 @@ SQLGetTypeInfo(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLGetFunctions
(
HDBC
hdbc
,
UWORD
fFunction
,
...
...
@@ -824,7 +823,6 @@ SQLGetFunctions(
if
(
fFunction
==
SQL_API_ALL_FUNCTIONS
)
{
if
(
globals
.
lie
)
{
int
i
;
...
...
@@ -910,13 +908,10 @@ SQLGetFunctions(
}
else
{
if
(
globals
.
lie
)
*
pfExists
=
TRUE
;
else
{
switch
(
fFunction
)
{
case
SQL_API_SQLALLOCCONNECT
:
...
...
@@ -1100,7 +1095,7 @@ SQLGetFunctions(
RETCODE
SQL_API
RETCODE
SQL_API
SQLTables
(
HSTMT
hstmt
,
UCHAR
FAR
*
szTableQualifier
,
...
...
@@ -1330,7 +1325,6 @@ SQLTables(
result
=
SQLFetch
(
htbl_stmt
);
while
((
result
==
SQL_SUCCESS
)
||
(
result
==
SQL_SUCCESS_WITH_INFO
))
{
/*
* Determine if this table name is a system table. If treating
* system tables as regular tables, then no need to do this test.
...
...
@@ -1338,7 +1332,6 @@ SQLTables(
systable
=
FALSE
;
if
(
!
atoi
(
ci
->
show_system_tables
))
{
if
(
strncmp
(
table_name
,
POSTGRES_SYS_PREFIX
,
strlen
(
POSTGRES_SYS_PREFIX
))
==
0
)
systable
=
TRUE
;
...
...
@@ -1379,7 +1372,6 @@ SQLTables(
(
view
&&
show_views
)
||
(
regular_table
&&
show_regular_tables
))
{
row
=
(
TupleNode
*
)
malloc
(
sizeof
(
TupleNode
)
+
(
5
-
1
)
*
sizeof
(
TupleField
));
set_tuplefield_string
(
&
row
->
tuple
[
0
],
""
);
...
...
@@ -1427,7 +1419,7 @@ SQLTables(
RETCODE
SQL_API
RETCODE
SQL_API
SQLColumns
(
HSTMT
hstmt
,
UCHAR
FAR
*
szTableQualifier
,
...
...
@@ -1685,12 +1677,10 @@ SQLColumns(
if
(
result
!=
SQL_ERROR
&&
!
stmt
->
internal
)
{
if
(
relhasrules
[
0
]
!=
'1'
&&
(
atoi
(
ci
->
show_oid_column
)
||
strncmp
(
table_name
,
POSTGRES_SYS_PREFIX
,
strlen
(
POSTGRES_SYS_PREFIX
))
==
0
))
{
/* For OID fields */
the_type
=
PG_TYPE_OID
;
row
=
(
TupleNode
*
)
malloc
(
sizeof
(
TupleNode
)
+
...
...
@@ -1718,7 +1708,6 @@ SQLColumns(
QR_add_tuple
(
stmt
->
result
,
row
);
}
}
while
((
result
==
SQL_SUCCESS
)
||
(
result
==
SQL_SUCCESS_WITH_INFO
))
...
...
@@ -1779,7 +1768,6 @@ SQLColumns(
if
((
field_type
==
PG_TYPE_VARCHAR
)
||
(
field_type
==
PG_TYPE_BPCHAR
))
{
useStaticPrecision
=
FALSE
;
if
(
mod_length
>=
4
)
...
...
@@ -1815,7 +1803,6 @@ SQLColumns(
result
=
SQLFetch
(
hcol_stmt
);
}
if
(
result
!=
SQL_NO_DATA_FOUND
)
{
...
...
@@ -1868,7 +1855,7 @@ SQLColumns(
return
SQL_SUCCESS
;
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLSpecialColumns
(
HSTMT
hstmt
,
UWORD
fColType
,
...
...
@@ -1983,11 +1970,9 @@ SQLSpecialColumns(
set_tuplefield_int2
(
&
row
->
tuple
[
7
],
SQL_PC_PSEUDO
);
QR_add_tuple
(
stmt
->
result
,
row
);
}
else
if
(
fColType
==
SQL_ROWVER
)
{
Int2
the_type
=
PG_TYPE_INT4
;
if
(
atoi
(
ci
->
row_versioning
))
...
...
@@ -2019,7 +2004,7 @@ SQLSpecialColumns(
return
SQL_SUCCESS
;
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLStatistics
(
HSTMT
hstmt
,
UCHAR
FAR
*
szTableQualifier
,
...
...
@@ -2152,7 +2137,6 @@ SQLStatistics(
stmt
->
errornumber
=
col_stmt
->
errornumber
;
SQLFreeStmt
(
hcol_stmt
,
SQL_DROP
);
goto
SEEYA
;
}
result
=
SQLFetch
(
hcol_stmt
);
...
...
@@ -2179,7 +2163,6 @@ SQLStatistics(
stmt
->
errornumber
=
col_stmt
->
errornumber
;
SQLFreeStmt
(
hcol_stmt
,
SQL_DROP
);
goto
SEEYA
;
}
SQLFreeStmt
(
hcol_stmt
,
SQL_DROP
);
...
...
@@ -2191,7 +2174,6 @@ SQLStatistics(
stmt
->
errormsg
=
"SQLAllocStmt failed in SQLStatistics for indices."
;
stmt
->
errornumber
=
STMT_NO_MEMORY_ERROR
;
goto
SEEYA
;
}
indx_stmt
=
(
StatementClass
*
)
hindx_stmt
;
...
...
@@ -2211,7 +2193,6 @@ SQLStatistics(
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
goto
SEEYA
;
}
/* bind the index name column */
...
...
@@ -2224,7 +2205,6 @@ SQLStatistics(
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
goto
SEEYA
;
}
/* bind the vector column */
result
=
SQLBindCol
(
hindx_stmt
,
2
,
SQL_C_DEFAULT
,
...
...
@@ -2236,7 +2216,6 @@ SQLStatistics(
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
goto
SEEYA
;
}
/* bind the "is unique" column */
result
=
SQLBindCol
(
hindx_stmt
,
3
,
SQL_C_CHAR
,
...
...
@@ -2260,7 +2239,6 @@ SQLStatistics(
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
goto
SEEYA
;
}
result
=
SQLBindCol
(
hindx_stmt
,
5
,
SQL_C_CHAR
,
...
...
@@ -2313,7 +2291,6 @@ SQLStatistics(
result
=
SQLFetch
(
hindx_stmt
);
while
((
result
==
SQL_SUCCESS
)
||
(
result
==
SQL_SUCCESS_WITH_INFO
))
{
/* If only requesting unique indexs, then just return those. */
if
(
fUnique
==
SQL_INDEX_ALL
||
(
fUnique
==
SQL_INDEX_UNIQUE
&&
atoi
(
isunique
)))
...
...
@@ -2322,7 +2299,6 @@ SQLStatistics(
/* add a row in this table for each field in the index */
while
(
i
<
8
&&
fields_vector
[
i
]
!=
0
)
{
row
=
(
TupleNode
*
)
malloc
(
sizeof
(
TupleNode
)
+
(
13
-
1
)
*
sizeof
(
TupleField
));
...
...
@@ -2417,7 +2393,7 @@ SEEYA:
return
SQL_SUCCESS
;
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLColumnPrivileges
(
HSTMT
hstmt
,
UCHAR
FAR
*
szTableQualifier
,
...
...
@@ -2443,7 +2419,7 @@ SQLColumnPrivileges(
/* SQLPrimaryKeys()
* Retrieve the primary key columns for the specified table.
*/
RETCODE
SQL_API
RETCODE
SQL_API
SQLPrimaryKeys
(
HSTMT
hstmt
,
UCHAR
FAR
*
szTableQualifier
,
...
...
@@ -2571,7 +2547,6 @@ SQLPrimaryKeys(
while
((
result
==
SQL_SUCCESS
)
||
(
result
==
SQL_SUCCESS_WITH_INFO
))
{
row
=
(
TupleNode
*
)
malloc
(
sizeof
(
TupleNode
)
+
(
result_cols
-
1
)
*
sizeof
(
TupleField
));
set_tuplefield_null
(
&
row
->
tuple
[
0
]);
...
...
@@ -2620,7 +2595,7 @@ SQLPrimaryKeys(
return
SQL_SUCCESS
;
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLForeignKeys
(
HSTMT
hstmt
,
UCHAR
FAR
*
szPkTableQualifier
,
...
...
@@ -2897,7 +2872,6 @@ SQLForeignKeys(
while
(
result
==
SQL_SUCCESS
)
{
/* Compute the number of keyparts. */
num_keys
=
(
trig_nargs
-
4
)
/
2
;
...
...
@@ -2912,7 +2886,6 @@ SQLForeignKeys(
/* If there is a pk table specified, then check it. */
if
(
pk_table_needed
[
0
]
!=
'\0'
)
{
/* If it doesn't match, then continue */
if
(
strcmp
(
pk_table
,
pk_table_needed
))
{
...
...
@@ -3001,7 +2974,6 @@ SQLForeignKeys(
for
(
k
=
0
;
k
<
num_keys
;
k
++
)
{
row
=
(
TupleNode
*
)
malloc
(
sizeof
(
TupleNode
)
+
(
result_cols
-
1
)
*
sizeof
(
TupleField
));
mylog
(
"%s: pk_table = '%s', pkey_ptr = '%s'
\n
"
,
func
,
pk_table
,
pkey_ptr
);
...
...
@@ -3049,7 +3021,6 @@ SQLForeignKeys(
*/
else
if
(
pk_table_needed
[
0
]
!=
'\0'
)
{
sprintf
(
tables_query
,
"SELECT pg_trigger.tgargs, "
" pg_trigger.tgnargs, "
" pg_trigger.tgdeferrable, "
...
...
@@ -3171,7 +3142,6 @@ SQLForeignKeys(
while
(
result
==
SQL_SUCCESS
)
{
/* Calculate the number of key parts */
num_keys
=
(
trig_nargs
-
4
)
/
2
;;
...
...
@@ -3227,7 +3197,6 @@ SQLForeignKeys(
for
(
k
=
0
;
k
<
num_keys
;
k
++
)
{
mylog
(
"pkey_ptr = '%s', fk_table = '%s', fkey_ptr = '%s'
\n
"
,
pkey_ptr
,
fk_table
,
fkey_ptr
);
row
=
(
TupleNode
*
)
malloc
(
sizeof
(
TupleNode
)
+
(
result_cols
-
1
)
*
sizeof
(
TupleField
));
...
...
@@ -3290,7 +3259,7 @@ SQLForeignKeys(
RETCODE
SQL_API
RETCODE
SQL_API
SQLProcedureColumns
(
HSTMT
hstmt
,
UCHAR
FAR
*
szProcQualifier
,
...
...
@@ -3310,7 +3279,7 @@ SQLProcedureColumns(
return
SQL_ERROR
;
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLProcedures
(
HSTMT
hstmt
,
UCHAR
FAR
*
szProcQualifier
,
...
...
@@ -3328,7 +3297,7 @@ SQLProcedures(
return
SQL_ERROR
;
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLTablePrivileges
(
HSTMT
hstmt
,
UCHAR
FAR
*
szTableQualifier
,
...
...
src/interfaces/odbc/lobj.c
View file @
5ad62747
...
...
@@ -76,7 +76,6 @@ lo_close(ConnectionClass * conn, int fd)
else
return
retval
;
}
...
...
src/interfaces/odbc/misc.c
View file @
5ad62747
...
...
@@ -185,7 +185,6 @@ strncpy_null(char *dst, const char *src, int len)
if
(
NULL
!=
dst
)
{
/* Just in case, check for special lengths */
if
(
len
==
SQL_NULL_DATA
)
{
...
...
@@ -241,7 +240,6 @@ make_string(char *s, int len, char *buf)
char
*
my_strcat
(
char
*
buf
,
char
*
fmt
,
char
*
s
,
int
len
)
{
if
(
s
&&
(
len
>
0
||
(
len
==
SQL_NTS
&&
strlen
(
s
)
>
0
)))
{
int
length
=
(
len
>
0
)
?
len
:
strlen
(
s
);
...
...
src/interfaces/odbc/options.c
View file @
5ad62747
...
...
@@ -102,18 +102,15 @@ set_statement_option(ConnectionClass * conn,
if
(
globals
.
lie
)
{
if
(
conn
)
conn
->
stmtOptions
.
cursor_type
=
vParam
;
if
(
stmt
)
stmt
->
options
.
cursor_type
=
vParam
;
}
else
{
if
(
globals
.
use_declarefetch
)
{
if
(
conn
)
conn
->
stmtOptions
.
cursor_type
=
SQL_CURSOR_FORWARD_ONLY
;
if
(
stmt
)
...
...
@@ -126,7 +123,6 @@ set_statement_option(ConnectionClass * conn,
{
if
(
vParam
==
SQL_CURSOR_FORWARD_ONLY
||
vParam
==
SQL_CURSOR_STATIC
)
{
if
(
conn
)
conn
->
stmtOptions
.
cursor_type
=
vParam
;
/* valid type */
if
(
stmt
)
...
...
@@ -134,7 +130,6 @@ set_statement_option(ConnectionClass * conn,
}
else
{
if
(
conn
)
conn
->
stmtOptions
.
cursor_type
=
SQL_CURSOR_STATIC
;
if
(
stmt
)
...
...
@@ -289,7 +284,7 @@ set_statement_option(ConnectionClass * conn,
/* Implements only SQL_AUTOCOMMIT */
RETCODE
SQL_API
RETCODE
SQL_API
SQLSetConnectOption
(
HDBC
hdbc
,
UWORD
fOption
,
...
...
@@ -312,7 +307,6 @@ SQLSetConnectOption(
switch
(
fOption
)
{
/*
* Statement Options (apply to all stmts on the connection and
* become defaults for new stmts)
...
...
@@ -423,7 +417,6 @@ SQLSetConnectOption(
CC_log_error
(
func
,
option
,
conn
);
return
SQL_ERROR
;
}
}
if
(
changed
)
...
...
@@ -439,7 +432,7 @@ SQLSetConnectOption(
/* - - - - - - - - - */
/* This function just can tell you whether you are in Autcommit mode or not */
RETCODE
SQL_API
RETCODE
SQL_API
SQLGetConnectOption
(
HDBC
hdbc
,
UWORD
fOption
,
...
...
@@ -509,7 +502,6 @@ SQLGetConnectOption(
return
SQL_ERROR
;
break
;
}
}
return
SQL_SUCCESS
;
...
...
@@ -517,7 +509,7 @@ SQLGetConnectOption(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLSetStmtOption
(
HSTMT
hstmt
,
UWORD
fOption
,
...
...
@@ -544,7 +536,7 @@ SQLSetStmtOption(
/* - - - - - - - - - */
RETCODE
SQL_API
RETCODE
SQL_API
SQLGetStmtOption
(
HSTMT
hstmt
,
UWORD
fOption
,
...
...
src/interfaces/odbc/parse.c
View file @
5ad62747
...
...
@@ -78,7 +78,6 @@ getNextToken(char *s, char *token, int smax, char *delim, char *quote, char *dqu
while
(
!
isspace
((
unsigned
char
)
s
[
i
])
&&
s
[
i
]
!=
','
&&
s
[
i
]
!=
'\0'
&&
out
!=
smax
)
{
/* Handle quoted stuff */
if
(
out
==
0
&&
(
s
[
i
]
==
'\"'
||
s
[
i
]
==
'\''
))
{
...
...
@@ -279,7 +278,6 @@ parse_statement(StatementClass * stmt)
while
((
ptr
=
getNextToken
(
ptr
,
token
,
sizeof
(
token
),
&
delim
,
&
quote
,
&
dquote
,
&
numeric
))
!=
NULL
)
{
unquoted
=
!
(
quote
||
dquote
);
mylog
(
"unquoted=%d, quote=%d, dquote=%d, numeric=%d, delim='%c', token='%s', ptr='%s'
\n
"
,
unquoted
,
quote
,
dquote
,
numeric
,
delim
,
token
,
ptr
);
...
...
@@ -323,7 +321,6 @@ parse_statement(StatementClass * stmt)
!
stricmp
(
token
,
"group"
)
||
!
stricmp
(
token
,
"having"
)))
{
in_select
=
FALSE
;
in_from
=
FALSE
;
in_where
=
TRUE
;
...
...
@@ -334,7 +331,6 @@ parse_statement(StatementClass * stmt)
if
(
in_select
)
{
if
(
in_distinct
)
{
mylog
(
"in distinct
\n
"
);
...
...
@@ -389,7 +385,6 @@ parse_statement(StatementClass * stmt)
if
(
!
in_field
)
{
if
(
!
token
[
0
])
continue
;
...
...
@@ -522,12 +517,10 @@ parse_statement(StatementClass * stmt)
fi
[
stmt
->
nfld
-
1
]
->
expr
=
TRUE
;
fi
[
stmt
->
nfld
-
1
]
->
name
[
0
]
=
'\0'
;
mylog
(
"*** setting expression
\n
"
);
}
if
(
in_from
)
{
if
(
!
in_table
)
{
if
(
!
token
[
0
])
...
...
@@ -581,7 +574,6 @@ parse_statement(StatementClass * stmt)
/* Resolve field names with tables */
for
(
i
=
0
;
i
<
stmt
->
nfld
;
i
++
)
{
if
(
fi
[
i
]
->
func
||
fi
[
i
]
->
expr
||
fi
[
i
]
->
numeric
)
{
fi
[
i
]
->
ti
=
NULL
;
...
...
@@ -641,7 +633,6 @@ parse_statement(StatementClass * stmt)
/* Call SQLColumns for each table and store the result */
for
(
i
=
0
;
i
<
stmt
->
ntab
;
i
++
)
{
/* See if already got it */
char
found
=
FALSE
;
...
...
@@ -657,7 +648,6 @@ parse_statement(StatementClass * stmt)
if
(
!
found
)
{
mylog
(
"PARSE: Getting SQLColumns for table[%d]='%s'
\n
"
,
i
,
ti
[
i
]
->
name
);
result
=
SQLAllocStmt
(
stmt
->
hdbc
,
&
hcol_stmt
);
...
...
@@ -681,7 +671,6 @@ parse_statement(StatementClass * stmt)
mylog
(
" Success
\n
"
);
if
(
!
(
conn
->
ntables
%
COL_INCR
))
{
mylog
(
"PARSE: Allocing col_info at ntables=%d
\n
"
,
conn
->
ntables
);
conn
->
col_info
=
(
COL_INFO
**
)
realloc
(
conn
->
col_info
,
(
conn
->
ntables
+
COL_INCR
)
*
sizeof
(
COL_INFO
*
));
...
...
@@ -741,7 +730,6 @@ parse_statement(StatementClass * stmt)
for
(
i
=
0
;
i
<
stmt
->
nfld
;)
{
/* Dont worry about functions or quotes */
if
(
fi
[
i
]
->
func
||
fi
[
i
]
->
quote
||
fi
[
i
]
->
numeric
)
{
...
...
@@ -752,7 +740,6 @@ parse_statement(StatementClass * stmt)
/* Stars get expanded to all fields in the table */
else
if
(
fi
[
i
]
->
name
[
0
]
==
'*'
)
{
char
do_all_tables
;
int
total_cols
,
old_size
,
...
...
@@ -823,7 +810,6 @@ parse_statement(StatementClass * stmt)
for
(
k
=
0
;
k
<
(
do_all_tables
?
stmt
->
ntab
:
1
);
k
++
)
{
TABLE_INFO
*
the_ti
=
do_all_tables
?
ti
[
k
]
:
fi
[
i
]
->
ti
;
cols
=
QR_get_num_tuples
(
the_ti
->
col_info
->
result
);
...
...
@@ -867,7 +853,6 @@ parse_statement(StatementClass * stmt)
*/
else
if
(
fi
[
i
]
->
ti
)
{
if
(
!
searchColInfo
(
fi
[
i
]
->
ti
->
col_info
,
fi
[
i
]))
parse
=
FALSE
;
...
...
src/interfaces/odbc/pgtypes.c
View file @
5ad62747
...
...
@@ -109,7 +109,6 @@ sqltype_to_pgtype(SWORD fSqlType)
switch
(
fSqlType
)
{
case
SQL_BINARY
:
pgType
=
PG_TYPE_BYTEA
;
break
;
...
...
@@ -199,11 +198,12 @@ pgtype_to_sqltype(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_CHAR
:
case
PG_TYPE_CHAR2
:
case
PG_TYPE_CHAR4
:
case
PG_TYPE_CHAR8
:
case
PG_TYPE_NAME
:
return
SQL_CHAR
;
case
PG_TYPE_CHAR
:
case
PG_TYPE_CHAR2
:
case
PG_TYPE_CHAR4
:
case
PG_TYPE_CHAR8
:
case
PG_TYPE_NAME
:
return
SQL_CHAR
;
case
PG_TYPE_BPCHAR
:
return
SQL_CHAR
;
...
...
@@ -271,7 +271,8 @@ pgtype_to_ctype(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_INT8
:
return
SQL_C_CHAR
;
case
PG_TYPE_INT8
:
return
SQL_C_CHAR
;
case
PG_TYPE_NUMERIC
:
return
SQL_C_CHAR
;
case
PG_TYPE_INT2
:
...
...
@@ -531,11 +532,10 @@ getCharPrecision(StatementClass * stmt, Int4 type, int col, int handle_unknown_s
Int4
pgtype_precision
(
StatementClass
*
stmt
,
Int4
type
,
int
col
,
int
handle_unknown_size_as
)
{
switch
(
type
)
{
case
PG_TYPE_CHAR
:
return
1
;
case
PG_TYPE_CHAR
:
return
1
;
case
PG_TYPE_CHAR2
:
return
2
;
case
PG_TYPE_CHAR4
:
...
...
@@ -597,10 +597,10 @@ pgtype_precision(StatementClass * stmt, Int4 type, int col, int handle_unknown_s
Int4
pgtype_display_size
(
StatementClass
*
stmt
,
Int4
type
,
int
col
,
int
handle_unknown_size_as
)
{
switch
(
type
)
{
case
PG_TYPE_INT2
:
return
6
;
case
PG_TYPE_INT2
:
return
6
;
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
...
...
@@ -636,11 +636,10 @@ pgtype_display_size(StatementClass * stmt, Int4 type, int col, int handle_unknow
Int4
pgtype_length
(
StatementClass
*
stmt
,
Int4
type
,
int
col
,
int
handle_unknown_size_as
)
{
switch
(
type
)
{
case
PG_TYPE_INT2
:
return
2
;
case
PG_TYPE_INT2
:
return
2
;
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
...
...
@@ -681,24 +680,24 @@ pgtype_scale(StatementClass * stmt, Int4 type, int col)
{
switch
(
type
)
{
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
case
PG_TYPE_INT4
:
case
PG_TYPE_INT8
:
case
PG_TYPE_FLOAT4
:
case
PG_TYPE_FLOAT8
:
case
PG_TYPE_MONEY
:
case
PG_TYPE_BOOL
:
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
case
PG_TYPE_INT4
:
case
PG_TYPE_INT8
:
case
PG_TYPE_FLOAT4
:
case
PG_TYPE_FLOAT8
:
case
PG_TYPE_MONEY
:
case
PG_TYPE_BOOL
:
/*
* Number of digits to the right of the decimal point in
* "yyyy-mm=dd hh:mm:ss[.f...]"
*/
case
PG_TYPE_ABSTIME
:
case
PG_TYPE_DATETIME
:
case
PG_TYPE_TIMESTAMP
:
return
0
;
case
PG_TYPE_ABSTIME
:
case
PG_TYPE_DATETIME
:
case
PG_TYPE_TIMESTAMP
:
return
0
;
case
PG_TYPE_NUMERIC
:
return
getNumericScale
(
stmt
,
type
,
col
);
...
...
@@ -714,14 +713,15 @@ pgtype_radix(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_INT4
:
case
PG_TYPE_INT8
:
case
PG_TYPE_NUMERIC
:
case
PG_TYPE_FLOAT4
:
case
PG_TYPE_MONEY
:
case
PG_TYPE_FLOAT8
:
return
10
;
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_INT4
:
case
PG_TYPE_INT8
:
case
PG_TYPE_NUMERIC
:
case
PG_TYPE_FLOAT4
:
case
PG_TYPE_MONEY
:
case
PG_TYPE_FLOAT8
:
return
10
;
default:
return
-
1
;
...
...
@@ -739,23 +739,23 @@ pgtype_auto_increment(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
case
PG_TYPE_INT4
:
case
PG_TYPE_FLOAT4
:
case
PG_TYPE_MONEY
:
case
PG_TYPE_BOOL
:
case
PG_TYPE_FLOAT8
:
case
PG_TYPE_INT8
:
case
PG_TYPE_NUMERIC
:
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
case
PG_TYPE_INT4
:
case
PG_TYPE_FLOAT4
:
case
PG_TYPE_MONEY
:
case
PG_TYPE_BOOL
:
case
PG_TYPE_FLOAT8
:
case
PG_TYPE_INT8
:
case
PG_TYPE_NUMERIC
:
case
PG_TYPE_DATE
:
case
PG_TYPE_TIME
:
case
PG_TYPE_ABSTIME
:
case
PG_TYPE_DATETIME
:
case
PG_TYPE_TIMESTAMP
:
return
FALSE
;
case
PG_TYPE_DATE
:
case
PG_TYPE_TIME
:
case
PG_TYPE_ABSTIME
:
case
PG_TYPE_DATETIME
:
case
PG_TYPE_TIMESTAMP
:
return
FALSE
;
default:
return
-
1
;
...
...
@@ -767,16 +767,17 @@ pgtype_case_sensitive(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_CHAR
:
case
PG_TYPE_CHAR
:
case
PG_TYPE_CHAR2
:
case
PG_TYPE_CHAR4
:
case
PG_TYPE_CHAR8
:
case
PG_TYPE_CHAR2
:
case
PG_TYPE_CHAR4
:
case
PG_TYPE_CHAR8
:
case
PG_TYPE_VARCHAR
:
case
PG_TYPE_BPCHAR
:
case
PG_TYPE_TEXT
:
case
PG_TYPE_NAME
:
return
TRUE
;
case
PG_TYPE_VARCHAR
:
case
PG_TYPE_BPCHAR
:
case
PG_TYPE_TEXT
:
case
PG_TYPE_NAME
:
return
TRUE
;
default:
return
FALSE
;
...
...
@@ -788,7 +789,8 @@ pgtype_money(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_MONEY
:
return
TRUE
;
case
PG_TYPE_MONEY
:
return
TRUE
;
default:
return
FALSE
;
}
...
...
@@ -799,15 +801,16 @@ pgtype_searchable(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_CHAR
:
case
PG_TYPE_CHAR2
:
case
PG_TYPE_CHAR4
:
case
PG_TYPE_CHAR8
:
case
PG_TYPE_CHAR
:
case
PG_TYPE_CHAR2
:
case
PG_TYPE_CHAR4
:
case
PG_TYPE_CHAR8
:
case
PG_TYPE_VARCHAR
:
case
PG_TYPE_BPCHAR
:
case
PG_TYPE_TEXT
:
case
PG_TYPE_NAME
:
return
SQL_SEARCHABLE
;
case
PG_TYPE_VARCHAR
:
case
PG_TYPE_BPCHAR
:
case
PG_TYPE_TEXT
:
case
PG_TYPE_NAME
:
return
SQL_SEARCHABLE
;
default:
return
SQL_ALL_EXCEPT_LIKE
;
...
...
@@ -819,8 +822,9 @@ pgtype_unsigned(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
return
TRUE
;
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
return
TRUE
;
case
PG_TYPE_INT2
:
case
PG_TYPE_INT4
:
...
...
@@ -841,7 +845,6 @@ pgtype_literal_prefix(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
...
...
@@ -862,7 +865,6 @@ pgtype_literal_suffix(StatementClass * stmt, Int4 type)
{
switch
(
type
)
{
case
PG_TYPE_INT2
:
case
PG_TYPE_OID
:
case
PG_TYPE_XID
:
...
...
@@ -898,12 +900,12 @@ sqltype_to_default_ctype(Int2 sqltype)
/* (Appendix D) */
switch
(
sqltype
)
{
case
SQL_CHAR
:
case
SQL_VARCHAR
:
case
SQL_LONGVARCHAR
:
case
SQL_DECIMAL
:
case
SQL_NUMERIC
:
case
SQL_BIGINT
:
case
SQL_CHAR
:
case
SQL_VARCHAR
:
case
SQL_LONGVARCHAR
:
case
SQL_DECIMAL
:
case
SQL_NUMERIC
:
case
SQL_BIGINT
:
return
SQL_C_CHAR
;
case
SQL_BIT
:
...
...
src/interfaces/odbc/psqlodbc.c
View file @
5ad62747
...
...
@@ -38,7 +38,7 @@ RETCODE SQL_API SQLDummyOrdinal(void);
HINSTANCE
NEAR
s_hModule
;
/* Saved module handle. */
/* This is where the Driver Manager attaches to this Driver */
BOOL
WINAPI
BOOL
WINAPI
DllMain
(
HANDLE
hInst
,
ULONG
ul_reason_for_call
,
LPVOID
lpReserved
)
{
WORD
wVersionRequested
;
...
...
@@ -59,7 +59,6 @@ DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
if
(
LOBYTE
(
wsaData
.
wVersion
)
!=
1
||
HIBYTE
(
wsaData
.
wVersion
)
!=
1
)
{
WSACleanup
();
return
FALSE
;
}
...
...
@@ -137,7 +136,7 @@ _fini(void)
Driver Manager do this. Also, the ordinal values of the
functions must match the value of fFunction in SQLGetFunctions()
*/
RETCODE
SQL_API
RETCODE
SQL_API
SQLDummyOrdinal
(
void
)
{
return
SQL_SUCCESS
;
...
...
src/interfaces/odbc/qresult.c
View file @
5ad62747
...
...
@@ -110,7 +110,6 @@ QR_Constructor(void)
rv
->
cache_size
=
globals
.
fetch_max
;
rv
->
rowset_size
=
1
;
}
mylog
(
"exit QR_Constructor
\n
"
);
...
...
@@ -152,7 +151,6 @@ QR_Destructor(QResultClass * self)
free
(
self
);
mylog
(
"QResult: exit DESTRUCTOR
\n
"
);
}
void
...
...
@@ -186,7 +184,6 @@ QR_free_memory(QResultClass * self)
if
(
self
->
backend_tuples
)
{
for
(
row
=
0
;
row
<
fcount
;
row
++
)
{
mylog
(
"row = %d, num_fields = %d
\n
"
,
row
,
num_fields
);
...
...
@@ -284,7 +281,6 @@ QR_fetch_tuples(QResultClass * self, ConnectionClass * conn, char *cursor)
}
else
{
/* Always have to read the field attributes. */
/* But we dont have to reallocate memory for them! */
...
...
@@ -343,7 +339,6 @@ QR_close(QResultClass * self)
return
FALSE
;
}
}
}
return
TRUE
;
...
...
@@ -389,7 +384,6 @@ QR_next_tuple(QResultClass * self)
}
else
{
/*
* See if we need to fetch another group of rows. We may be being
* called from send_query(), and if so, don't send another fetch,
...
...
@@ -399,7 +393,6 @@ QR_next_tuple(QResultClass * self)
if
(
!
self
->
inTuples
)
{
if
(
!
globals
.
use_declarefetch
)
{
mylog
(
"next_tuple: ALL_ROWS: done, fcount = %d, fetch_count = %d
\n
"
,
fcount
,
fetch_count
);
...
...
@@ -433,7 +426,6 @@ QR_next_tuple(QResultClass * self)
offset
=
self
->
fetch_count
;
self
->
fetch_count
++
;
}
...
...
@@ -486,7 +478,6 @@ QR_next_tuple(QResultClass * self)
for
(;;)
{
id
=
SOCK_get_char
(
sock
);
switch
(
id
)
...
...
@@ -533,7 +524,6 @@ QR_next_tuple(QResultClass * self)
self
->
inTuples
=
FALSE
;
if
(
self
->
fcount
>
0
)
{
qlog
(
" [ fetched %d rows ]
\n
"
,
self
->
fcount
);
mylog
(
"_next_tuple: 'C' fetch_max && fcount = %d
\n
"
,
self
->
fcount
);
...
...
@@ -626,7 +616,6 @@ QR_read_tuple(QResultClass * self, char binary)
}
else
{
/*
* NO, the field is not null. so get at first the length of
* the field (four bytes)
...
...
src/interfaces/odbc/results.c
View file @
5ad62747
...
...
@@ -43,7 +43,7 @@ extern GLOBAL_VALUES globals;
RETCODE
SQL_API
RETCODE
SQL_API
SQLRowCount
(
HSTMT
hstmt
,
SDWORD
FAR
*
pcrow
)
...
...
@@ -81,7 +81,6 @@ SQLRowCount(
}
else
{
res
=
SC_get_Result
(
stmt
);
if
(
res
&&
pcrow
)
{
...
...
@@ -114,7 +113,7 @@ SQLRowCount(
/* attached to "hstmt". */
RETCODE
SQL_API
RETCODE
SQL_API
SQLNumResultCols
(
HSTMT
hstmt
,
SWORD
FAR
*
pccol
)
...
...
@@ -135,7 +134,6 @@ SQLNumResultCols(
parse_ok
=
FALSE
;
if
(
globals
.
parse
&&
stmt
->
statement_type
==
STMT_TYPE_SELECT
)
{
if
(
stmt
->
parse_status
==
STMT_PARSE_NONE
)
{
mylog
(
"SQLNumResultCols: calling parse_statement on stmt=%u
\n
"
,
stmt
);
...
...
@@ -152,7 +150,6 @@ SQLNumResultCols(
if
(
!
parse_ok
)
{
SC_pre_execute
(
stmt
);
result
=
SC_get_Result
(
stmt
);
...
...
@@ -179,7 +176,7 @@ SQLNumResultCols(
/* Return information about the database column the user wants */
/* information about. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLDescribeCol
(
HSTMT
hstmt
,
UWORD
icol
,
...
...
@@ -229,7 +226,6 @@ SQLDescribeCol(
parse_ok
=
FALSE
;
if
(
globals
.
parse
&&
stmt
->
statement_type
==
STMT_TYPE_SELECT
)
{
if
(
stmt
->
parse_status
==
STMT_PARSE_NONE
)
{
mylog
(
"SQLDescribeCol: calling parse_statement on stmt=%u
\n
"
,
stmt
);
...
...
@@ -241,7 +237,6 @@ SQLDescribeCol(
if
(
stmt
->
parse_status
!=
STMT_PARSE_FATAL
&&
stmt
->
fi
&&
stmt
->
fi
[
icol
])
{
if
(
icol
>=
stmt
->
nfld
)
{
stmt
->
errornumber
=
STMT_INVALID_COLUMN_NUMBER_ERROR
;
...
...
@@ -342,7 +337,6 @@ SQLDescribeCol(
/************************/
if
(
pcbColDef
)
{
if
(
precision
<
0
)
precision
=
0
;
/* "I dont know" */
...
...
@@ -381,7 +375,7 @@ SQLDescribeCol(
/* Returns result column descriptor information for a result set. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLColAttributes
(
HSTMT
hstmt
,
UWORD
icol
,
...
...
@@ -422,7 +416,7 @@ SQLColAttributes(
icol
--
;
unknown_sizes
=
globals
.
unknown_sizes
;
/* atoi(ci->unknown_sizes);
*
*/
*
*/
if
(
unknown_sizes
==
UNKNOWNS_AS_DONTKNOW
)
/* not appropriate for
* SQLColAttributes() */
unknown_sizes
=
UNKNOWNS_AS_MAX
;
...
...
@@ -430,7 +424,6 @@ SQLColAttributes(
parse_ok
=
FALSE
;
if
(
globals
.
parse
&&
stmt
->
statement_type
==
STMT_TYPE_SELECT
)
{
if
(
stmt
->
parse_status
==
STMT_PARSE_NONE
)
{
mylog
(
"SQLColAttributes: calling parse_statement
\n
"
);
...
...
@@ -453,7 +446,6 @@ SQLColAttributes(
if
(
stmt
->
parse_status
!=
STMT_PARSE_FATAL
&&
stmt
->
fi
&&
stmt
->
fi
[
icol
])
{
if
(
icol
>=
cols
)
{
stmt
->
errornumber
=
STMT_INVALID_COLUMN_NUMBER_ERROR
;
...
...
@@ -542,7 +534,6 @@ SQLColAttributes(
mylog
(
"SQLColAttr: COLUMN_LABEL = '%s'
\n
"
,
p
);
break
;
}
/* otherwise same as column name -- FALL
* THROUGH!!! */
...
...
@@ -652,7 +643,6 @@ SQLColAttributes(
if
(
pfDesc
)
*
pfDesc
=
value
;
}
...
...
@@ -661,7 +651,7 @@ SQLColAttributes(
/* Returns result data for a single column in the current row. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLGetData
(
HSTMT
hstmt
,
UWORD
icol
,
...
...
@@ -707,7 +697,6 @@ SQLGetData(
if
(
icol
==
0
)
{
if
(
stmt
->
options
.
use_bookmarks
==
SQL_UB_OFF
)
{
stmt
->
errornumber
=
STMT_COLNUM_ERROR
;
...
...
@@ -726,12 +715,10 @@ SQLGetData(
}
get_bookmark
=
TRUE
;
}
else
{
/* use zero-based column numbers */
icol
--
;
...
...
@@ -849,7 +836,7 @@ SQLGetData(
/* Returns data for bound columns in the current row ("hstmt->iCursor"), */
/* advances the cursor. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLFetch
(
HSTMT
hstmt
)
{
...
...
@@ -919,7 +906,7 @@ SQLFetch(
/* This fetchs a block of data (rowset). */
RETCODE
SQL_API
RETCODE
SQL_API
SQLExtendedFetch
(
HSTMT
hstmt
,
UWORD
fFetchType
,
...
...
@@ -1031,10 +1018,7 @@ SQLExtendedFetch(
stmt
->
rowset_start
=
0
;
else
{
stmt
->
rowset_start
+=
(
save_rowset_size
>
0
?
save_rowset_size
:
stmt
->
options
.
rowset_size
);
}
mylog
(
"SQL_FETCH_NEXT: num_tuples=%d, currtuple=%d
\n
"
,
num_tuples
,
stmt
->
currTuple
);
break
;
...
...
@@ -1050,17 +1034,10 @@ SQLExtendedFetch(
*/
if
(
stmt
->
rowset_start
>=
num_tuples
)
{
stmt
->
rowset_start
=
num_tuples
<=
0
?
0
:
(
num_tuples
-
stmt
->
options
.
rowset_size
);
}
else
{
stmt
->
rowset_start
-=
stmt
->
options
.
rowset_size
;
}
break
;
case
SQL_FETCH_FIRST
:
...
...
@@ -1116,7 +1093,6 @@ SQLExtendedFetch(
default:
SC_log_error
(
func
,
"Unsupported SQLExtendedFetch Direction"
,
stmt
);
return
SQL_ERROR
;
}
...
...
@@ -1172,7 +1148,6 @@ SQLExtendedFetch(
truncated
=
error
=
FALSE
;
for
(
i
=
0
;
i
<
stmt
->
options
.
rowset_size
;
i
++
)
{
stmt
->
bind_row
=
i
;
/* set the binding location */
result
=
SC_fetch
(
stmt
);
...
...
@@ -1220,7 +1195,6 @@ SQLExtendedFetch(
return
SQL_SUCCESS_WITH_INFO
;
else
return
SQL_SUCCESS
;
}
...
...
@@ -1228,7 +1202,7 @@ SQLExtendedFetch(
/* the "hstmt". */
/* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */
RETCODE
SQL_API
RETCODE
SQL_API
SQLMoreResults
(
HSTMT
hstmt
)
{
...
...
@@ -1237,7 +1211,7 @@ SQLMoreResults(
/* This positions the cursor within a rowset, that was positioned using SQLExtendedFetch. */
/* This will be useful (so far) only when using SQLGetData after SQLExtendedFetch. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLSetPos
(
HSTMT
hstmt
,
UWORD
irow
,
...
...
@@ -1301,12 +1275,11 @@ SQLSetPos(
stmt
->
currTuple
=
stmt
->
rowset_start
+
irow
;
return
SQL_SUCCESS
;
}
/* Sets options that control the behavior of cursors. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLSetScrollOptions
(
HSTMT
hstmt
,
UWORD
fConcurrency
,
...
...
@@ -1322,7 +1295,7 @@ SQLSetScrollOptions(
/* Set the cursor name on a statement handle */
RETCODE
SQL_API
RETCODE
SQL_API
SQLSetCursorName
(
HSTMT
hstmt
,
UCHAR
FAR
*
szCursor
,
...
...
@@ -1356,7 +1329,7 @@ SQLSetCursorName(
/* Return the cursor name for a statement handle */
RETCODE
SQL_API
RETCODE
SQL_API
SQLGetCursorName
(
HSTMT
hstmt
,
UCHAR
FAR
*
szCursor
,
...
...
src/interfaces/odbc/setup.c
View file @
5ad62747
...
...
@@ -50,7 +50,6 @@ typedef struct tagSETUPDLG
char
szDSN
[
MAXDSNAME
];
/* Original data source name */
BOOL
fNewDSN
;
/* New data source flag */
BOOL
fDefault
;
/* Default data source flag */
}
SETUPDLG
,
FAR
*
LPSETUPDLG
;
...
...
@@ -73,7 +72,7 @@ BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
Output : TRUE success, FALSE otherwise
--------------------------------------------------------------------------*/
BOOL
CALLBACK
BOOL
CALLBACK
ConfigDSN
(
HWND
hwnd
,
WORD
fRequest
,
LPCSTR
lpszDriver
,
...
...
@@ -153,7 +152,7 @@ ConfigDSN(HWND hwnd,
Input : hdlg -- Dialog window handle
Output : None
--------------------------------------------------------------------------*/
void
INTFUNC
void
INTFUNC
CenterDialog
(
HWND
hdlg
)
{
HWND
hwndFrame
;
...
...
@@ -208,13 +207,12 @@ CenterDialog(HWND hdlg)
--------------------------------------------------------------------------*/
int
CALLBACK
int
CALLBACK
ConfigDlgProc
(
HWND
hdlg
,
WORD
wMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
wMsg
)
{
/* Initialize the dialog */
...
...
@@ -266,7 +264,6 @@ ConfigDlgProc(HWND hdlg,
switch
(
GET_WM_COMMAND_ID
(
wParam
,
lParam
))
{
/*
* Ensure the OK button is enabled only when a data
* source name
...
...
@@ -344,7 +341,7 @@ ConfigDlgProc(HWND hdlg,
Input : lpszAttributes - Pointer to attribute string
Output : None (global aAttr normally updated)
--------------------------------------------------------------------------*/
void
INTFUNC
void
INTFUNC
ParseAttributes
(
LPCSTR
lpszAttributes
,
LPSETUPDLG
lpsetupdlg
)
{
LPCSTR
lpsz
;
...
...
@@ -370,7 +367,6 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
cbKey
=
lpsz
-
lpszStart
;
if
(
cbKey
<
sizeof
(
aszKey
))
{
_fmemcpy
(
aszKey
,
lpszStart
,
cbKey
);
aszKey
[
cbKey
]
=
'\0'
;
}
...
...
@@ -398,7 +394,7 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
Output : TRUE if successful, FALSE otherwise
--------------------------------------------------------------------------*/
BOOL
INTFUNC
BOOL
INTFUNC
SetDSNAttributes
(
HWND
hwndParent
,
LPSETUPDLG
lpsetupdlg
)
{
LPCSTR
lpszDSN
;
/* Pointer to data source name */
...
...
src/interfaces/odbc/socket.c
View file @
5ad62747
...
...
@@ -70,7 +70,6 @@ SOCK_Constructor()
rv
->
reverse
=
FALSE
;
}
return
rv
;
}
void
...
...
@@ -93,7 +92,6 @@ SOCK_Destructor(SocketClass * self)
free
(
self
->
buffer_out
);
free
(
self
);
}
...
...
@@ -145,7 +143,6 @@ SOCK_connect_to(SocketClass * self, unsigned short port, char *hostname)
if
(
connect
(
self
->
socket
,
(
struct
sockaddr
*
)
&
(
sadr
),
sizeof
(
sadr
))
<
0
)
{
self
->
errornumber
=
SOCKET_COULD_NOT_CONNECT
;
self
->
errormsg
=
"Could not connect to remote socket."
;
closesocket
(
self
->
socket
);
...
...
@@ -290,7 +287,6 @@ SOCK_flush_output(SocketClass * self)
unsigned
char
SOCK_get_next_byte
(
SocketClass
*
self
)
{
if
(
self
->
buffer_read_in
>=
self
->
buffer_filled_in
)
{
/* there are no more bytes left in the buffer -> */
...
...
@@ -313,7 +309,6 @@ SOCK_get_next_byte(SocketClass * self)
self
->
errormsg
=
"Socket has been closed."
;
self
->
buffer_filled_in
=
0
;
}
}
return
self
->
buffer_in
[
self
->
buffer_read_in
++
];
}
...
...
src/interfaces/odbc/statement.c
View file @
5ad62747
...
...
@@ -85,7 +85,7 @@ static struct
};
RETCODE
SQL_API
RETCODE
SQL_API
SQLAllocStmt
(
HDBC
hdbc
,
HSTMT
FAR
*
phstmt
)
{
...
...
@@ -139,7 +139,7 @@ SQLAllocStmt(HDBC hdbc,
}
RETCODE
SQL_API
RETCODE
SQL_API
SQLFreeStmt
(
HSTMT
hstmt
,
UWORD
fOption
)
{
...
...
@@ -180,13 +180,9 @@ SQLFreeStmt(HSTMT hstmt,
/* Destroy the statement and free any results, cursors, etc. */
SC_Destructor
(
stmt
);
}
else
if
(
fOption
==
SQL_UNBIND
)
{
SC_unbind_cols
(
stmt
);
}
else
if
(
fOption
==
SQL_CLOSE
)
{
/* this should discard all the results, but leave the statement */
...
...
@@ -197,13 +193,9 @@ SQLFreeStmt(HSTMT hstmt,
SC_log_error
(
func
,
""
,
stmt
);
return
SQL_ERROR
;
}
}
else
if
(
fOption
==
SQL_RESET_PARAMS
)
{
SC_free_params
(
stmt
,
STMT_FREE_PARAMS_ALL
);
}
else
{
stmt
->
errormsg
=
"Invalid option passed to SQLFreeStmt."
;
...
...
@@ -298,7 +290,6 @@ SC_Constructor(void)
char
SC_Destructor
(
StatementClass
*
self
)
{
mylog
(
"SC_Destructor: self=%u, self->result=%u, self->hdbc=%u
\n
"
,
self
,
self
->
result
,
self
->
hdbc
);
if
(
STMT_EXECUTING
==
self
->
status
)
{
...
...
@@ -380,7 +371,6 @@ SC_free_params(StatementClass * self, char option)
{
if
(
self
->
parameters
[
i
].
data_at_exec
==
TRUE
)
{
if
(
self
->
parameters
[
i
].
EXEC_used
)
{
free
(
self
->
parameters
[
i
].
EXEC_used
);
...
...
@@ -469,7 +459,6 @@ SC_recycle_statement(StatementClass * self)
conn
=
SC_get_conn
(
self
);
if
(
!
CC_is_in_autocommit
(
conn
)
&&
CC_is_in_trans
(
conn
))
{
CC_send_query
(
conn
,
"ABORT"
,
NULL
);
CC_set_no_trans
(
conn
);
}
...
...
@@ -548,7 +537,6 @@ SC_recycle_statement(StatementClass * self)
void
SC_pre_execute
(
StatementClass
*
self
)
{
mylog
(
"SC_pre_execute: status = %d
\n
"
,
self
->
status
);
if
(
self
->
status
==
STMT_READY
)
...
...
@@ -690,11 +678,9 @@ SC_fetch(StatementClass * self)
if
(
self
->
manual_result
||
!
globals
.
use_declarefetch
)
{
if
(
self
->
currTuple
>=
QR_get_num_tuples
(
res
)
-
1
||
(
self
->
options
.
maxRows
>
0
&&
self
->
currTuple
==
self
->
options
.
maxRows
-
1
))
{
/*
* if at the end of the tuples, return "no data found" and set
* the cursor past the end of the result set
...
...
@@ -708,7 +694,6 @@ SC_fetch(StatementClass * self)
}
else
{
/* read from the cache or the physical next tuple */
retval
=
QR_next_tuple
(
res
);
if
(
retval
<
0
)
...
...
@@ -751,7 +736,6 @@ SC_fetch(StatementClass * self)
for
(
lf
=
0
;
lf
<
num_cols
;
lf
++
)
{
mylog
(
"fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u
\n
"
,
num_cols
,
lf
,
self
,
self
->
bindings
,
self
->
bindings
[
lf
].
buffer
);
/* reset for SQLGetData */
...
...
@@ -860,7 +844,6 @@ SC_execute(StatementClass * self)
if
(
!
self
->
internal
&&
!
CC_is_in_trans
(
conn
)
&&
((
globals
.
use_declarefetch
&&
self
->
statement_type
==
STMT_TYPE_SELECT
)
||
(
!
CC_is_in_autocommit
(
conn
)
&&
STMT_UPDATE
(
self
))))
{
mylog
(
" about to begin a transaction on statement = %u
\n
"
,
self
);
res
=
CC_send_query
(
conn
,
"BEGIN"
,
NULL
);
if
(
!
res
)
...
...
@@ -902,7 +885,6 @@ SC_execute(StatementClass * self)
/* in copy_statement... */
if
(
self
->
statement_type
==
STMT_TYPE_SELECT
)
{
char
fetch
[
128
];
mylog
(
" Sending SELECT statement on stmt=%u, cursor_name='%s'
\n
"
,
self
,
self
->
cursor_name
);
...
...
@@ -914,7 +896,6 @@ SC_execute(StatementClass * self)
if
(
globals
.
use_declarefetch
&&
self
->
result
!=
NULL
&&
QR_command_successful
(
self
->
result
))
{
QR_Destructor
(
self
->
result
);
/*
...
...
@@ -968,7 +949,6 @@ SC_execute(StatementClass * self)
/* Check the status of the result */
if
(
self
->
result
)
{
was_ok
=
QR_command_successful
(
self
->
result
);
was_nonfatal
=
QR_command_nonfatal
(
self
->
result
);
...
...
src/interfaces/odbc/tuplelist.c
View file @
5ad62747
...
...
@@ -25,7 +25,6 @@ TL_Constructor(UInt4 fieldcnt)
rv
=
(
TupleListClass
*
)
malloc
(
sizeof
(
TupleListClass
));
if
(
rv
)
{
rv
->
num_fields
=
fieldcnt
;
rv
->
num_tuples
=
0
;
rv
->
list_start
=
NULL
;
...
...
@@ -134,7 +133,6 @@ TL_get_fieldval(TupleListClass * self, Int4 tupleno, Int2 fieldno)
}
else
if
(
start_is_closer
)
{
/*
* the shortest way is to start the search from the head of the
* list
...
...
@@ -181,7 +179,6 @@ TL_get_fieldval(TupleListClass * self, Int4 tupleno, Int2 fieldno)
char
TL_add_tuple
(
TupleListClass
*
self
,
TupleNode
*
new_field
)
{
/*
* we append the tuple at the end of the doubly linked list of the
* tuples we have already read in
...
...
@@ -200,7 +197,6 @@ TL_add_tuple(TupleListClass * self, TupleNode * new_field)
}
else
{
/*
* there is already an element in the list, so add the new one at
* the end of the list
...
...
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