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
1c551683
Commit
1c551683
authored
May 08, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run pgindent on ODBC code only, to reformat new comments.
parent
296e7ba2
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
294 additions
and
234 deletions
+294
-234
src/interfaces/odbc/bind.c
src/interfaces/odbc/bind.c
+9
-9
src/interfaces/odbc/columninfo.c
src/interfaces/odbc/columninfo.c
+3
-2
src/interfaces/odbc/connection.c
src/interfaces/odbc/connection.c
+6
-3
src/interfaces/odbc/convert.c
src/interfaces/odbc/convert.c
+25
-20
src/interfaces/odbc/dlg_specific.c
src/interfaces/odbc/dlg_specific.c
+3
-1
src/interfaces/odbc/drvconn.c
src/interfaces/odbc/drvconn.c
+5
-4
src/interfaces/odbc/environ.c
src/interfaces/odbc/environ.c
+3
-2
src/interfaces/odbc/execute.c
src/interfaces/odbc/execute.c
+27
-15
src/interfaces/odbc/gpps.c
src/interfaces/odbc/gpps.c
+10
-11
src/interfaces/odbc/info.c
src/interfaces/odbc/info.c
+40
-28
src/interfaces/odbc/lobj.c
src/interfaces/odbc/lobj.c
+1
-1
src/interfaces/odbc/misc.c
src/interfaces/odbc/misc.c
+2
-0
src/interfaces/odbc/multibyte.c
src/interfaces/odbc/multibyte.c
+12
-12
src/interfaces/odbc/options.c
src/interfaces/odbc/options.c
+36
-33
src/interfaces/odbc/parse.c
src/interfaces/odbc/parse.c
+5
-3
src/interfaces/odbc/pgtypes.c
src/interfaces/odbc/pgtypes.c
+18
-16
src/interfaces/odbc/qresult.c
src/interfaces/odbc/qresult.c
+16
-12
src/interfaces/odbc/results.c
src/interfaces/odbc/results.c
+17
-13
src/interfaces/odbc/setup.c
src/interfaces/odbc/setup.c
+21
-16
src/interfaces/odbc/socket.c
src/interfaces/odbc/socket.c
+19
-19
src/interfaces/odbc/statement.c
src/interfaces/odbc/statement.c
+11
-12
src/interfaces/odbc/statement.h
src/interfaces/odbc/statement.h
+2
-2
src/interfaces/odbc/tuplelist.c
src/interfaces/odbc/tuplelist.c
+3
-0
No files found.
src/interfaces/odbc/bind.c
View file @
1c551683
...
@@ -145,7 +145,7 @@ SQLBindParameter(
...
@@ -145,7 +145,7 @@ SQLBindParameter(
/* Data at exec macro only valid for C char/binary data */
/* Data at exec macro only valid for C char/binary data */
if
(
pcbValue
&&
(
*
pcbValue
==
SQL_DATA_AT_EXEC
||
if
(
pcbValue
&&
(
*
pcbValue
==
SQL_DATA_AT_EXEC
||
*
pcbValue
<=
SQL_LEN_DATA_AT_EXEC_OFFSET
))
*
pcbValue
<=
SQL_LEN_DATA_AT_EXEC_OFFSET
))
stmt
->
parameters
[
ipar
].
data_at_exec
=
TRUE
;
stmt
->
parameters
[
ipar
].
data_at_exec
=
TRUE
;
else
else
stmt
->
parameters
[
ipar
].
data_at_exec
=
FALSE
;
stmt
->
parameters
[
ipar
].
data_at_exec
=
FALSE
;
...
@@ -160,7 +160,7 @@ SQLBindParameter(
...
@@ -160,7 +160,7 @@ SQLBindParameter(
}
}
/*
Associate a user-supplied buffer with a database column. */
/*
Associate a user-supplied buffer with a database column. */
RETCODE
SQL_API
RETCODE
SQL_API
SQLBindCol
(
SQLBindCol
(
HSTMT
hstmt
,
HSTMT
hstmt
,
...
@@ -220,10 +220,9 @@ SQLBindCol(
...
@@ -220,10 +220,9 @@ SQLBindCol(
}
}
/*
/*
* Allocate enough bindings if not already done.
* Allocate enough bindings if not already done. Most likely,
* Most likely, execution of a statement would have setup the
* execution of a statement would have setup the necessary bindings.
* necessary bindings. But some apps call BindCol before any
* But some apps call BindCol before any statement is executed.
* statement is executed.
*/
*/
if
(
icol
>
stmt
->
bindings_allocated
)
if
(
icol
>
stmt
->
bindings_allocated
)
extend_bindings
(
stmt
,
icol
);
extend_bindings
(
stmt
,
icol
);
...
@@ -467,10 +466,11 @@ extend_bindings(StatementClass *stmt, int num_columns)
...
@@ -467,10 +466,11 @@ extend_bindings(StatementClass *stmt, int num_columns)
stmt
->
bindings
=
new_bindings
;
stmt
->
bindings
=
new_bindings
;
stmt
->
bindings_allocated
=
num_columns
;
stmt
->
bindings_allocated
=
num_columns
;
}
}
/*
/*
* There is no reason to zero out extra bindings if there are
* There is no reason to zero out extra bindings if there are
more
*
more than needed. If an app has allocated extra bindings,
*
than needed. If an app has allocated extra bindings, let it worry
*
let it worry
about it by unbinding those columns.
* about it by unbinding those columns.
*/
*/
/* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */
/* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */
...
...
src/interfaces/odbc/columninfo.c
View file @
1c551683
...
@@ -61,7 +61,8 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
...
@@ -61,7 +61,8 @@ CI_read_fields(ColumnInfoClass *self, ConnectionClass *conn)
Oid
new_adtid
;
Oid
new_adtid
;
Int2
new_adtsize
;
Int2
new_adtsize
;
Int4
new_atttypmod
=
-
1
;
Int4
new_atttypmod
=
-
1
;
/* MAX_COLUMN_LEN may be sufficient but for safety */
/* MAX_COLUMN_LEN may be sufficient but for safety */
char
new_field_name
[
2
*
MAX_COLUMN_LEN
+
1
];
char
new_field_name
[
2
*
MAX_COLUMN_LEN
+
1
];
SocketClass
*
sock
;
SocketClass
*
sock
;
ConnInfo
*
ci
;
ConnInfo
*
ci
;
...
@@ -152,7 +153,7 @@ CI_set_num_fields(ColumnInfoClass *self, int new_num_fields)
...
@@ -152,7 +153,7 @@ CI_set_num_fields(ColumnInfoClass *self, int new_num_fields)
self
->
num_fields
=
new_num_fields
;
self
->
num_fields
=
new_num_fields
;
self
->
name
=
(
char
**
)
malloc
(
sizeof
(
char
*
)
*
self
->
num_fields
);
self
->
name
=
(
char
**
)
malloc
(
sizeof
(
char
*
)
*
self
->
num_fields
);
memset
(
self
->
name
,
0
,
sizeof
(
char
*
)
*
self
->
num_fields
);
memset
(
self
->
name
,
0
,
sizeof
(
char
*
)
*
self
->
num_fields
);
self
->
adtid
=
(
Oid
*
)
malloc
(
sizeof
(
Oid
)
*
self
->
num_fields
);
self
->
adtid
=
(
Oid
*
)
malloc
(
sizeof
(
Oid
)
*
self
->
num_fields
);
self
->
adtsize
=
(
Int2
*
)
malloc
(
sizeof
(
Int2
)
*
self
->
num_fields
);
self
->
adtsize
=
(
Int2
*
)
malloc
(
sizeof
(
Int2
)
*
self
->
num_fields
);
self
->
display_size
=
(
Int2
*
)
malloc
(
sizeof
(
Int2
)
*
self
->
num_fields
);
self
->
display_size
=
(
Int2
*
)
malloc
(
sizeof
(
Int2
)
*
self
->
num_fields
);
...
...
src/interfaces/odbc/connection.c
View file @
1c551683
...
@@ -762,7 +762,7 @@ CC_connect(ConnectionClass *self, char do_password)
...
@@ -762,7 +762,7 @@ CC_connect(ConnectionClass *self, char do_password)
CC_set_translation
(
self
);
CC_set_translation
(
self
);
/*
/*
*
Send any initial settings
*
Send any initial settings
*/
*/
/*
/*
...
@@ -915,8 +915,10 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
...
@@ -915,8 +915,10 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi)
char
swallow
;
char
swallow
;
int
id
;
int
id
;
SocketClass
*
sock
=
self
->
sock
;
SocketClass
*
sock
=
self
->
sock
;
/* ERROR_MSG_LENGTH is suffcient */
/* ERROR_MSG_LENGTH is suffcient */
static
char
msgbuffer
[
ERROR_MSG_LENGTH
+
1
];
static
char
msgbuffer
[
ERROR_MSG_LENGTH
+
1
];
/* QR_set_command() dups this string so doesn't need static */
/* QR_set_command() dups this string so doesn't need static */
char
cmdbuffer
[
ERROR_MSG_LENGTH
+
1
];
char
cmdbuffer
[
ERROR_MSG_LENGTH
+
1
];
...
@@ -1210,6 +1212,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
...
@@ -1210,6 +1212,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
c
,
c
,
done
;
done
;
SocketClass
*
sock
=
self
->
sock
;
SocketClass
*
sock
=
self
->
sock
;
/* ERROR_MSG_LENGTH is sufficient */
/* ERROR_MSG_LENGTH is sufficient */
static
char
msgbuffer
[
ERROR_MSG_LENGTH
+
1
];
static
char
msgbuffer
[
ERROR_MSG_LENGTH
+
1
];
int
i
;
int
i
;
...
@@ -1590,8 +1593,8 @@ CC_lookup_pg_version(ConnectionClass *self)
...
@@ -1590,8 +1593,8 @@ CC_lookup_pg_version(ConnectionClass *self)
}
}
/*
/*
*
Extract the Major and Minor numbers from the string.
*
Extract the Major and Minor numbers from the string. This assumes
*
This assumes
the string starts 'Postgresql X.X'
* the string starts 'Postgresql X.X'
*/
*/
strcpy
(
szVersion
,
"0.0"
);
strcpy
(
szVersion
,
"0.0"
);
if
(
sscanf
(
self
->
pg_version
,
"%*s %d.%d"
,
&
major
,
&
minor
)
>=
2
)
if
(
sscanf
(
self
->
pg_version
,
"%*s %d.%d"
,
&
major
,
&
minor
)
>=
2
)
...
...
src/interfaces/odbc/convert.c
View file @
1c551683
...
@@ -69,7 +69,7 @@ extern GLOBAL_VALUES globals;
...
@@ -69,7 +69,7 @@ extern GLOBAL_VALUES globals;
* How to map ODBC scalar functions {fn func(args)} to Postgres.
* How to map ODBC scalar functions {fn func(args)} to Postgres.
* This is just a simple substitution. List augmented from:
* This is just a simple substitution. List augmented from:
* http://www.merant.com/datadirect/download/docs/odbc16/Odbcref/rappc.htm
* http://www.merant.com/datadirect/download/docs/odbc16/Odbcref/rappc.htm
*
- thomas 2000-04-03
* - thomas 2000-04-03
*/
*/
char
*
mapFuncs
[][
2
]
=
{
char
*
mapFuncs
[][
2
]
=
{
/* { "ASCII", "ascii" }, */
/* { "ASCII", "ascii" }, */
...
@@ -199,9 +199,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
...
@@ -199,9 +199,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
*/
*/
if
(
bind_size
>
0
)
if
(
bind_size
>
0
)
{
pcbValueOffset
=
rgbValueOffset
=
(
bind_size
*
bind_row
);
pcbValueOffset
=
rgbValueOffset
=
(
bind_size
*
bind_row
);
}
else
else
{
{
pcbValueOffset
=
bind_row
*
sizeof
(
SDWORD
);
pcbValueOffset
=
bind_row
*
sizeof
(
SDWORD
);
...
@@ -221,9 +219,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
...
@@ -221,9 +219,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
if
(
!
value
)
if
(
!
value
)
{
{
/*
/*
* handle a null just by returning SQL_NULL_DATA in pcbValue,
* handle a null just by returning SQL_NULL_DATA in pcbValue,
and
*
and
doing nothing to the buffer.
* doing nothing to the buffer.
*/
*/
if
(
pcbValue
)
if
(
pcbValue
)
*
(
SDWORD
*
)
((
char
*
)
pcbValue
+
pcbValueOffset
)
=
SQL_NULL_DATA
;
*
(
SDWORD
*
)
((
char
*
)
pcbValue
+
pcbValueOffset
)
=
SQL_NULL_DATA
;
...
@@ -242,18 +241,18 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
...
@@ -242,18 +241,18 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
}
}
/*
/*
* First convert any specific postgres types into more
* First convert any specific postgres types into more useable data.
* useable data.
*
*
*
NOTE: Conversions from PG char/varchar of a date/time/timestamp
*
NOTE: Conversions from PG char/varchar of a date/time/timestamp value
*
value
to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
* to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
*/
*/
switch
(
field_type
)
switch
(
field_type
)
{
{
/*
* $$$ need to add parsing for date/time/timestamp strings in
/*
* PG_TYPE_CHAR,VARCHAR $$$
* $$$ need to add parsing for date/time/timestamp strings in
*/
* PG_TYPE_CHAR,VARCHAR $$$
*/
case
PG_TYPE_DATE
:
case
PG_TYPE_DATE
:
sscanf
(
value
,
"%4d-%2d-%2d"
,
&
st
.
y
,
&
st
.
m
,
&
st
.
d
);
sscanf
(
value
,
"%4d-%2d-%2d"
,
&
st
.
y
,
&
st
.
m
,
&
st
.
d
);
break
;
break
;
...
@@ -269,9 +268,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
...
@@ -269,9 +268,10 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
sscanf
(
value
,
"%4d-%2d-%2d %2d:%2d:%2d"
,
&
st
.
y
,
&
st
.
m
,
&
st
.
d
,
&
st
.
hh
,
&
st
.
mm
,
&
st
.
ss
);
sscanf
(
value
,
"%4d-%2d-%2d %2d:%2d:%2d"
,
&
st
.
y
,
&
st
.
m
,
&
st
.
d
,
&
st
.
hh
,
&
st
.
mm
,
&
st
.
ss
);
else
else
{
{
/*
/*
* The timestamp is invalid so set
* The timestamp is invalid so set
something conspicuous,
*
something conspicuous,
like the epoch
* like the epoch
*/
*/
t
=
0
;
t
=
0
;
tim
=
localtime
(
&
t
);
tim
=
localtime
(
&
t
);
...
@@ -295,7 +295,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
...
@@ -295,7 +295,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
}
}
break
;
break
;
/* This is for internal use by SQLStatistics() */
/* This is for internal use by SQLStatistics() */
case
PG_TYPE_INT2VECTOR
:
case
PG_TYPE_INT2VECTOR
:
{
{
int
nval
,
int
nval
,
...
@@ -379,6 +379,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
...
@@ -379,6 +379,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
if
(
fCType
==
SQL_C_CHAR
)
if
(
fCType
==
SQL_C_CHAR
)
{
{
/* Special character formatting as required */
/* Special character formatting as required */
/*
/*
* These really should return error if cbValueMax is not big
* These really should return error if cbValueMax is not big
* enough.
* enough.
...
@@ -483,6 +484,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
...
@@ -483,6 +484,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
}
}
else
else
{
{
/*
/*
* for SQL_C_CHAR, it's probably ok to leave currency symbols in.
* 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
* But to convert to numeric types, it is necessary to get rid of
...
@@ -780,8 +782,10 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -780,8 +782,10 @@ copy_statement_with_parameters(StatementClass *stmt)
#ifdef MULTIBYTE
#ifdef MULTIBYTE
char
*
end
=
multibyte_strchr
(
begin
,
'}'
);
char
*
end
=
multibyte_strchr
(
begin
,
'}'
);
#else
#else
char
*
end
=
strchr
(
begin
,
'}'
);
char
*
end
=
strchr
(
begin
,
'}'
);
#endif
#endif
if
(
!
end
)
if
(
!
end
)
...
@@ -806,6 +810,7 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -806,6 +810,7 @@ copy_statement_with_parameters(StatementClass *stmt)
*
end
=
'}'
;
*
end
=
'}'
;
continue
;
continue
;
}
}
/*
/*
* Can you have parameter markers inside of quotes? I dont think
* Can you have parameter markers inside of quotes? I dont think
* so. All the queries I've seen expect the driver to put quotes
* so. All the queries I've seen expect the driver to put quotes
...
@@ -1101,9 +1106,7 @@ copy_statement_with_parameters(StatementClass *stmt)
...
@@ -1101,9 +1106,7 @@ copy_statement_with_parameters(StatementClass *stmt)
case
SQL_LONGVARBINARY
:
case
SQL_LONGVARBINARY
:
if
(
stmt
->
parameters
[
param_number
].
data_at_exec
)
if
(
stmt
->
parameters
[
param_number
].
data_at_exec
)
{
lobj_oid
=
stmt
->
parameters
[
param_number
].
lobj_oid
;
lobj_oid
=
stmt
->
parameters
[
param_number
].
lobj_oid
;
}
else
else
{
{
/* begin transaction if needed */
/* begin transaction if needed */
...
@@ -1308,7 +1311,8 @@ convert_escape(char *value)
...
@@ -1308,7 +1311,8 @@ convert_escape(char *value)
if
((
strcmp
(
key
,
"d"
)
==
0
)
||
if
((
strcmp
(
key
,
"d"
)
==
0
)
||
(
strcmp
(
key
,
"t"
)
==
0
)
||
(
strcmp
(
key
,
"t"
)
==
0
)
||
(
strcmp
(
key
,
"oj"
)
==
0
)
||
/* {oj syntax support for 7.1 servers */
(
strcmp
(
key
,
"oj"
)
==
0
)
||
/* {oj syntax support for 7.1
* servers */
(
strcmp
(
key
,
"ts"
)
==
0
))
(
strcmp
(
key
,
"ts"
)
==
0
))
{
{
/* Literal; return the escape part as-is */
/* Literal; return the escape part as-is */
...
@@ -1316,6 +1320,7 @@ convert_escape(char *value)
...
@@ -1316,6 +1320,7 @@ convert_escape(char *value)
}
}
else
if
(
strcmp
(
key
,
"fn"
)
==
0
)
else
if
(
strcmp
(
key
,
"fn"
)
==
0
)
{
{
/*
/*
* Function invocation Separate off the func name, skipping
* Function invocation Separate off the func name, skipping
* trailing whitespace.
* trailing whitespace.
...
@@ -1722,7 +1727,7 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
...
@@ -1722,7 +1727,7 @@ convert_lo(StatementClass *stmt, void *value, Int2 fCType, PTR rgbValue,
BindInfoClass
*
bindInfo
=
NULL
;
BindInfoClass
*
bindInfo
=
NULL
;
/*
If using SQLGetData, then current_col will be set */
/*
If using SQLGetData, then current_col will be set */
if
(
stmt
->
current_col
>=
0
)
if
(
stmt
->
current_col
>=
0
)
{
{
bindInfo
=
&
stmt
->
bindings
[
stmt
->
current_col
];
bindInfo
=
&
stmt
->
bindings
[
stmt
->
current_col
];
...
...
src/interfaces/odbc/dlg_specific.c
View file @
1c551683
...
@@ -56,6 +56,7 @@ extern GLOBAL_VALUES globals;
...
@@ -56,6 +56,7 @@ extern GLOBAL_VALUES globals;
void
void
SetDlgStuff
(
HWND
hdlg
,
ConnInfo
*
ci
)
SetDlgStuff
(
HWND
hdlg
,
ConnInfo
*
ci
)
{
{
/*
/*
* If driver attribute NOT present, then set the datasource name and
* If driver attribute NOT present, then set the datasource name and
* description
* description
...
@@ -269,7 +270,7 @@ ds_optionsProc(HWND hdlg,
...
@@ -269,7 +270,7 @@ ds_optionsProc(HWND hdlg,
else
else
/* latest */
/* latest */
CheckDlgButton
(
hdlg
,
DS_PG64
,
1
);
CheckDlgButton
(
hdlg
,
DS_PG64
,
1
);
CheckDlgButton
(
hdlg
,
DS_SHOWOIDCOLUMN
,
atoi
(
ci
->
show_oid_column
));
CheckDlgButton
(
hdlg
,
DS_SHOWOIDCOLUMN
,
atoi
(
ci
->
show_oid_column
));
CheckDlgButton
(
hdlg
,
DS_FAKEOIDINDEX
,
atoi
(
ci
->
fake_oid_index
));
CheckDlgButton
(
hdlg
,
DS_FAKEOIDINDEX
,
atoi
(
ci
->
fake_oid_index
));
CheckDlgButton
(
hdlg
,
DS_ROWVERSIONING
,
atoi
(
ci
->
row_versioning
));
CheckDlgButton
(
hdlg
,
DS_ROWVERSIONING
,
atoi
(
ci
->
row_versioning
));
...
@@ -791,6 +792,7 @@ getGlobalDefaults(char *section, char *filename, char override)
...
@@ -791,6 +792,7 @@ getGlobalDefaults(char *section, char *filename, char override)
/* Dont allow override of an override! */
/* Dont allow override of an override! */
if
(
!
override
)
if
(
!
override
)
{
{
/*
/*
* ConnSettings is stored in the driver section and per datasource
* ConnSettings is stored in the driver section and per datasource
* for override
* for override
...
...
src/interfaces/odbc/drvconn.c
View file @
1c551683
...
@@ -112,9 +112,9 @@ SQLDriverConnect(
...
@@ -112,9 +112,9 @@ SQLDriverConnect(
dconn_get_connect_attributes
(
connStrIn
,
ci
);
dconn_get_connect_attributes
(
connStrIn
,
ci
);
/*
/*
* If the ConnInfo in the hdbc is missing anything,
* If the ConnInfo in the hdbc is missing anything,
this function will
*
this function will fill them in from the registry (assuming
*
fill them in from the registry (assuming of course there is a DSN
*
of course there is a DSN
given -- if not, it does nothing!)
* given -- if not, it does nothing!)
*/
*/
getDSNinfo
(
ci
,
CONN_DONT_OVERWRITE
);
getDSNinfo
(
ci
,
CONN_DONT_OVERWRITE
);
...
@@ -175,7 +175,7 @@ dialog:
...
@@ -175,7 +175,7 @@ dialog:
ci
->
database
[
0
]
==
'\0'
||
ci
->
database
[
0
]
==
'\0'
||
ci
->
port
[
0
]
==
'\0'
)
ci
->
port
[
0
]
==
'\0'
)
{
{
/*
(password_required && ci->password[0] == '\0')) */
/*
(password_required && ci->password[0] == '\0')) */
return
SQL_NO_DATA_FOUND
;
return
SQL_NO_DATA_FOUND
;
}
}
...
@@ -217,6 +217,7 @@ dialog:
...
@@ -217,6 +217,7 @@ dialog:
if
(
szConnStrOut
)
if
(
szConnStrOut
)
{
{
/*
/*
* Return the completed string to the caller. The correct method
* Return the completed string to the caller. The correct method
* is to only construct the connect string if a dialog was put up,
* is to only construct the connect string if a dialog was put up,
...
...
src/interfaces/odbc/environ.c
View file @
1c551683
...
@@ -308,6 +308,7 @@ SQLError(
...
@@ -308,6 +308,7 @@ SQLError(
break
;
break
;
case
CONN_TRANSACT_IN_PROGRES
:
case
CONN_TRANSACT_IN_PROGRES
:
strcpy
(
szSqlState
,
"S1010"
);
strcpy
(
szSqlState
,
"S1010"
);
/*
/*
* when the user tries to switch commit mode in a
* when the user tries to switch commit mode in a
* transaction
* transaction
...
@@ -441,8 +442,8 @@ EN_Destructor(EnvironmentClass *self)
...
@@ -441,8 +442,8 @@ EN_Destructor(EnvironmentClass *self)
mylog
(
"in EN_Destructor, self=%u
\n
"
,
self
);
mylog
(
"in EN_Destructor, self=%u
\n
"
,
self
);
/*
/*
* the error messages are static strings distributed throughout
* the error messages are static strings distributed throughout
the
*
the
source--they should not be freed
* source--they should not be freed
*/
*/
/* Free any connections belonging to this environment */
/* Free any connections belonging to this environment */
...
...
src/interfaces/odbc/execute.c
View file @
1c551683
...
@@ -153,8 +153,8 @@ SQLExecDirect(
...
@@ -153,8 +153,8 @@ SQLExecDirect(
free
(
stmt
->
statement
);
free
(
stmt
->
statement
);
/*
/*
* keep a copy of the un-parametrized statement, in case
* keep a copy of the un-parametrized statement, in case
they try to
*
they try to
execute this statement again
* execute this statement again
*/
*/
stmt
->
statement
=
make_string
(
szSqlStr
,
cbSqlStr
,
NULL
);
stmt
->
statement
=
make_string
(
szSqlStr
,
cbSqlStr
,
NULL
);
if
(
!
stmt
->
statement
)
if
(
!
stmt
->
statement
)
...
@@ -170,9 +170,9 @@ SQLExecDirect(
...
@@ -170,9 +170,9 @@ SQLExecDirect(
stmt
->
prepare
=
FALSE
;
stmt
->
prepare
=
FALSE
;
/*
/*
* If an SQLPrepare was performed prior to this, but was left in
* If an SQLPrepare was performed prior to this, but was left in
the
*
the premature state because an error occurred prior to SQLExecute
*
premature state because an error occurred prior to SQLExecute then
*
then
set the statement to finished so it can be recycled.
* set the statement to finished so it can be recycled.
*/
*/
if
(
stmt
->
status
==
STMT_PREMATURE
)
if
(
stmt
->
status
==
STMT_PREMATURE
)
stmt
->
status
=
STMT_FINISHED
;
stmt
->
status
=
STMT_FINISHED
;
...
@@ -288,18 +288,23 @@ SQLExecute(
...
@@ -288,18 +288,23 @@ SQLExecute(
return
SQL_ERROR
;
return
SQL_ERROR
;
}
}
/* Check if statement has any data-at-execute parameters when it is not in SC_pre_execute. */
/*
* Check if statement has any data-at-execute parameters when it is
* not in SC_pre_execute.
*/
if
(
!
stmt
->
pre_executing
)
if
(
!
stmt
->
pre_executing
)
{
{
/*
/*
* The bound parameters could have possibly changed since the last
* The bound parameters could have possibly changed since the last
* execute of this statement? Therefore check for params and re-copy.
* execute of this statement? Therefore check for params and
* re-copy.
*/
*/
stmt
->
data_at_exec
=
-
1
;
stmt
->
data_at_exec
=
-
1
;
for
(
i
=
0
;
i
<
stmt
->
parameters_allocated
;
i
++
)
for
(
i
=
0
;
i
<
stmt
->
parameters_allocated
;
i
++
)
{
{
Int4
*
pcVal
=
stmt
->
parameters
[
i
].
used
;
Int4
*
pcVal
=
stmt
->
parameters
[
i
].
used
;
if
(
pcVal
&&
(
*
pcVal
==
SQL_DATA_AT_EXEC
||
*
pcVal
<=
SQL_LEN_DATA_AT_EXEC_OFFSET
))
if
(
pcVal
&&
(
*
pcVal
==
SQL_DATA_AT_EXEC
||
*
pcVal
<=
SQL_LEN_DATA_AT_EXEC_OFFSET
))
stmt
->
parameters
[
i
].
data_at_exec
=
TRUE
;
stmt
->
parameters
[
i
].
data_at_exec
=
TRUE
;
else
else
...
@@ -313,11 +318,15 @@ SQLExecute(
...
@@ -313,11 +318,15 @@ SQLExecute(
stmt
->
data_at_exec
++
;
stmt
->
data_at_exec
++
;
}
}
}
}
/* If there are some data at execution parameters, return need data */
/*
/*
* SQLParamData and SQLPutData will be used to send params and execute
* If there are some data at execution parameters, return need
* the statement.
* data
*/
/*
* SQLParamData and SQLPutData will be used to send params and
* execute the statement.
*/
*/
if
(
stmt
->
data_at_exec
>
0
)
if
(
stmt
->
data_at_exec
>
0
)
return
SQL_NEED_DATA
;
return
SQL_NEED_DATA
;
...
@@ -449,6 +458,7 @@ SQLCancel(
...
@@ -449,6 +458,7 @@ SQLCancel(
*/
*/
if
(
stmt
->
data_at_exec
<
0
)
if
(
stmt
->
data_at_exec
<
0
)
{
{
/*
/*
* MAJOR HACK for Windows to reset the driver manager's cursor
* MAJOR HACK for Windows to reset the driver manager's cursor
* state: Because of what seems like a bug in the Odbc driver
* state: Because of what seems like a bug in the Odbc driver
...
@@ -753,8 +763,8 @@ SQLPutData(
...
@@ -753,8 +763,8 @@ SQLPutData(
}
}
/*
/*
* major hack -- to allow convert to see somethings there
* major hack -- to allow convert to see somethings there
have
*
have
to modify convert to handle this better
* to modify convert to handle this better
*/
*/
current_param
->
EXEC_buffer
=
(
char
*
)
&
current_param
->
lobj_oid
;
current_param
->
EXEC_buffer
=
(
char
*
)
&
current_param
->
lobj_oid
;
...
@@ -787,7 +797,8 @@ SQLPutData(
...
@@ -787,7 +797,8 @@ SQLPutData(
}
}
else
else
{
{
Int2
ctype
=
current_param
->
CType
;
Int2
ctype
=
current_param
->
CType
;
if
(
ctype
==
SQL_C_DEFAULT
)
if
(
ctype
==
SQL_C_DEFAULT
)
ctype
=
sqltype_to_default_ctype
(
current_param
->
SQLType
);
ctype
=
sqltype_to_default_ctype
(
current_param
->
SQLType
);
if
(
ctype
==
SQL_C_CHAR
||
ctype
==
SQL_C_BINARY
)
if
(
ctype
==
SQL_C_CHAR
||
ctype
==
SQL_C_BINARY
)
...
@@ -805,7 +816,8 @@ SQLPutData(
...
@@ -805,7 +816,8 @@ SQLPutData(
}
}
else
else
{
{
Int4
used
=
ctype_length
(
ctype
);
Int4
used
=
ctype_length
(
ctype
);
current_param
->
EXEC_buffer
=
malloc
(
used
);
current_param
->
EXEC_buffer
=
malloc
(
used
);
if
(
!
current_param
->
EXEC_buffer
)
if
(
!
current_param
->
EXEC_buffer
)
{
{
...
...
src/interfaces/odbc/gpps.c
View file @
1c551683
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
DWORD
DWORD
GetPrivateProfileString
(
char
*
theSection
,
/* section name */
GetPrivateProfileString
(
char
*
theSection
,
/* section name */
char
*
theKey
,
/* search key name */
char
*
theKey
,
/* search key name */
char
*
theDefault
,
/* default value if not
char
*
theDefault
,
/* default value if not
* found */
* found */
char
*
theReturnBuffer
,
/* return value stored
char
*
theReturnBuffer
,
/* return value stored
...
@@ -281,7 +281,7 @@ GetPrivateProfileString(char *theSection, /* section name */
...
@@ -281,7 +281,7 @@ GetPrivateProfileString(char *theSection, /* section name */
DWORD
DWORD
WritePrivateProfileString
(
char
*
theSection
,
/* section name */
WritePrivateProfileString
(
char
*
theSection
,
/* section name */
char
*
theKey
,
/* write key name */
char
*
theKey
,
/* write key name */
char
*
theBuffer
,
/* input buffer */
char
*
theBuffer
,
/* input buffer */
char
*
theIniFileName
)
/* pathname of ini file to
char
*
theIniFileName
)
/* pathname of ini file to
* write */
* write */
...
@@ -298,7 +298,7 @@ WritePrivateProfileString(char *theSection, /* section name */
...
@@ -298,7 +298,7 @@ WritePrivateProfileString(char *theSection, /* section name */
*/
*/
DWORD
DWORD
WritePrivateProfileString(char *theSection, /* section name */
WritePrivateProfileString(char *theSection, /* section name */
char *theKey,
/* write key name */
char *theKey, /* write key name */
char *theBuffer, /* input buffer */
char *theBuffer, /* input buffer */
char *theIniFileName) /* pathname of ini file to
char *theIniFileName) /* pathname of ini file to
* write */
* write */
...
@@ -342,9 +342,8 @@ WritePrivateProfileString(char *theSection, /* section name */
...
@@ -342,9 +342,8 @@ WritePrivateProfileString(char *theSection, /* section name */
/*
/*
* This doesn't make it so we find an ini file but allows normal
* This doesn't make it so we find an ini file but allows normal
* processing to continue further on down. The likelihood is that
* processing to continue further on down. The likelihood is that the
* the file won't be found and thus the default value will be
* file won't be found and thus the default value will be returned.
* returned.
*/
*/
if (MAXPGPATH - 1 < strlen(ptr) + j)
if (MAXPGPATH - 1 < strlen(ptr) + j)
{
{
...
@@ -357,8 +356,8 @@ WritePrivateProfileString(char *theSection, /* section name */
...
@@ -357,8 +356,8 @@ WritePrivateProfileString(char *theSection, /* section name */
sprintf(buf, "%s/%s", ptr, theIniFileName);
sprintf(buf, "%s/%s", ptr, theIniFileName);
/*
/*
* This code makes it so that a file in the users home dir
* This code makes it so that a file in the users home dir
overrides a
*
overrides a
the "default" file as passed in
* the "default" file as passed in
*/
*/
aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL);
aFile = (FILE *) (buf ? fopen(buf, "r+") : NULL);
if (!aFile)
if (!aFile)
...
@@ -372,9 +371,9 @@ WritePrivateProfileString(char *theSection, /* section name */
...
@@ -372,9 +371,9 @@ WritePrivateProfileString(char *theSection, /* section name */
aLength = strlen(theBuffer);
aLength = strlen(theBuffer);
/*
/*
* We have to search for theKey, because if it already
* We have to search for theKey, because if it already
exists we have
*
exists we have to overwrite it. If it doesn't exist
*
to overwrite it. If it doesn't exist we just write a new line to
*
we just write a new line to
the file.
* the file.
*/
*/
while (fgets(aLine, sizeof(aLine), aFile) != NULL)
while (fgets(aLine, sizeof(aLine), aFile) != NULL)
{
{
...
...
src/interfaces/odbc/info.c
View file @
1c551683
...
@@ -153,6 +153,7 @@ SQLGetInfo(
...
@@ -153,6 +153,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_CORRELATION_NAME
:
/* ODBC 1.0 */
case
SQL_CORRELATION_NAME
:
/* ODBC 1.0 */
/*
/*
* Saying no correlation name makes Query not work right.
* Saying no correlation name makes Query not work right.
* value = SQL_CN_NONE;
* value = SQL_CN_NONE;
...
@@ -180,6 +181,7 @@ SQLGetInfo(
...
@@ -180,6 +181,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_DATABASE_NAME
:
/* Support for old ODBC 1.0 Apps */
case
SQL_DATABASE_NAME
:
/* Support for old ODBC 1.0 Apps */
/*
/*
* Returning the database name causes problems in MS Query. It
* Returning the database name causes problems in MS Query. It
* generates query like: "SELECT DISTINCT a FROM byronnbad3
* generates query like: "SELECT DISTINCT a FROM byronnbad3
...
@@ -195,6 +197,7 @@ SQLGetInfo(
...
@@ -195,6 +197,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_DBMS_VER
:
/* ODBC 1.0 */
case
SQL_DBMS_VER
:
/* ODBC 1.0 */
/*
/*
* The ODBC spec wants ##.##.#### ...whatever... so prepend
* The ODBC spec wants ##.##.#### ...whatever... so prepend
* the driver
* the driver
...
@@ -252,6 +255,7 @@ SQLGetInfo(
...
@@ -252,6 +255,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_IDENTIFIER_CASE
:
/* ODBC 1.0 */
case
SQL_IDENTIFIER_CASE
:
/* ODBC 1.0 */
/*
/*
* are identifiers case-sensitive (yes, but only when quoted.
* are identifiers case-sensitive (yes, but only when quoted.
* If not quoted, they default to lowercase)
* If not quoted, they default to lowercase)
...
@@ -270,6 +274,7 @@ SQLGetInfo(
...
@@ -270,6 +274,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_LIKE_ESCAPE_CLAUSE
:
/* ODBC 2.0 */
case
SQL_LIKE_ESCAPE_CLAUSE
:
/* ODBC 2.0 */
/*
/*
* is there a character that escapes '%' and '_' in a LIKE
* is there a character that escapes '%' and '_' in a LIKE
* clause? not as far as I can tell
* clause? not as far as I can tell
...
@@ -362,6 +367,7 @@ SQLGetInfo(
...
@@ -362,6 +367,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_MAX_ROW_SIZE_INCLUDES_LONG
:
/* ODBC 2.0 */
case
SQL_MAX_ROW_SIZE_INCLUDES_LONG
:
/* ODBC 2.0 */
/*
/*
* does the preceding value include LONGVARCHAR and
* does the preceding value include LONGVARCHAR and
* LONGVARBINARY fields? Well, it does include longvarchar,
* LONGVARBINARY fields? Well, it does include longvarchar,
...
@@ -377,7 +383,7 @@ SQLGetInfo(
...
@@ -377,7 +383,7 @@ SQLGetInfo(
if
(
PG_VERSION_GE
(
conn
,
7
.
0
))
if
(
PG_VERSION_GE
(
conn
,
7
.
0
))
value
=
MAX_STATEMENT_LEN
;
value
=
MAX_STATEMENT_LEN
;
/* Prior to 7.0 we used 2*BLCKSZ */
/* Prior to 7.0 we used 2*BLCKSZ */
else
if
(
PG_VERSION_GE
(
conn
,
6
.
5
))
else
if
(
PG_VERSION_GE
(
conn
,
6
.
5
))
value
=
(
2
*
BLCKSZ
);
value
=
(
2
*
BLCKSZ
);
else
else
/* Prior to 6.5 we used BLCKSZ */
/* Prior to 6.5 we used BLCKSZ */
...
@@ -410,6 +416,7 @@ SQLGetInfo(
...
@@ -410,6 +416,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_NEED_LONG_DATA_LEN
:
/* ODBC 2.0 */
case
SQL_NEED_LONG_DATA_LEN
:
/* ODBC 2.0 */
/*
/*
* Don't need the length, SQLPutData can handle any size and
* Don't need the length, SQLPutData can handle any size and
* multiple calls
* multiple calls
...
@@ -537,6 +544,7 @@ SQLGetInfo(
...
@@ -537,6 +544,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_ROW_UPDATES
:
/* ODBC 1.0 */
case
SQL_ROW_UPDATES
:
/* ODBC 1.0 */
/*
/*
* Driver doesn't support keyset-driven or mixed cursors, so
* Driver doesn't support keyset-driven or mixed cursors, so
* not much point in saying row updates are supported
* not much point in saying row updates are supported
...
@@ -624,6 +632,7 @@ SQLGetInfo(
...
@@ -624,6 +632,7 @@ SQLGetInfo(
break
;
break
;
case
SQL_TXN_CAPABLE
:
/* ODBC 1.0 */
case
SQL_TXN_CAPABLE
:
/* ODBC 1.0 */
/*
/*
* Postgres can deal with create or drop table statements in a
* Postgres can deal with create or drop table statements in a
* transaction
* transaction
...
@@ -1297,6 +1306,7 @@ SQLTables(
...
@@ -1297,6 +1306,7 @@ SQLTables(
result
=
SQLFetch
(
htbl_stmt
);
result
=
SQLFetch
(
htbl_stmt
);
while
((
result
==
SQL_SUCCESS
)
||
(
result
==
SQL_SUCCESS_WITH_INFO
))
while
((
result
==
SQL_SUCCESS
)
||
(
result
==
SQL_SUCCESS_WITH_INFO
))
{
{
/*
/*
* Determine if this table name is a system table. If treating
* Determine if this table name is a system table. If treating
* system tables as regular tables, then no need to do this test.
* system tables as regular tables, then no need to do this test.
...
@@ -1351,9 +1361,9 @@ SQLTables(
...
@@ -1351,9 +1361,9 @@ SQLTables(
/*
/*
* I have to hide the table owner from Access, otherwise it
* I have to hide the table owner from Access, otherwise it
* insists on referring to the table as 'owner.table'.
* insists on referring to the table as 'owner.table'.
(this
*
(this is valid according to the ODBC SQL grammar, but
*
is valid according to the ODBC SQL grammar, but Postgres
*
Postgres
won't support it.)
* won't support it.)
*
*
* set_tuplefield_string(&row->tuple[1], table_owner);
* set_tuplefield_string(&row->tuple[1], table_owner);
*/
*/
...
@@ -1379,8 +1389,8 @@ SQLTables(
...
@@ -1379,8 +1389,8 @@ SQLTables(
}
}
/*
/*
* also, things need to think that this statement is finished so
* also, things need to think that this statement is finished so
the
*
the
results can be retrieved.
* results can be retrieved.
*/
*/
stmt
->
status
=
STMT_FINISHED
;
stmt
->
status
=
STMT_FINISHED
;
...
@@ -1463,8 +1473,8 @@ SQLColumns(
...
@@ -1463,8 +1473,8 @@ SQLColumns(
my_strcat
(
columns_query
,
" and a.attname like '%.*s'"
,
szColumnName
,
cbColumnName
);
my_strcat
(
columns_query
,
" and a.attname like '%.*s'"
,
szColumnName
,
cbColumnName
);
/*
/*
* give the output in the order the columns were defined
* give the output in the order the columns were defined
when the
*
when the
table was created
* table was created
*/
*/
strcat
(
columns_query
,
" order by attnum"
);
strcat
(
columns_query
,
" order by attnum"
);
...
@@ -1787,8 +1797,8 @@ SQLColumns(
...
@@ -1787,8 +1797,8 @@ SQLColumns(
}
}
/*
/*
* Put the row version column at the end so it might not be
* Put the row version column at the end so it might not be
mistaken
*
mistaken
for a key field.
* for a key field.
*/
*/
if
(
relhasrules
[
0
]
!=
'1'
&&
!
stmt
->
internal
&&
atoi
(
ci
->
row_versioning
))
if
(
relhasrules
[
0
]
!=
'1'
&&
!
stmt
->
internal
&&
atoi
(
ci
->
row_versioning
))
{
{
...
@@ -1817,8 +1827,8 @@ SQLColumns(
...
@@ -1817,8 +1827,8 @@ SQLColumns(
}
}
/*
/*
* also, things need to think that this statement is finished so
* also, things need to think that this statement is finished so
the
*
the
results can be retrieved.
* results can be retrieved.
*/
*/
stmt
->
status
=
STMT_FINISHED
;
stmt
->
status
=
STMT_FINISHED
;
...
@@ -2064,8 +2074,8 @@ SQLStatistics(
...
@@ -2064,8 +2074,8 @@ SQLStatistics(
QR_set_field_info
(
stmt
->
result
,
12
,
"FILTER_CONDITION"
,
PG_TYPE_TEXT
,
MAX_INFO_STRING
);
QR_set_field_info
(
stmt
->
result
,
12
,
"FILTER_CONDITION"
,
PG_TYPE_TEXT
,
MAX_INFO_STRING
);
/*
/*
* only use the table name... the owner should be redundant, and
* only use the table name... the owner should be redundant, and
we
*
we
never use qualifiers.
* never use qualifiers.
*/
*/
table_name
=
make_string
(
szTableName
,
cbTableName
,
NULL
);
table_name
=
make_string
(
szTableName
,
cbTableName
,
NULL
);
if
(
!
table_name
)
if
(
!
table_name
)
...
@@ -2077,8 +2087,8 @@ SQLStatistics(
...
@@ -2077,8 +2087,8 @@ SQLStatistics(
}
}
/*
/*
* we need to get a list of the field names first,
* we need to get a list of the field names first,
so we can return
*
so we can return
them later.
* them later.
*/
*/
result
=
SQLAllocStmt
(
stmt
->
hdbc
,
&
hcol_stmt
);
result
=
SQLAllocStmt
(
stmt
->
hdbc
,
&
hcol_stmt
);
if
((
result
!=
SQL_SUCCESS
)
&&
(
result
!=
SQL_SUCCESS_WITH_INFO
))
if
((
result
!=
SQL_SUCCESS
)
&&
(
result
!=
SQL_SUCCESS_WITH_INFO
))
...
@@ -2168,12 +2178,13 @@ SQLStatistics(
...
@@ -2168,12 +2178,13 @@ SQLStatistics(
result
=
SQLExecDirect
(
hindx_stmt
,
index_query
,
strlen
(
index_query
));
result
=
SQLExecDirect
(
hindx_stmt
,
index_query
,
strlen
(
index_query
));
if
((
result
!=
SQL_SUCCESS
)
&&
(
result
!=
SQL_SUCCESS_WITH_INFO
))
if
((
result
!=
SQL_SUCCESS
)
&&
(
result
!=
SQL_SUCCESS_WITH_INFO
))
{
{
/*
/*
*
"Couldn't execute index query (w/SQLExecDirect) in
*
"Couldn't execute index query (w/SQLExecDirect) in
*
SQLStatistics.";
*
SQLStatistics.";
*/
*/
stmt
->
errormsg
=
SC_create_errormsg
(
hindx_stmt
);
stmt
->
errormsg
=
SC_create_errormsg
(
hindx_stmt
);
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
goto
SEEYA
;
goto
SEEYA
;
...
@@ -2343,7 +2354,7 @@ SQLStatistics(
...
@@ -2343,7 +2354,7 @@ SQLStatistics(
if
(
result
!=
SQL_NO_DATA_FOUND
)
if
(
result
!=
SQL_NO_DATA_FOUND
)
{
{
/* "SQLFetch failed in SQLStatistics."; */
/* "SQLFetch failed in SQLStatistics."; */
stmt
->
errormsg
=
SC_create_errormsg
(
hindx_stmt
);
stmt
->
errormsg
=
SC_create_errormsg
(
hindx_stmt
);
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
stmt
->
errornumber
=
indx_stmt
->
errornumber
;
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
goto
SEEYA
;
goto
SEEYA
;
...
@@ -2352,8 +2363,8 @@ SQLStatistics(
...
@@ -2352,8 +2363,8 @@ SQLStatistics(
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
SQLFreeStmt
(
hindx_stmt
,
SQL_DROP
);
/*
/*
* also, things need to think that this statement is finished so
* also, things need to think that this statement is finished so
the
*
the
results can be retrieved.
* results can be retrieved.
*/
*/
stmt
->
status
=
STMT_FINISHED
;
stmt
->
status
=
STMT_FINISHED
;
...
@@ -2399,7 +2410,7 @@ SQLColumnPrivileges(
...
@@ -2399,7 +2410,7 @@ SQLColumnPrivileges(
mylog
(
"%s: entering...
\n
"
,
func
);
mylog
(
"%s: entering...
\n
"
,
func
);
/*
Neither Access or Borland care about this. */
/*
Neither Access or Borland care about this. */
SC_log_error
(
func
,
"Function not implemented"
,
(
StatementClass
*
)
hstmt
);
SC_log_error
(
func
,
"Function not implemented"
,
(
StatementClass
*
)
hstmt
);
return
SQL_ERROR
;
return
SQL_ERROR
;
...
@@ -2575,8 +2586,8 @@ SQLPrimaryKeys(
...
@@ -2575,8 +2586,8 @@ SQLPrimaryKeys(
/*
/*
* also, things need to think that this statement is finished so
* also, things need to think that this statement is finished so
the
*
the
results can be retrieved.
* results can be retrieved.
*/
*/
stmt
->
status
=
STMT_FINISHED
;
stmt
->
status
=
STMT_FINISHED
;
...
@@ -2636,11 +2647,12 @@ SQLForeignKeys(
...
@@ -2636,11 +2647,12 @@ SQLForeignKeys(
#if (ODBCVER >= 0x0300)
#if (ODBCVER >= 0x0300)
SWORD
defer_type
;
SWORD
defer_type
;
#endif
#endif
char
pkey
[
MAX_INFO_STRING
];
char
pkey
[
MAX_INFO_STRING
];
Int2
result_cols
;
Int2
result_cols
;
mylog
(
"%s: entering...stmt=%u
\n
"
,
func
,
stmt
);
mylog
(
"%s: entering...stmt=%u
\n
"
,
func
,
stmt
);
if
(
!
stmt
)
if
(
!
stmt
)
{
{
...
@@ -2690,8 +2702,8 @@ SQLForeignKeys(
...
@@ -2690,8 +2702,8 @@ SQLForeignKeys(
#endif
/* ODBCVER >= 0x0300 */
#endif
/* ODBCVER >= 0x0300 */
/*
/*
* also, things need to think that this statement is finished so
* also, things need to think that this statement is finished so
the
*
the
results can be retrieved.
* results can be retrieved.
*/
*/
stmt
->
status
=
STMT_FINISHED
;
stmt
->
status
=
STMT_FINISHED
;
...
...
src/interfaces/odbc/lobj.c
View file @
1c551683
...
@@ -41,7 +41,7 @@ lo_open(ConnectionClass *conn, int lobjId, int mode)
...
@@ -41,7 +41,7 @@ lo_open(ConnectionClass *conn, int lobjId, int mode)
int
fd
;
int
fd
;
int
result_len
;
int
result_len
;
LO_ARG
argv
[
2
];
LO_ARG
argv
[
2
];
argv
[
0
].
isint
=
1
;
argv
[
0
].
isint
=
1
;
argv
[
0
].
len
=
4
;
argv
[
0
].
len
=
4
;
argv
[
0
].
u
.
integer
=
lobjId
;
argv
[
0
].
u
.
integer
=
lobjId
;
...
...
src/interfaces/odbc/misc.c
View file @
1c551683
...
@@ -85,6 +85,7 @@ mylog(char *fmt,...)
...
@@ -85,6 +85,7 @@ mylog(char *fmt,...)
va_end
(
args
);
va_end
(
args
);
}
}
}
}
#endif
#endif
...
@@ -114,6 +115,7 @@ qlog(char *fmt,...)
...
@@ -114,6 +115,7 @@ qlog(char *fmt,...)
va_end
(
args
);
va_end
(
args
);
}
}
}
}
#endif
#endif
/* Undefine these because windows.h will redefine and cause a warning */
/* Undefine these because windows.h will redefine and cause a warning */
...
...
src/interfaces/odbc/multibyte.c
View file @
1c551683
...
@@ -110,18 +110,18 @@ multibyte_char_check(unsigned char s)
...
@@ -110,18 +110,18 @@ multibyte_char_check(unsigned char s)
break
;
break
;
/* Chinese Big5(CP950) Support. */
/* Chinese Big5(CP950) Support. */
case
BIG5
:
case
BIG5
:
{
{
if
(
multibyte_status
<
2
&&
s
>
0xA0
)
if
(
multibyte_status
<
2
&&
s
>
0xA0
)
multibyte_status
=
2
;
multibyte_status
=
2
;
else
if
(
multibyte_status
==
2
)
else
if
(
multibyte_status
==
2
)
multibyte_status
=
1
;
multibyte_status
=
1
;
else
else
multibyte_status
=
0
;
multibyte_status
=
0
;
}
}
break
;
break
;
default:
default:
multibyte_status
=
0
;
multibyte_status
=
0
;
}
}
#ifdef _DEBUG
#ifdef _DEBUG
qlog
(
"multibyte_client_encoding = %d s = 0x%02X multibyte_stat = %d
\n
"
,
multibyte_client_encoding
,
s
,
multibyte_status
);
qlog
(
"multibyte_client_encoding = %d s = 0x%02X multibyte_stat = %d
\n
"
,
multibyte_client_encoding
,
s
,
multibyte_status
);
...
...
src/interfaces/odbc/options.c
View file @
1c551683
...
@@ -67,6 +67,7 @@ set_statement_option(ConnectionClass *conn,
...
@@ -67,6 +67,7 @@ set_statement_option(ConnectionClass *conn,
break
;
break
;
case
SQL_CONCURRENCY
:
case
SQL_CONCURRENCY
:
/*
/*
* positioned update isn't supported so cursor concurrency is
* positioned update isn't supported so cursor concurrency is
* read-only
* read-only
...
@@ -81,18 +82,18 @@ set_statement_option(ConnectionClass *conn,
...
@@ -81,18 +82,18 @@ set_statement_option(ConnectionClass *conn,
* if (globals.lie)
* if (globals.lie)
* {
* {
* if (conn)
* if (conn)
*
conn->stmtOptions.scroll_concurrency = vParam;
* conn->stmtOptions.scroll_concurrency = vParam;
* if (stmt)
* if (stmt)
*
stmt->options.scroll_concurrency = vParam;
* stmt->options.scroll_concurrency = vParam;
* } else {
* } else {
*
if (conn)
* if (conn)
* conn->stmtOptions.scroll_concurrency =
* conn->stmtOptions.scroll_concurrency =
*
SQL_CONCUR_READ_ONLY;
* SQL_CONCUR_READ_ONLY;
* if (stmt)
* if (stmt)
*
stmt->options.scroll_concurrency =
* stmt->options.scroll_concurrency =
* SQL_CONCUR_READ_ONLY;
* SQL_CONCUR_READ_ONLY;
*
*
*
if (vParam != SQL_CONCUR_READ_ONLY)
* if (vParam != SQL_CONCUR_READ_ONLY)
* changed = TRUE;
* changed = TRUE;
* }
* }
* break;
* break;
...
@@ -101,6 +102,7 @@ set_statement_option(ConnectionClass *conn,
...
@@ -101,6 +102,7 @@ set_statement_option(ConnectionClass *conn,
*/
*/
case
SQL_CURSOR_TYPE
:
case
SQL_CURSOR_TYPE
:
/*
/*
* if declare/fetch, then type can only be forward. otherwise,
* if declare/fetch, then type can only be forward. otherwise,
* it can only be forward or static.
* it can only be forward or static.
...
@@ -171,7 +173,7 @@ set_statement_option(ConnectionClass *conn,
...
@@ -171,7 +173,7 @@ set_statement_option(ConnectionClass *conn,
*-------
*-------
*/
*/
case
SQL_MAX_LENGTH
:
/* ignored, but saved */
case
SQL_MAX_LENGTH
:
/* ignored, but saved */
mylog
(
"SetStmtOption(): SQL_MAX_LENGTH, vParam = %d
\n
"
,
vParam
);
mylog
(
"SetStmtOption(): SQL_MAX_LENGTH, vParam = %d
\n
"
,
vParam
);
if
(
conn
)
if
(
conn
)
conn
->
stmtOptions
.
maxLength
=
vParam
;
conn
->
stmtOptions
.
maxLength
=
vParam
;
...
@@ -179,7 +181,7 @@ set_statement_option(ConnectionClass *conn,
...
@@ -179,7 +181,7 @@ set_statement_option(ConnectionClass *conn,
stmt
->
options
.
maxLength
=
vParam
;
stmt
->
options
.
maxLength
=
vParam
;
break
;
break
;
case
SQL_MAX_ROWS
:
/* ignored, but saved */
case
SQL_MAX_ROWS
:
/* ignored, but saved */
mylog
(
"SetStmtOption(): SQL_MAX_ROWS, vParam = %d
\n
"
,
vParam
);
mylog
(
"SetStmtOption(): SQL_MAX_ROWS, vParam = %d
\n
"
,
vParam
);
if
(
conn
)
if
(
conn
)
conn
->
stmtOptions
.
maxRows
=
vParam
;
conn
->
stmtOptions
.
maxRows
=
vParam
;
...
@@ -187,16 +189,16 @@ set_statement_option(ConnectionClass *conn,
...
@@ -187,16 +189,16 @@ set_statement_option(ConnectionClass *conn,
stmt
->
options
.
maxRows
=
vParam
;
stmt
->
options
.
maxRows
=
vParam
;
break
;
break
;
case
SQL_NOSCAN
:
/* ignored */
case
SQL_NOSCAN
:
/* ignored */
mylog
(
"SetStmtOption: SQL_NOSCAN, vParam = %d
\n
"
,
vParam
);
mylog
(
"SetStmtOption: SQL_NOSCAN, vParam = %d
\n
"
,
vParam
);
break
;
break
;
case
SQL_QUERY_TIMEOUT
:
/* ignored */
case
SQL_QUERY_TIMEOUT
:
/* ignored */
mylog
(
"SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d
\n
"
,
vParam
);
mylog
(
"SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d
\n
"
,
vParam
);
/* "0" returned in SQLGetStmtOption */
/* "0" returned in SQLGetStmtOption */
break
;
break
;
case
SQL_RETRIEVE_DATA
:
/* ignored, but saved */
case
SQL_RETRIEVE_DATA
:
/* ignored, but saved */
mylog
(
"SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d
\n
"
,
vParam
);
mylog
(
"SetStmtOption(): SQL_RETRIEVE_DATA, vParam = %d
\n
"
,
vParam
);
if
(
conn
)
if
(
conn
)
conn
->
stmtOptions
.
retrieve_data
=
vParam
;
conn
->
stmtOptions
.
retrieve_data
=
vParam
;
...
@@ -315,10 +317,11 @@ SQLSetConnectOption(
...
@@ -315,10 +317,11 @@ SQLSetConnectOption(
switch
(
fOption
)
switch
(
fOption
)
{
{
/*
* Statement Options (apply to all stmts on the connection and
/*
* become defaults for new stmts)
* Statement Options (apply to all stmts on the connection and
*/
* become defaults for new stmts)
*/
case
SQL_ASYNC_ENABLE
:
case
SQL_ASYNC_ENABLE
:
case
SQL_BIND_TYPE
:
case
SQL_BIND_TYPE
:
case
SQL_CONCURRENCY
:
case
SQL_CONCURRENCY
:
...
@@ -353,9 +356,9 @@ SQLSetConnectOption(
...
@@ -353,9 +356,9 @@ SQLSetConnectOption(
break
;
break
;
/*
/*
*
Connection Options
*
Connection Options
*/
*/
case
SQL_ACCESS_MODE
:
/* ignored */
case
SQL_ACCESS_MODE
:
/* ignored */
break
;
break
;
...
@@ -392,7 +395,7 @@ SQLSetConnectOption(
...
@@ -392,7 +395,7 @@ SQLSetConnectOption(
case
SQL_CURRENT_QUALIFIER
:
/* ignored */
case
SQL_CURRENT_QUALIFIER
:
/* ignored */
break
;
break
;
case
SQL_LOGIN_TIMEOUT
:
/* ignored */
case
SQL_LOGIN_TIMEOUT
:
/* ignored */
break
;
break
;
case
SQL_PACKET_SIZE
:
/* ignored */
case
SQL_PACKET_SIZE
:
/* ignored */
...
@@ -401,10 +404,10 @@ SQLSetConnectOption(
...
@@ -401,10 +404,10 @@ SQLSetConnectOption(
case
SQL_QUIET_MODE
:
/* ignored */
case
SQL_QUIET_MODE
:
/* ignored */
break
;
break
;
case
SQL_TXN_ISOLATION
:
/* ignored */
case
SQL_TXN_ISOLATION
:
/* ignored */
break
;
break
;
/* These options should be handled by driver manager */
/* These options should be handled by driver manager */
case
SQL_ODBC_CURSORS
:
case
SQL_ODBC_CURSORS
:
case
SQL_OPT_TRACE
:
case
SQL_OPT_TRACE
:
case
SQL_OPT_TRACEFILE
:
case
SQL_OPT_TRACEFILE
:
...
@@ -456,7 +459,7 @@ SQLGetConnectOption(
...
@@ -456,7 +459,7 @@ SQLGetConnectOption(
switch
(
fOption
)
switch
(
fOption
)
{
{
case
SQL_ACCESS_MODE
:
/* NOT SUPPORTED */
case
SQL_ACCESS_MODE
:
/* NOT SUPPORTED */
*
((
UDWORD
*
)
pvParam
)
=
SQL_MODE_READ_WRITE
;
*
((
UDWORD
*
)
pvParam
)
=
SQL_MODE_READ_WRITE
;
break
;
break
;
...
@@ -471,23 +474,23 @@ SQLGetConnectOption(
...
@@ -471,23 +474,23 @@ SQLGetConnectOption(
break
;
break
;
case
SQL_LOGIN_TIMEOUT
:
/* NOT SUPPORTED */
case
SQL_LOGIN_TIMEOUT
:
/* NOT SUPPORTED */
*
((
UDWORD
*
)
pvParam
)
=
0
;
*
((
UDWORD
*
)
pvParam
)
=
0
;
break
;
break
;
case
SQL_PACKET_SIZE
:
/* NOT SUPPORTED */
case
SQL_PACKET_SIZE
:
/* NOT SUPPORTED */
*
((
UDWORD
*
)
pvParam
)
=
globals
.
socket_buffersize
;
*
((
UDWORD
*
)
pvParam
)
=
globals
.
socket_buffersize
;
break
;
break
;
case
SQL_QUIET_MODE
:
/* NOT SUPPORTED */
case
SQL_QUIET_MODE
:
/* NOT SUPPORTED */
*
((
UDWORD
*
)
pvParam
)
=
(
UDWORD
)
NULL
;
*
((
UDWORD
*
)
pvParam
)
=
(
UDWORD
)
NULL
;
break
;
break
;
case
SQL_TXN_ISOLATION
:
/* NOT SUPPORTED */
case
SQL_TXN_ISOLATION
:
/* NOT SUPPORTED */
*
((
UDWORD
*
)
pvParam
)
=
SQL_TXN_SERIALIZABLE
;
*
((
UDWORD
*
)
pvParam
)
=
SQL_TXN_SERIALIZABLE
;
break
;
break
;
/* These options should be handled by driver manager */
/* These options should be handled by driver manager */
case
SQL_ODBC_CURSORS
:
case
SQL_ODBC_CURSORS
:
case
SQL_OPT_TRACE
:
case
SQL_OPT_TRACE
:
case
SQL_OPT_TRACEFILE
:
case
SQL_OPT_TRACEFILE
:
...
@@ -525,9 +528,9 @@ SQLSetStmtOption(
...
@@ -525,9 +528,9 @@ SQLSetStmtOption(
mylog
(
"%s: entering...
\n
"
,
func
);
mylog
(
"%s: entering...
\n
"
,
func
);
/*
/*
*
Though we could fake Access out by just returning SQL_SUCCESS
*
Though we could fake Access out by just returning SQL_SUCCESS all
*
all the time, but it tries to set a huge value for SQL_MAX_LENGTH
*
the time, but it tries to set a huge value for SQL_MAX_LENGTH and
*
and
expects the driver to reduce it to the real value.
* expects the driver to reduce it to the real value.
*/
*/
if
(
!
stmt
)
if
(
!
stmt
)
{
{
...
@@ -552,9 +555,9 @@ SQLGetStmtOption(
...
@@ -552,9 +555,9 @@ SQLGetStmtOption(
mylog
(
"%s: entering...
\n
"
,
func
);
mylog
(
"%s: entering...
\n
"
,
func
);
/*
/*
* thought we could fake Access out by just returning SQL_SUCCESS
* thought we could fake Access out by just returning SQL_SUCCESS
all
*
all the time, but it tries to set a huge value for SQL_MAX_LENGTH
*
the time, but it tries to set a huge value for SQL_MAX_LENGTH and
*
and
expects the driver to reduce it to the real value
* expects the driver to reduce it to the real value
*/
*/
if
(
!
stmt
)
if
(
!
stmt
)
{
{
...
...
src/interfaces/odbc/parse.c
View file @
1c551683
...
@@ -233,8 +233,9 @@ getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k)
...
@@ -233,8 +233,9 @@ getColInfo(COL_INFO *col_info, FIELD_INFO *fi, int k)
char
char
searchColInfo
(
COL_INFO
*
col_info
,
FIELD_INFO
*
fi
)
searchColInfo
(
COL_INFO
*
col_info
,
FIELD_INFO
*
fi
)
{
{
int
k
,
cmp
;
int
k
,
char
*
col
;
cmp
;
char
*
col
;
for
(
k
=
0
;
k
<
QR_get_num_tuples
(
col_info
->
result
);
k
++
)
for
(
k
=
0
;
k
<
QR_get_num_tuples
(
col_info
->
result
);
k
++
)
{
{
...
@@ -575,7 +576,8 @@ parse_statement(StatementClass *stmt)
...
@@ -575,7 +576,8 @@ parse_statement(StatementClass *stmt)
strcpy
(
ti
[
stmt
->
ntab
]
->
name
,
token
);
strcpy
(
ti
[
stmt
->
ntab
]
->
name
,
token
);
if
(
!
dquote
)
if
(
!
dquote
)
{
{
char
*
ptr
;
char
*
ptr
;
/* lower case table name */
/* lower case table name */
for
(
ptr
=
ti
[
stmt
->
ntab
]
->
name
;
*
ptr
;
ptr
++
)
for
(
ptr
=
ti
[
stmt
->
ntab
]
->
name
;
*
ptr
;
ptr
++
)
*
ptr
=
tolower
((
unsigned
char
)
*
ptr
);
*
ptr
=
tolower
((
unsigned
char
)
*
ptr
);
...
...
src/interfaces/odbc/pgtypes.c
View file @
1c551683
...
@@ -51,7 +51,7 @@ Int4 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unkn
...
@@ -51,7 +51,7 @@ Int4 getCharPrecision(StatementClass *stmt, Int4 type, int col, int handle_unkn
/*
/*
* ALL THESE TYPES ARE NO LONGER REPORTED in SQLGetTypeInfo. Instead, all
* ALL THESE TYPES ARE NO LONGER REPORTED in SQLGetTypeInfo. Instead, all
*
the SQL TYPES are reported and mapped to a corresponding Postgres Type
*
the SQL TYPES are reported and mapped to a corresponding Postgres Type
*/
*/
/*
/*
...
@@ -237,7 +237,7 @@ pgtype_to_sqltype(StatementClass *stmt, Int4 type)
...
@@ -237,7 +237,7 @@ pgtype_to_sqltype(StatementClass *stmt, Int4 type)
case
PG_TYPE_INT4
:
case
PG_TYPE_INT4
:
return
SQL_INTEGER
;
return
SQL_INTEGER
;
/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
/* Change this to SQL_BIGINT for ODBC v3 bjm 2001-01-23 */
case
PG_TYPE_INT8
:
case
PG_TYPE_INT8
:
return
SQL_CHAR
;
return
SQL_CHAR
;
...
@@ -262,13 +262,14 @@ pgtype_to_sqltype(StatementClass *stmt, Int4 type)
...
@@ -262,13 +262,14 @@ pgtype_to_sqltype(StatementClass *stmt, Int4 type)
return
globals
.
bools_as_char
?
SQL_CHAR
:
SQL_BIT
;
return
globals
.
bools_as_char
?
SQL_CHAR
:
SQL_BIT
;
default:
default:
/*
/*
* first, check to see if 'type' is in list. If not, look up
* first, check to see if 'type' is in list. If not, look up
* with query. Add oid, name to list. If it's already in
* with query. Add oid, name to list. If it's already in
* list, just return.
* list, just return.
*/
*/
/* hack until permanent type is available */
/* hack until permanent type is available */
if
(
type
==
stmt
->
hdbc
->
lobj_type
)
if
(
type
==
stmt
->
hdbc
->
lobj_type
)
return
SQL_LONGVARBINARY
;
return
SQL_LONGVARBINARY
;
return
globals
.
unknowns_as_longvarchar
?
SQL_LONGVARCHAR
:
SQL_VARCHAR
;
return
globals
.
unknowns_as_longvarchar
?
SQL_LONGVARCHAR
:
SQL_VARCHAR
;
...
@@ -328,7 +329,7 @@ pgtype_to_name(StatementClass *stmt, Int4 type)
...
@@ -328,7 +329,7 @@ pgtype_to_name(StatementClass *stmt, Int4 type)
{
{
switch
(
type
)
switch
(
type
)
{
{
case
PG_TYPE_CHAR
:
return
"char"
;
case
PG_TYPE_CHAR
:
return
"char"
;
case
PG_TYPE_CHAR2
:
case
PG_TYPE_CHAR2
:
return
"char2"
;
return
"char2"
;
case
PG_TYPE_CHAR4
:
case
PG_TYPE_CHAR4
:
...
@@ -378,8 +379,8 @@ pgtype_to_name(StatementClass *stmt, Int4 type)
...
@@ -378,8 +379,8 @@ pgtype_to_name(StatementClass *stmt, Int4 type)
return
PG_TYPE_LO_NAME
;
return
PG_TYPE_LO_NAME
;
default:
default:
/* hack until permanent type is available */
/* hack until permanent type is available */
if
(
type
==
stmt
->
hdbc
->
lobj_type
)
if
(
type
==
stmt
->
hdbc
->
lobj_type
)
return
PG_TYPE_LO_NAME
;
return
PG_TYPE_LO_NAME
;
/*
/*
...
@@ -640,7 +641,7 @@ pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown
...
@@ -640,7 +641,7 @@ pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown
case
PG_TYPE_FLOAT8
:
case
PG_TYPE_FLOAT8
:
return
22
;
return
22
;
/* Character types use regular precision */
/* Character types use regular precision */
default:
default:
return
pgtype_precision
(
stmt
,
type
,
col
,
handle_unknown_size_as
);
return
pgtype_precision
(
stmt
,
type
,
col
,
handle_unknown_size_as
);
}
}
...
@@ -686,7 +687,7 @@ pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_
...
@@ -686,7 +687,7 @@ pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_
case
PG_TYPE_TIMESTAMP
:
case
PG_TYPE_TIMESTAMP
:
return
16
;
return
16
;
/* Character types (and NUMERIC) use the default precision */
/* Character types (and NUMERIC) use the default precision */
default:
default:
return
pgtype_precision
(
stmt
,
type
,
col
,
handle_unknown_size_as
);
return
pgtype_precision
(
stmt
,
type
,
col
,
handle_unknown_size_as
);
}
}
...
@@ -708,10 +709,10 @@ pgtype_scale(StatementClass *stmt, Int4 type, int col)
...
@@ -708,10 +709,10 @@ pgtype_scale(StatementClass *stmt, Int4 type, int col)
case
PG_TYPE_MONEY
:
case
PG_TYPE_MONEY
:
case
PG_TYPE_BOOL
:
case
PG_TYPE_BOOL
:
/*
/*
* Number of digits to the right of the decimal point in
* Number of digits to the right of the decimal point in
* "yyyy-mm=dd hh:mm:ss[.f...]"
* "yyyy-mm=dd hh:mm:ss[.f...]"
*/
*/
case
PG_TYPE_ABSTIME
:
case
PG_TYPE_ABSTIME
:
case
PG_TYPE_DATETIME
:
case
PG_TYPE_DATETIME
:
case
PG_TYPE_TIMESTAMP
:
case
PG_TYPE_TIMESTAMP
:
...
@@ -911,8 +912,8 @@ pgtype_create_params(StatementClass *stmt, Int4 type)
...
@@ -911,8 +912,8 @@ pgtype_create_params(StatementClass *stmt, Int4 type)
{
{
switch
(
type
)
switch
(
type
)
{
{
case
PG_TYPE_CHAR
:
case
PG_TYPE_CHAR
:
case
PG_TYPE_VARCHAR
:
return
"max. length"
;
case
PG_TYPE_VARCHAR
:
return
"max. length"
;
default:
default:
return
NULL
;
return
NULL
;
}
}
...
@@ -922,9 +923,10 @@ pgtype_create_params(StatementClass *stmt, Int4 type)
...
@@ -922,9 +923,10 @@ pgtype_create_params(StatementClass *stmt, Int4 type)
Int2
Int2
sqltype_to_default_ctype
(
Int2
sqltype
)
sqltype_to_default_ctype
(
Int2
sqltype
)
{
{
/*
/*
*
from the table on page 623 of ODBC 2.0 Programmer's Reference
*
from the table on page 623 of ODBC 2.0 Programmer's Reference
*
(Appendix D)
* (Appendix D)
*/
*/
switch
(
sqltype
)
switch
(
sqltype
)
{
{
...
...
src/interfaces/odbc/qresult.c
View file @
1c551683
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* Description: This module contains functions related to
* Description: This module contains functions related to
* managing result information (i.e, fetching rows
* managing result information (i.e, fetching rows
* from the backend, managing the tuple cache, etc.)
* from the backend, managing the tuple cache, etc.)
* and retrieving it.
Depending on the situation, a
* and retrieving it.
Depending on the situation, a
* QResultClass will hold either data from the backend
* QResultClass will hold either data from the backend
* or a manually built result (see "qresult.h" to
* or a manually built result (see "qresult.h" to
* see which functions/macros are for manual or backend
* see which functions/macros are for manual or backend
...
@@ -138,8 +138,8 @@ QR_Destructor(QResultClass *self)
...
@@ -138,8 +138,8 @@ QR_Destructor(QResultClass *self)
TL_Destructor
(
self
->
manual_tuples
);
TL_Destructor
(
self
->
manual_tuples
);
/*
/*
* If conn is defined, then we may have used "backend_tuples",
* If conn is defined, then we may have used "backend_tuples",
so in
*
so in
case we need to, free it up. Also, close the cursor.
* case we need to, free it up. Also, close the cursor.
*/
*/
if
(
self
->
conn
&&
self
->
conn
->
sock
&&
CC_is_in_trans
(
self
->
conn
))
if
(
self
->
conn
&&
self
->
conn
->
sock
&&
CC_is_in_trans
(
self
->
conn
))
QR_close
(
self
);
/* close the cursor if there is one */
QR_close
(
self
);
/* close the cursor if there is one */
...
@@ -232,11 +232,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
...
@@ -232,11 +232,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
int
tuple_size
;
int
tuple_size
;
/*
/*
* If called from send_query the first time (conn != NULL),
* If called from send_query the first time (conn != NULL), then set
* then set the inTuples state,
* the inTuples state, and read the tuples. If conn is NULL, it
* and read the tuples. If conn is NULL,
* implies that we are being called from next_tuple(), like to get
* it implies that we are being called from next_tuple(),
* more rows so don't call next_tuple again!
* like to get more rows so don't call next_tuple again!
*/
*/
if
(
conn
!=
NULL
)
if
(
conn
!=
NULL
)
{
{
...
@@ -303,9 +302,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
...
@@ -303,9 +302,10 @@ QR_fetch_tuples(QResultClass *self, ConnectionClass *conn, char *cursor)
}
}
else
else
{
{
/*
/*
* Always have to read the field attributes.
* Always have to read the field attributes.
But we dont have to
*
But we dont have to
reallocate memory for them!
* reallocate memory for them!
*/
*/
if
(
!
CI_read_fields
(
NULL
,
self
->
conn
))
if
(
!
CI_read_fields
(
NULL
,
self
->
conn
))
...
@@ -390,8 +390,10 @@ QR_next_tuple(QResultClass *self)
...
@@ -390,8 +390,10 @@ QR_next_tuple(QResultClass *self)
int
end_tuple
=
self
->
rowset_size
+
self
->
base
;
int
end_tuple
=
self
->
rowset_size
+
self
->
base
;
char
corrected
=
FALSE
;
char
corrected
=
FALSE
;
TupleField
*
the_tuples
=
self
->
backend_tuples
;
TupleField
*
the_tuples
=
self
->
backend_tuples
;
/* ERROR_MSG_LENGTH is sufficient */
/* ERROR_MSG_LENGTH is sufficient */
static
char
msgbuffer
[
ERROR_MSG_LENGTH
+
1
];
static
char
msgbuffer
[
ERROR_MSG_LENGTH
+
1
];
/* QR_set_command() dups this string so doesn't need static */
/* QR_set_command() dups this string so doesn't need static */
char
cmdbuffer
[
ERROR_MSG_LENGTH
+
1
];
char
cmdbuffer
[
ERROR_MSG_LENGTH
+
1
];
char
fetch
[
128
];
char
fetch
[
128
];
...
@@ -413,10 +415,11 @@ QR_next_tuple(QResultClass *self)
...
@@ -413,10 +415,11 @@ QR_next_tuple(QResultClass *self)
self
->
tupleField
=
NULL
;
self
->
tupleField
=
NULL
;
self
->
status
=
PGRES_END_TUPLES
;
self
->
status
=
PGRES_END_TUPLES
;
/* end of tuples */
/* end of tuples */
return
-
1
;
return
-
1
;
}
}
else
else
{
{
/*
/*
* See if we need to fetch another group of rows. We may be being
* 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,
* called from send_query(), and if so, don't send another fetch,
...
@@ -513,7 +516,7 @@ QR_next_tuple(QResultClass *self)
...
@@ -513,7 +516,7 @@ QR_next_tuple(QResultClass *self)
switch
(
id
)
switch
(
id
)
{
{
case
'T'
:
/* Tuples within tuples cannot be handled */
case
'T'
:
/* Tuples within tuples cannot be handled */
self
->
status
=
PGRES_BAD_RESPONSE
;
self
->
status
=
PGRES_BAD_RESPONSE
;
QR_set_message
(
self
,
"Tuples within tuples cannot be handled"
);
QR_set_message
(
self
,
"Tuples within tuples cannot be handled"
);
...
@@ -646,6 +649,7 @@ QR_read_tuple(QResultClass *self, char binary)
...
@@ -646,6 +649,7 @@ QR_read_tuple(QResultClass *self, char binary)
}
}
else
else
{
{
/*
/*
* NO, the field is not null. so get at first the length of
* NO, the field is not null. so get at first the length of
* the field (four bytes)
* the field (four bytes)
...
...
src/interfaces/odbc/results.c
View file @
1c551683
...
@@ -212,8 +212,8 @@ SQLDescribeCol(
...
@@ -212,8 +212,8 @@ SQLDescribeCol(
SC_clear_error
(
stmt
);
SC_clear_error
(
stmt
);
/*
/*
*
Dont check for bookmark column.
This is the responsibility of the
*
Dont check for bookmark column.
This is the responsibility of the
*
driver manager.
*
driver manager.
*/
*/
icol
--
;
/* use zero based column numbers */
icol
--
;
/* use zero based column numbers */
...
@@ -251,9 +251,9 @@ SQLDescribeCol(
...
@@ -251,9 +251,9 @@ SQLDescribeCol(
}
}
/*
/*
*
If couldn't parse it OR the field being described was not parsed
*
If couldn't parse it OR the field being described was not parsed
*
(i.e., because it was a function or expression, etc, then do it the
*
(i.e., because it was a function or expression, etc, then do it the
*
old fashioned way.
*
old fashioned way.
*/
*/
if
(
!
parse_ok
)
if
(
!
parse_ok
)
{
{
...
@@ -285,7 +285,7 @@ SQLDescribeCol(
...
@@ -285,7 +285,7 @@ SQLDescribeCol(
/* atoi(ci->unknown_sizes) */
/* atoi(ci->unknown_sizes) */
precision
=
pgtype_precision
(
stmt
,
fieldtype
,
icol
,
globals
.
unknown_sizes
);
precision
=
pgtype_precision
(
stmt
,
fieldtype
,
icol
,
globals
.
unknown_sizes
);
}
}
mylog
(
"describeCol: col %d fieldname = '%s'
\n
"
,
icol
,
col_name
);
mylog
(
"describeCol: col %d fieldname = '%s'
\n
"
,
icol
,
col_name
);
mylog
(
"describeCol: col %d fieldtype = %d
\n
"
,
icol
,
fieldtype
);
mylog
(
"describeCol: col %d fieldtype = %d
\n
"
,
icol
,
fieldtype
);
...
@@ -407,10 +407,10 @@ SQLColAttributes(
...
@@ -407,10 +407,10 @@ SQLColAttributes(
icol
--
;
icol
--
;
/* atoi(ci->unknown_sizes); */
/* atoi(ci->unknown_sizes); */
unknown_sizes
=
globals
.
unknown_sizes
;
unknown_sizes
=
globals
.
unknown_sizes
;
/* not appropriate for SQLColAttributes() */
/* not appropriate for SQLColAttributes() */
if
(
unknown_sizes
==
UNKNOWNS_AS_DONTKNOW
)
if
(
unknown_sizes
==
UNKNOWNS_AS_DONTKNOW
)
unknown_sizes
=
UNKNOWNS_AS_MAX
;
unknown_sizes
=
UNKNOWNS_AS_MAX
;
parse_ok
=
FALSE
;
parse_ok
=
FALSE
;
...
@@ -505,11 +505,11 @@ SQLColAttributes(
...
@@ -505,11 +505,11 @@ SQLColAttributes(
value
=
pgtype_case_sensitive
(
stmt
,
field_type
);
value
=
pgtype_case_sensitive
(
stmt
,
field_type
);
break
;
break
;
/*
/*
* This special case is handled above.
* This special case is handled above.
*
*
* case SQL_COLUMN_COUNT:
* case SQL_COLUMN_COUNT:
*/
*/
case
SQL_COLUMN_DISPLAY_SIZE
:
case
SQL_COLUMN_DISPLAY_SIZE
:
value
=
(
parse_ok
)
?
stmt
->
fi
[
icol
]
->
display_size
:
pgtype_display_size
(
stmt
,
field_type
,
icol
,
unknown_sizes
);
value
=
(
parse_ok
)
?
stmt
->
fi
[
icol
]
->
display_size
:
pgtype_display_size
(
stmt
,
field_type
,
icol
,
unknown_sizes
);
...
@@ -592,6 +592,7 @@ SQLColAttributes(
...
@@ -592,6 +592,7 @@ SQLColAttributes(
break
;
break
;
case
SQL_COLUMN_UPDATABLE
:
case
SQL_COLUMN_UPDATABLE
:
/*
/*
* Neither Access or Borland care about this.
* Neither Access or Borland care about this.
*
*
...
@@ -992,6 +993,7 @@ SQLExtendedFetch(
...
@@ -992,6 +993,7 @@ SQLExtendedFetch(
switch
(
fFetchType
)
switch
(
fFetchType
)
{
{
case
SQL_FETCH_NEXT
:
case
SQL_FETCH_NEXT
:
/*
/*
* From the odbc spec... If positioned before the start of the
* From the odbc spec... If positioned before the start of the
* RESULT SET, then this should be equivalent to
* RESULT SET, then this should be equivalent to
...
@@ -1009,6 +1011,7 @@ SQLExtendedFetch(
...
@@ -1009,6 +1011,7 @@ SQLExtendedFetch(
case
SQL_FETCH_PRIOR
:
case
SQL_FETCH_PRIOR
:
mylog
(
"SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d
\n
"
,
num_tuples
,
stmt
->
currTuple
);
mylog
(
"SQL_FETCH_PRIOR: num_tuples=%d, currtuple=%d
\n
"
,
num_tuples
,
stmt
->
currTuple
);
/*
/*
* From the odbc spec... If positioned after the end of the
* From the odbc spec... If positioned after the end of the
* RESULT SET, then this should be equivalent to
* RESULT SET, then this should be equivalent to
...
@@ -1054,6 +1057,7 @@ SQLExtendedFetch(
...
@@ -1054,6 +1057,7 @@ SQLExtendedFetch(
break
;
break
;
case
SQL_FETCH_RELATIVE
:
case
SQL_FETCH_RELATIVE
:
/*
/*
* Refresh the current rowset -- not currently implemented,
* Refresh the current rowset -- not currently implemented,
* but lie anyway
* but lie anyway
...
...
src/interfaces/odbc/setup.c
View file @
1c551683
...
@@ -66,14 +66,14 @@ BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
...
@@ -66,14 +66,14 @@ BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
/*--------
/*--------
* ConfigDSN
* ConfigDSN
*
*
*
Description: ODBC Setup entry point
*
Description: ODBC Setup entry point
* This entry point is called by the ODBC Installer
* This entry point is called by the ODBC Installer
* (see file header for more details)
* (see file header for more details)
*
Input : hwnd ----------- Parent window handle
*
Input : hwnd ----------- Parent window handle
* fRequest ------- Request type (i.e., add, config, or remove)
* fRequest ------- Request type (i.e., add, config, or remove)
* lpszDriver ----- Driver name
* lpszDriver ----- Driver name
* lpszAttributes - data source attribute string
* lpszAttributes - data source attribute string
*
Output : TRUE success, FALSE otherwise
*
Output : TRUE success, FALSE otherwise
*--------
*--------
*/
*/
BOOL
CALLBACK
BOOL
CALLBACK
...
@@ -204,12 +204,12 @@ CenterDialog(HWND hdlg)
...
@@ -204,12 +204,12 @@ CenterDialog(HWND hdlg)
/*-------
/*-------
* ConfigDlgProc
* ConfigDlgProc
*
Description: Manage add data source name dialog
*
Description: Manage add data source name dialog
*
Input : hdlg --- Dialog window handle
*
Input : hdlg --- Dialog window handle
* wMsg --- Message
* wMsg --- Message
* wParam - Message parameter
* wParam - Message parameter
* lParam - Message parameter
* lParam - Message parameter
*
Output : TRUE if message processed, FALSE otherwise
*
Output : TRUE if message processed, FALSE otherwise
*-------
*-------
*/
*/
int
CALLBACK
int
CALLBACK
...
@@ -261,10 +261,11 @@ ConfigDlgProc(HWND hdlg,
...
@@ -261,10 +261,11 @@ ConfigDlgProc(HWND hdlg,
return
TRUE
;
/* Focus was not set */
return
TRUE
;
/* Focus was not set */
}
}
/* Process buttons */
/* Process buttons */
case
WM_COMMAND
:
case
WM_COMMAND
:
switch
(
GET_WM_COMMAND_ID
(
wParam
,
lParam
))
switch
(
GET_WM_COMMAND_ID
(
wParam
,
lParam
))
{
{
/*
/*
* Ensure the OK button is enabled only when a data
* Ensure the OK button is enabled only when a data
* source name
* source name
...
@@ -283,7 +284,7 @@ ConfigDlgProc(HWND hdlg,
...
@@ -283,7 +284,7 @@ ConfigDlgProc(HWND hdlg,
}
}
break
;
break
;
/* Accept results */
/* Accept results */
case
IDOK
:
case
IDOK
:
{
{
LPSETUPDLG
lpsetupdlg
;
LPSETUPDLG
lpsetupdlg
;
...
@@ -301,7 +302,7 @@ ConfigDlgProc(HWND hdlg,
...
@@ -301,7 +302,7 @@ ConfigDlgProc(HWND hdlg,
SetDSNAttributes
(
hdlg
,
lpsetupdlg
);
SetDSNAttributes
(
hdlg
,
lpsetupdlg
);
}
}
/* Return to caller */
/* Return to caller */
case
IDCANCEL
:
case
IDCANCEL
:
EndDialog
(
hdlg
,
wParam
);
EndDialog
(
hdlg
,
wParam
);
return
TRUE
;
return
TRUE
;
...
@@ -335,9 +336,9 @@ ConfigDlgProc(HWND hdlg,
...
@@ -335,9 +336,9 @@ ConfigDlgProc(HWND hdlg,
/*-------
/*-------
* ParseAttributes
* ParseAttributes
*
*
*
Description: Parse attribute string moving values into the aAttr array
*
Description: Parse attribute string moving values into the aAttr array
*
Input : lpszAttributes - Pointer to attribute string
*
Input : lpszAttributes - Pointer to attribute string
*
Output : None (global aAttr normally updated)
*
Output : None (global aAttr normally updated)
*-------
*-------
*/
*/
void
INTFUNC
void
INTFUNC
...
@@ -353,7 +354,11 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
...
@@ -353,7 +354,11 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
for
(
lpsz
=
lpszAttributes
;
*
lpsz
;
lpsz
++
)
for
(
lpsz
=
lpszAttributes
;
*
lpsz
;
lpsz
++
)
{
{
/* Extract key name (e.g., DSN), it must be terminated by an equals */
/*
* Extract key name (e.g., DSN), it must be terminated by an
* equals
*/
lpszStart
=
lpsz
;
lpszStart
=
lpsz
;
for
(;;
lpsz
++
)
for
(;;
lpsz
++
)
{
{
...
@@ -390,9 +395,9 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
...
@@ -390,9 +395,9 @@ ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg)
/*--------
/*--------
* SetDSNAttributes
* SetDSNAttributes
*
*
*
Description: Write data source attributes to ODBC.INI
*
Description: Write data source attributes to ODBC.INI
*
Input : hwnd - Parent window handle (plus globals)
*
Input : hwnd - Parent window handle (plus globals)
*
Output : TRUE if successful, FALSE otherwise
*
Output : TRUE if successful, FALSE otherwise
*--------
*--------
*/
*/
BOOL
INTFUNC
BOOL
INTFUNC
...
...
src/interfaces/odbc/socket.c
View file @
1c551683
...
@@ -227,27 +227,27 @@ SOCK_get_int(SocketClass *self, short len)
...
@@ -227,27 +227,27 @@ SOCK_get_int(SocketClass *self, short len)
{
{
switch
(
len
)
switch
(
len
)
{
{
case
2
:
case
2
:
{
{
unsigned
short
buf
;
unsigned
short
buf
;
SOCK_get_n_char
(
self
,
(
char
*
)
&
buf
,
len
);
SOCK_get_n_char
(
self
,
(
char
*
)
&
buf
,
len
);
if
(
self
->
reverse
)
if
(
self
->
reverse
)
return
buf
;
return
buf
;
else
else
return
ntohs
(
buf
);
return
ntohs
(
buf
);
}
}
case
4
:
case
4
:
{
{
unsigned
int
buf
;
unsigned
int
buf
;
SOCK_get_n_char
(
self
,
(
char
*
)
&
buf
,
len
);
SOCK_get_n_char
(
self
,
(
char
*
)
&
buf
,
len
);
if
(
self
->
reverse
)
if
(
self
->
reverse
)
return
buf
;
return
buf
;
else
else
return
ntohl
(
buf
);
return
ntohl
(
buf
);
}
}
default:
default:
self
->
errornumber
=
SOCKET_GET_INT_WRONG_LENGTH
;
self
->
errornumber
=
SOCKET_GET_INT_WRONG_LENGTH
;
...
@@ -302,9 +302,9 @@ SOCK_get_next_byte(SocketClass *self)
...
@@ -302,9 +302,9 @@ SOCK_get_next_byte(SocketClass *self)
{
{
if
(
self
->
buffer_read_in
>=
self
->
buffer_filled_in
)
if
(
self
->
buffer_read_in
>=
self
->
buffer_filled_in
)
{
{
/*
/*
* there are no more bytes left in the buffer so
* there are no more bytes left in the buffer so reload the buffer
* reload the buffer
*/
*/
self
->
buffer_read_in
=
0
;
self
->
buffer_read_in
=
0
;
self
->
buffer_filled_in
=
recv
(
self
->
socket
,
(
char
*
)
self
->
buffer_in
,
globals
.
socket_buffersize
,
0
);
self
->
buffer_filled_in
=
recv
(
self
->
socket
,
(
char
*
)
self
->
buffer_in
,
globals
.
socket_buffersize
,
0
);
...
...
src/interfaces/odbc/statement.c
View file @
1c551683
...
@@ -181,11 +181,10 @@ SQLFreeStmt(HSTMT hstmt,
...
@@ -181,11 +181,10 @@ SQLFreeStmt(HSTMT hstmt,
SC_Destructor
(
stmt
);
SC_Destructor
(
stmt
);
}
}
else
if
(
fOption
==
SQL_UNBIND
)
else
if
(
fOption
==
SQL_UNBIND
)
{
SC_unbind_cols
(
stmt
);
SC_unbind_cols
(
stmt
);
}
else
if
(
fOption
==
SQL_CLOSE
)
else
if
(
fOption
==
SQL_CLOSE
)
{
{
/*
/*
* this should discard all the results, but leave the statement
* this should discard all the results, but leave the statement
* itself in place (it can be executed again)
* itself in place (it can be executed again)
...
@@ -198,9 +197,7 @@ SQLFreeStmt(HSTMT hstmt,
...
@@ -198,9 +197,7 @@ SQLFreeStmt(HSTMT hstmt,
}
}
}
}
else
if
(
fOption
==
SQL_RESET_PARAMS
)
else
if
(
fOption
==
SQL_RESET_PARAMS
)
{
SC_free_params
(
stmt
,
STMT_FREE_PARAMS_ALL
);
SC_free_params
(
stmt
,
STMT_FREE_PARAMS_ALL
);
}
else
else
{
{
stmt
->
errormsg
=
"Invalid option passed to SQLFreeStmt."
;
stmt
->
errormsg
=
"Invalid option passed to SQLFreeStmt."
;
...
@@ -321,8 +318,8 @@ SC_Destructor(StatementClass *self)
...
@@ -321,8 +318,8 @@ SC_Destructor(StatementClass *self)
/*
/*
* the memory pointed to by the bindings is not deallocated by the
* the memory pointed to by the bindings is not deallocated by the
* driver but by the application that uses that driver, so we don't
have to
* driver but by the application that uses that driver, so we don't
* care
*
have to
care
*/
*/
/* about that here. */
/* about that here. */
if
(
self
->
bindings
)
if
(
self
->
bindings
)
...
@@ -534,8 +531,8 @@ SC_recycle_statement(StatementClass *self)
...
@@ -534,8 +531,8 @@ SC_recycle_statement(StatementClass *self)
/*
/*
* Free any data at exec params before the statement is executed
* Free any data at exec params before the statement is executed
* again. If not, then there will be a memory leak when
* again. If not, then there will be a memory leak when
the next
*
the next
SQLParamData/SQLPutData is called.
* SQLParamData/SQLPutData is called.
*/
*/
SC_free_params
(
self
,
STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY
);
SC_free_params
(
self
,
STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY
);
...
@@ -555,7 +552,8 @@ SC_pre_execute(StatementClass *self)
...
@@ -555,7 +552,8 @@ SC_pre_execute(StatementClass *self)
if
(
self
->
statement_type
==
STMT_TYPE_SELECT
)
if
(
self
->
statement_type
==
STMT_TYPE_SELECT
)
{
{
char
old_pre_executing
=
self
->
pre_executing
;
char
old_pre_executing
=
self
->
pre_executing
;
self
->
pre_executing
=
TRUE
;
self
->
pre_executing
=
TRUE
;
self
->
inaccurate_result
=
FALSE
;
self
->
inaccurate_result
=
FALSE
;
...
@@ -657,7 +655,7 @@ SC_get_error(StatementClass *self, int *number, char **message)
...
@@ -657,7 +655,7 @@ SC_get_error(StatementClass *self, int *number, char **message)
{
{
char
rv
;
char
rv
;
/*
Create a very informative errormsg if it hasn't been done yet. */
/*
Create a very informative errormsg if it hasn't been done yet. */
if
(
!
self
->
errormsg_created
)
if
(
!
self
->
errormsg_created
)
{
{
self
->
errormsg
=
SC_create_errormsg
(
self
);
self
->
errormsg
=
SC_create_errormsg
(
self
);
...
@@ -715,6 +713,7 @@ SC_fetch(StatementClass *self)
...
@@ -715,6 +713,7 @@ SC_fetch(StatementClass *self)
if
(
self
->
currTuple
>=
QR_get_num_tuples
(
res
)
-
1
||
if
(
self
->
currTuple
>=
QR_get_num_tuples
(
res
)
-
1
||
(
self
->
options
.
maxRows
>
0
&&
self
->
currTuple
==
self
->
options
.
maxRows
-
1
))
(
self
->
options
.
maxRows
>
0
&&
self
->
currTuple
==
self
->
options
.
maxRows
-
1
))
{
{
/*
/*
* if at the end of the tuples, return "no data found" and set
* if at the end of the tuples, return "no data found" and set
* the cursor past the end of the result set
* the cursor past the end of the result set
...
@@ -824,13 +823,13 @@ SC_fetch(StatementClass *self)
...
@@ -824,13 +823,13 @@ SC_fetch(StatementClass *self)
result
=
SQL_SUCCESS_WITH_INFO
;
result
=
SQL_SUCCESS_WITH_INFO
;
break
;
break
;
/* error msg already filled in */
/* error msg already filled in */
case
COPY_GENERAL_ERROR
:
case
COPY_GENERAL_ERROR
:
SC_log_error
(
func
,
""
,
self
);
SC_log_error
(
func
,
""
,
self
);
result
=
SQL_ERROR
;
result
=
SQL_ERROR
;
break
;
break
;
/* This would not be meaningful in SQLFetch. */
/* This would not be meaningful in SQLFetch. */
case
COPY_NO_DATA_FOUND
:
case
COPY_NO_DATA_FOUND
:
break
;
break
;
...
...
src/interfaces/odbc/statement.h
View file @
1c551683
...
@@ -215,8 +215,8 @@ struct StatementClass_
...
@@ -215,8 +215,8 @@ struct StatementClass_
* substitution */
* substitution */
char
pre_executing
;
/* This statement is prematurely executing */
char
pre_executing
;
/* This statement is prematurely executing */
char
inaccurate_result
;
/* Current status is PREMATURE
char
inaccurate_result
;
/* Current status is PREMATURE
but
*
but
result is inaccurate */
* result is inaccurate */
};
};
#define SC_get_conn(a) (a->hdbc)
#define SC_get_conn(a) (a->hdbc)
...
...
src/interfaces/odbc/tuplelist.c
View file @
1c551683
...
@@ -137,6 +137,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
...
@@ -137,6 +137,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
}
}
else
if
(
start_is_closer
)
else
if
(
start_is_closer
)
{
{
/*
/*
* the shortest way is to start the search from the head of the
* the shortest way is to start the search from the head of the
* list
* list
...
@@ -182,6 +183,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
...
@@ -182,6 +183,7 @@ TL_get_fieldval(TupleListClass *self, Int4 tupleno, Int2 fieldno)
char
char
TL_add_tuple
(
TupleListClass
*
self
,
TupleNode
*
new_field
)
TL_add_tuple
(
TupleListClass
*
self
,
TupleNode
*
new_field
)
{
{
/*
/*
* we append the tuple at the end of the doubly linked list of the
* we append the tuple at the end of the doubly linked list of the
* tuples we have already read in
* tuples we have already read in
...
@@ -200,6 +202,7 @@ TL_add_tuple(TupleListClass *self, TupleNode *new_field)
...
@@ -200,6 +202,7 @@ TL_add_tuple(TupleListClass *self, TupleNode *new_field)
}
}
else
else
{
{
/*
/*
* there is already an element in the list, so add the new one at
* there is already an element in the list, so add the new one at
* the end of the list
* 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