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
ddae527c
Commit
ddae527c
authored
May 27, 2000
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove // comments from ODBC.
parent
c328e75a
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
667 additions
and
662 deletions
+667
-662
src/interfaces/odbc/bind.c
src/interfaces/odbc/bind.c
+40
-40
src/interfaces/odbc/columninfo.c
src/interfaces/odbc/columninfo.c
+2
-2
src/interfaces/odbc/connection.c
src/interfaces/odbc/connection.c
+24
-24
src/interfaces/odbc/convert.c
src/interfaces/odbc/convert.c
+62
-62
src/interfaces/odbc/dlg_specific.c
src/interfaces/odbc/dlg_specific.c
+31
-31
src/interfaces/odbc/dlg_specific.h
src/interfaces/odbc/dlg_specific.h
+6
-6
src/interfaces/odbc/drvconn.c
src/interfaces/odbc/drvconn.c
+12
-12
src/interfaces/odbc/environ.c
src/interfaces/odbc/environ.c
+30
-30
src/interfaces/odbc/execute.c
src/interfaces/odbc/execute.c
+33
-33
src/interfaces/odbc/gpps.c
src/interfaces/odbc/gpps.c
+82
-79
src/interfaces/odbc/gpps.h
src/interfaces/odbc/gpps.h
+12
-12
src/interfaces/odbc/info.c
src/interfaces/odbc/info.c
+131
-131
src/interfaces/odbc/lobj.c
src/interfaces/odbc/lobj.c
+1
-1
src/interfaces/odbc/misc.c
src/interfaces/odbc/misc.c
+11
-11
src/interfaces/odbc/misc.h
src/interfaces/odbc/misc.h
+2
-2
src/interfaces/odbc/options.c
src/interfaces/odbc/options.c
+14
-14
src/interfaces/odbc/parse.c
src/interfaces/odbc/parse.c
+14
-14
src/interfaces/odbc/pgtypes.c
src/interfaces/odbc/pgtypes.c
+2
-2
src/interfaces/odbc/pgtypes.h
src/interfaces/odbc/pgtypes.h
+3
-1
src/interfaces/odbc/psqlodbc.h
src/interfaces/odbc/psqlodbc.h
+1
-1
src/interfaces/odbc/qresult.c
src/interfaces/odbc/qresult.c
+25
-25
src/interfaces/odbc/qresult.h
src/interfaces/odbc/qresult.h
+12
-12
src/interfaces/odbc/resource.h
src/interfaces/odbc/resource.h
+6
-6
src/interfaces/odbc/results.c
src/interfaces/odbc/results.c
+31
-31
src/interfaces/odbc/setup.c
src/interfaces/odbc/setup.c
+54
-54
src/interfaces/odbc/socket.c
src/interfaces/odbc/socket.c
+3
-3
src/interfaces/odbc/statement.c
src/interfaces/odbc/statement.c
+22
-22
src/interfaces/odbc/tuple.c
src/interfaces/odbc/tuple.c
+1
-1
No files found.
src/interfaces/odbc/bind.c
View file @
ddae527c
...
...
@@ -34,7 +34,7 @@
#include <sqlext.h>
#endif
/
/ Bind parameters on a statement handle
/
* Bind parameters on a statement handle */
RETCODE
SQL_API
SQLBindParameter
(
HSTMT
hstmt
,
...
...
@@ -75,18 +75,18 @@ static char *func="SQLBindParameter";
stmt
->
parameters_allocated
=
ipar
;
/
/ copy the old parameters over
/
* copy the old parameters over */
for
(
i
=
0
;
i
<
old_parameters_allocated
;
i
++
)
{
// a structure copy should work
/* a structure copy should work */
stmt
->
parameters
[
i
]
=
old_parameters
[
i
];
}
/
/ get rid of the old parameters, if there were any
/
* get rid of the old parameters, if there were any */
if
(
old_parameters
)
free
(
old_parameters
);
/
/ zero out the newly allocated parameters (in case they skipped some,
/
/ so we don't accidentally try to use them later)
/
* zero out the newly allocated parameters (in case they skipped some, */
/
* so we don't accidentally try to use them later) */
for
(;
i
<
stmt
->
parameters_allocated
;
i
++
)
{
stmt
->
parameters
[
i
].
buflen
=
0
;
stmt
->
parameters
[
i
].
buffer
=
0
;
...
...
@@ -105,7 +105,7 @@ static char *func="SQLBindParameter";
ipar
--
;
/* use zero based column numbers for the below part */
/
/ store the given info
/
* store the given info */
stmt
->
parameters
[
ipar
].
buflen
=
cbValueMax
;
stmt
->
parameters
[
ipar
].
buffer
=
rgbValue
;
stmt
->
parameters
[
ipar
].
used
=
pcbValue
;
...
...
@@ -140,9 +140,9 @@ static char *func="SQLBindParameter";
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Associate a user-supplied buffer with a database column.
/
* Associate a user-supplied buffer with a database column. */
RETCODE
SQL_API
SQLBindCol
(
HSTMT
hstmt
,
UWORD
icol
,
...
...
@@ -195,14 +195,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
return
SQL_SUCCESS
;
}
/
/ allocate enough bindings if not already done
/
/ Most likely, execution of a statement would have setup the
/
/ necessary bindings. But some apps call BindCol before any
/
/ statement is executed.
/
* allocate enough bindings if not already done */
/
* Most likely, execution of a statement would have setup the */
/
* necessary bindings. But some apps call BindCol before any */
/
* statement is executed. */
if
(
icol
>
stmt
->
bindings_allocated
)
extend_bindings
(
stmt
,
icol
);
/
/ check to see if the bindings were allocated
/
* check to see if the bindings were allocated */
if
(
!
stmt
->
bindings
)
{
stmt
->
errormsg
=
"Could not allocate memory for bindings."
;
stmt
->
errornumber
=
STMT_NO_MEMORY_ERROR
;
...
...
@@ -234,14 +234,14 @@ mylog("**** SQLBindCol: stmt = %u, icol = %d\n", stmt, icol);
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Returns the description of a parameter marker.
/
/ This function is listed as not being supported by SQLGetFunctions() because it is
/
/ used to describe "parameter markers" (not bound parameters), in which case,
/
/ the dbms should return info on the markers. Since Postgres doesn't support that,
/
/ it is best to say this function is not supported and let the application assume a
/
/ data type (most likely varchar).
/
* Returns the description of a parameter marker. */
/
* This function is listed as not being supported by SQLGetFunctions() because it is */
/
* used to describe "parameter markers" (not bound parameters), in which case, */
/
* the dbms should return info on the markers. Since Postgres doesn't support that, */
/
* it is best to say this function is not supported and let the application assume a */
/
* data type (most likely varchar). */
RETCODE
SQL_API
SQLDescribeParam
(
HSTMT
hstmt
,
...
...
@@ -270,8 +270,8 @@ static char *func = "SQLDescribeParam";
ipar
--
;
/
/ This implementation is not very good, since it is supposed to describe
/
/ parameter markers, not bound parameters.
/
* This implementation is not very good, since it is supposed to describe */
/
* parameter markers, not bound parameters. */
if
(
pfSqlType
)
*
pfSqlType
=
stmt
->
parameters
[
ipar
].
SQLType
;
...
...
@@ -287,9 +287,9 @@ static char *func = "SQLDescribeParam";
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Sets multiple values (arrays) for the set of parameter markers.
/
* Sets multiple values (arrays) for the set of parameter markers. */
RETCODE
SQL_API
SQLParamOptions
(
HSTMT
hstmt
,
...
...
@@ -304,15 +304,15 @@ static char *func = "SQLParamOptions";
return
SQL_ERROR
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ This function should really talk to the dbms to determine the number of
/
/ "parameter markers" (not bound parameters) in the statement. But, since
/
/ Postgres doesn't support that, the driver should just count the number of markers
/
/ and return that. The reason the driver just can't say this function is unsupported
/
/ 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.
/
* This function should really talk to the dbms to determine the number of */
/
* "parameter markers" (not bound parameters) in the statement. But, since */
/
* Postgres doesn't support that, the driver should just count the number of markers */
/
* and return that. The reason the driver just can't say this function is unsupported */
/
* 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
SQLNumParams
(
HSTMT
hstmt
,
SWORD
FAR
*
pcpar
)
...
...
@@ -338,7 +338,7 @@ static char *func = "SQLNumParams";
if
(
!
stmt
->
statement
)
{
/
/ no statement has been allocated
/
* no statement has been allocated */
stmt
->
errormsg
=
"SQLNumParams called with no statement ready."
;
stmt
->
errornumber
=
STMT_SEQUENCE_ERROR
;
SC_log_error
(
func
,
""
,
stmt
);
...
...
@@ -419,13 +419,13 @@ mylog("%s: entering ... stmt=%u, bindings_allocated=%d, num_columns=%d\n", func,
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,
/
/ let it worry about it by unbinding those columns.
/
* There is no reason to zero out extra bindings if there are */
/
* more than needed. If an app has allocated extra bindings, */
/
* let it worry about it by unbinding those columns. */
/
/ SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings
/
/ SQLExecDirect(...) # returns 5 cols
/
/ SQLExecDirect(...) # returns 10 cols (now OK)
/
* SQLBindCol(1..) ... SQLBindCol(10...) # got 10 bindings */
/
* SQLExecDirect(...) # returns 5 cols */
/
* SQLExecDirect(...) # returns 10 cols (now OK) */
mylog
(
"exit extend_bindings
\n
"
);
}
src/interfaces/odbc/columninfo.c
View file @
ddae527c
...
...
@@ -144,12 +144,12 @@ CI_set_field_info(ColumnInfoClass *self, int field_num, char *new_name,
Oid
new_adtid
,
Int2
new_adtsize
,
Int4
new_atttypmod
)
{
/
/ check bounds
/
* check bounds */
if
((
field_num
<
0
)
||
(
field_num
>=
self
->
num_fields
))
{
return
;
}
/
/ store the info
/
* store the info */
self
->
name
[
field_num
]
=
strdup
(
new_name
);
self
->
adtid
[
field_num
]
=
new_adtid
;
self
->
adtsize
[
field_num
]
=
new_adtsize
;
...
...
src/interfaces/odbc/connection.c
View file @
ddae527c
...
...
@@ -70,7 +70,7 @@ static char *func="SQLAllocConnect";
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
RETCODE
SQL_API
SQLConnect
(
HDBC
hdbc
,
...
...
@@ -111,7 +111,7 @@ static char *func = "SQLConnect";
qlog
(
"conn = %u, %s(DSN='%s', UID='%s', PWD='%s')
\n
"
,
conn
,
func
,
ci
->
dsn
,
ci
->
username
,
ci
->
password
);
if
(
CC_connect
(
conn
,
FALSE
)
<=
0
)
{
/
/ Error messages are filled in
/
* Error messages are filled in */
CC_log_error
(
func
,
"Error on CC_connect"
,
conn
);
return
SQL_ERROR
;
}
...
...
@@ -121,7 +121,7 @@ static char *func = "SQLConnect";
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
RETCODE
SQL_API
SQLBrowseConnect
(
HDBC
hdbc
,
...
...
@@ -138,7 +138,7 @@ static char *func="SQLBrowseConnect";
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/* Drop any hstmts open on hdbc and disconnect from database */
RETCODE
SQL_API
SQLDisconnect
(
...
...
@@ -176,7 +176,7 @@ static char *func = "SQLDisconnect";
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
RETCODE
SQL_API
SQLFreeConnect
(
HDBC
hdbc
)
...
...
@@ -229,7 +229,7 @@ ConnectionClass *rv;
rv
->
errormsg_created
=
FALSE
;
rv
->
status
=
CONN_NOT_CONNECTED
;
rv
->
transact_status
=
CONN_IN_AUTOCOMMIT
;
/
/ autocommit by default
rv
->
transact_status
=
CONN_IN_AUTOCOMMIT
;
/
* autocommit by default */
memset
(
&
rv
->
connInfo
,
0
,
sizeof
(
ConnInfo
));
...
...
@@ -334,8 +334,8 @@ CC_clear_error(ConnectionClass *self)
self
->
errormsg_created
=
FALSE
;
}
/
/ Used to cancel a transaction
/
/ We are almost always in the middle of a transaction.
/
* Used to cancel a transaction */
/
* We are almost always in the middle of a transaction. */
char
CC_abort
(
ConnectionClass
*
self
)
{
...
...
@@ -371,9 +371,9 @@ StatementClass *stmt;
mylog
(
"in CC_Cleanup, self=%u
\n
"
,
self
);
/
/ Cancel an ongoing transaction
/
/ We are always in the middle of a transaction,
/
/ even if we are in auto commit.
/
* Cancel an ongoing transaction */
/
* We are always in the middle of a transaction, */
/
* even if we are in auto commit. */
if
(
self
->
sock
)
CC_abort
(
self
);
...
...
@@ -549,7 +549,7 @@ static char *func="CC_connect";
mylog
(
"sizeof startup packet = %d
\n
"
,
sizeof
(
StartupPacket
));
/
/ Send length of Authentication Block
/
* Send length of Authentication Block */
SOCK_put_int
(
sock
,
4
+
sizeof
(
StartupPacket
),
4
);
if
(
PROTOCOL_63
(
ci
))
...
...
@@ -579,9 +579,9 @@ static char *func="CC_connect";
mylog
(
"gonna do authentication
\n
"
);
/
/ ***************************************************
/
/ Now get the authentication request from backend
/
/ ***************************************************
/
* *************************************************** */
/
* Now get the authentication request from backend */
/
* *************************************************** */
if
(
!
PROTOCOL_62
(
ci
))
do
{
...
...
@@ -790,7 +790,7 @@ int rv;
mylog
(
"enter CC_get_error
\n
"
);
/
/ 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
)
{
self
->
errormsg
=
CC_create_errormsg
(
self
);
self
->
errormsg_created
=
TRUE
;
...
...
@@ -802,7 +802,7 @@ int rv;
}
rv
=
(
self
->
errornumber
!=
0
);
self
->
errornumber
=
0
;
/
/ clear the error
self
->
errornumber
=
0
;
/
* clear the error */
mylog
(
"exit CC_get_error
\n
"
);
...
...
@@ -826,13 +826,13 @@ char swallow;
int
id
;
SocketClass
*
sock
=
self
->
sock
;
static
char
msgbuffer
[
MAX_MESSAGE_LEN
+
1
];
char
cmdbuffer
[
MAX_MESSAGE_LEN
+
1
];
/
/ QR_set_command() dups this string so dont need static
char
cmdbuffer
[
MAX_MESSAGE_LEN
+
1
];
/
* QR_set_command() dups this string so dont need static */
mylog
(
"send_query(): conn=%u, query='%s'
\n
"
,
self
,
query
);
qlog
(
"conn=%u, query='%s'
\n
"
,
self
,
query
);
/
/ Indicate that we are sending a query to the backend
/
* Indicate that we are sending a query to the backend */
if
(
strlen
(
query
)
>
MAX_MESSAGE_LEN
-
2
)
{
self
->
errornumber
=
CONNECTION_MSG_TOO_LONG
;
self
->
errormsg
=
"Query string is too long"
;
...
...
@@ -971,7 +971,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont
mylog
(
"~~~ NOTICE: '%s'
\n
"
,
cmdbuffer
);
qlog
(
"NOTICE from backend during send_query: '%s'
\n
"
,
cmdbuffer
);
continue
;
/
/ dont return a result -- continue reading
continue
;
/
* dont return a result -- continue reading */
case
'I'
:
/* The server sends an empty query */
/* There is a closing '\0' following the 'I', so we eat it */
...
...
@@ -1034,7 +1034,7 @@ char cmdbuffer[MAX_MESSAGE_LEN+1]; // QR_set_command() dups this string so dont
return
NULL
;
}
}
else
{
/
/ next fetch, so reuse an existing result
else
{
/
* next fetch, so reuse an existing result */
if
(
!
QR_fetch_tuples
(
result_in
,
NULL
,
NULL
))
{
self
->
errornumber
=
CONNECTION_COULD_NOT_RECEIVE
;
self
->
errormsg
=
QR_get_message
(
result_in
);
...
...
@@ -1186,7 +1186,7 @@ int i;
mylog
(
"send_function(G): 'N' - %s
\n
"
,
msgbuffer
);
qlog
(
"NOTICE from backend during send_function: '%s'
\n
"
,
msgbuffer
);
continue
;
/
/ dont return a result -- continue reading
continue
;
/
* dont return a result -- continue reading */
case
'0'
:
/* empty result */
return
TRUE
;
...
...
@@ -1206,9 +1206,9 @@ int i;
char
CC_send_settings
(
ConnectionClass
*
self
)
{
// char ini_query[MAX_MESSAGE_LEN];
/* char ini_query[MAX_MESSAGE_LEN]; */
ConnInfo
*
ci
=
&
(
self
->
connInfo
);
/
/ QResultClass *res;
/
* QResultClass *res; */
HSTMT
hstmt
;
StatementClass
*
stmt
;
RETCODE
result
;
...
...
src/interfaces/odbc/convert.c
View file @
ddae527c
...
...
@@ -65,66 +65,66 @@ extern GLOBAL_VALUES globals;
* - thomas 2000-04-03
*/
char
*
mapFuncs
[][
2
]
=
{
/
/ { "ASCII", "ascii" },
/
* { "ASCII", "ascii" }, */
{
"CHAR"
,
"ichar"
},
{
"CONCAT"
,
"textcat"
},
/
/ { "DIFFERENCE", "difference" },
/
/ { "INSERT", "insert" },
/
* { "DIFFERENCE", "difference" }, */
/
* { "INSERT", "insert" }, */
{
"LCASE"
,
"lower"
},
{
"LEFT"
,
"ltrunc"
},
{
"LOCATE"
,
"strpos"
},
{
"LENGTH"
,
"char_length"
},
/
/ { "LTRIM", "ltrim" },
/
* { "LTRIM", "ltrim" }, */
{
"RIGHT"
,
"rtrunc"
},
/
/ { "REPEAT", "repeat" },
/
/ { "REPLACE", "replace" },
/
/ { "RTRIM", "rtrim" },
/
/ { "SOUNDEX", "soundex" },
/
* { "REPEAT", "repeat" }, */
/
* { "REPLACE", "replace" }, */
/
* { "RTRIM", "rtrim" }, */
/
* { "SOUNDEX", "soundex" }, */
{
"SUBSTRING"
,
"substr"
},
{
"UCASE"
,
"upper"
},
/
/ { "ABS", "abs" },
/
/ { "ACOS", "acos" },
/
/ { "ASIN", "asin" },
/
/ { "ATAN", "atan" },
/
/ { "ATAN2", "atan2" },
/
* { "ABS", "abs" }, */
/
* { "ACOS", "acos" }, */
/
* { "ASIN", "asin" }, */
/
* { "ATAN", "atan" }, */
/
* { "ATAN2", "atan2" }, */
{
"CEILING"
,
"ceil"
},
/
/ { "COS", "cos" },
/
/ { "COT", "cot" },
/
/ { "DEGREES", "degrees" },
/
/ { "EXP", "exp" },
/
/ { "FLOOR", "floor" },
/
* { "COS", "cos" }, */
/
* { "COT", "cot" }, */
/
* { "DEGREES", "degrees" }, */
/
* { "EXP", "exp" }, */
/
* { "FLOOR", "floor" }, */
{
"LOG"
,
"ln"
},
{
"LOG10"
,
"log"
},
/
/ { "MOD", "mod" },
/
/ { "PI", "pi" },
/
* { "MOD", "mod" }, */
/
* { "PI", "pi" }, */
{
"POWER"
,
"pow"
},
/
/ { "RADIANS", "radians" },
/
* { "RADIANS", "radians" }, */
{
"RAND"
,
"random"
},
/
/ { "ROUND", "round" },
/
/ { "SIGN", "sign" },
/
/ { "SIN", "sin" },
/
/ { "SQRT", "sqrt" },
/
/ { "TAN", "tan" },
/
* { "ROUND", "round" }, */
/
* { "SIGN", "sign" }, */
/
* { "SIN", "sin" }, */
/
* { "SQRT", "sqrt" }, */
/
* { "TAN", "tan" }, */
{
"TRUNCATE"
,
"trunc"
},
/
/ { "CURDATE", "curdate" },
/
/ { "CURTIME", "curtime" },
/
/ { "DAYNAME", "dayname" },
/
/ { "DAYOFMONTH", "dayofmonth" },
/
/ { "DAYOFWEEK", "dayofweek" },
/
/ { "DAYOFYEAR", "dayofyear" },
/
/ { "HOUR", "hour" },
/
/ { "MINUTE", "minute" },
/
/ { "MONTH", "month" },
/
/ { "MONTHNAME", "monthname" },
/
/ { "NOW", "now" },
/
/ { "QUARTER", "quarter" },
/
/ { "SECOND", "second" },
/
/ { "WEEK", "week" },
/
/ { "YEAR", "year" },
/
/ { "DATABASE", "database" },
/
* { "CURDATE", "curdate" }, */
/
* { "CURTIME", "curtime" }, */
/
* { "DAYNAME", "dayname" }, */
/
* { "DAYOFMONTH", "dayofmonth" }, */
/
* { "DAYOFWEEK", "dayofweek" }, */
/
* { "DAYOFYEAR", "dayofyear" }, */
/
* { "HOUR", "hour" }, */
/
* { "MINUTE", "minute" }, */
/
* { "MONTH", "month" }, */
/
* { "MONTHNAME", "monthname" }, */
/
* { "NOW", "now" }, */
/
* { "QUARTER", "quarter" }, */
/
* { "SECOND", "second" }, */
/
* { "WEEK", "week" }, */
/
* { "YEAR", "year" }, */
/
* { "DATABASE", "database" }, */
{
"IFNULL"
,
"coalesce"
},
{
"USER"
,
"odbc_user"
},
{
0
,
0
}
...
...
@@ -270,7 +270,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
case
PG_TYPE_INT2VECTOR
:
{
int
nval
,
i
;
char
*
vp
;
/
/ this is an array of eight integers
/
* this is an array of eight integers */
short
*
short_array
=
(
short
*
)
(
(
char
*
)
rgbValue
+
rgbValueOffset
);
len
=
16
;
...
...
@@ -381,7 +381,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
and all that stuff since there is essentially no limit on the large
object used to store those.
*/
case
PG_TYPE_BYTEA
:
/
/ convert binary data to hex strings (i.e, 255 = "FF")
case
PG_TYPE_BYTEA
:
/
* convert binary data to hex strings (i.e, 255 = "FF") */
len
=
convert_pgbinary_to_char
(
value
,
rgbValueBindRow
,
cbValueMax
);
/***** THIS IS NOT PROPERLY IMPLEMENTED *****/
...
...
@@ -495,7 +495,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
}
else
{
*
((
UCHAR
*
)
rgbValue
+
bind_row
)
=
atoi
(
value
);
}
/
/ mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n", atoi(value), cbValueMax, *((UCHAR *)rgbValue));
/
* mylog("SQL_C_BIT: val = %d, cb = %d, rgb=%d\n", atoi(value), cbValueMax, *((UCHAR *)rgbValue)); */
break
;
case
SQL_C_STINYINT
:
...
...
@@ -575,8 +575,8 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
case
SQL_C_BINARY
:
/
/ truncate if necessary
/
/ convert octal escapes to bytes
/
* truncate if necessary */
/
* convert octal escapes to bytes */
len
=
convert_from_pgbinary
(
value
,
tempBuf
,
sizeof
(
tempBuf
));
ptr
=
tempBuf
;
...
...
@@ -623,7 +623,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
}
}
/
/ store the length of what was copied, if there's a place for it
/
* store the length of what was copied, if there's a place for it */
if
(
pcbValue
)
{
*
(
SDWORD
*
)
((
char
*
)
pcbValue
+
pcbValueOffset
)
=
len
;
}
...
...
@@ -674,7 +674,7 @@ int lobj_fd, retval;
if
(
stmt
->
cursor_name
[
0
]
==
'\0'
)
sprintf
(
stmt
->
cursor_name
,
"SQL_CUR%p"
,
stmt
);
/
/ For selects, prepend a declare cursor to the statement
/
* For selects, prepend a declare cursor to the statement */
if
(
stmt
->
statement_type
==
STMT_TYPE_SELECT
&&
globals
.
use_declarefetch
)
{
sprintf
(
new_statement
,
"declare %s cursor for "
,
stmt
->
cursor_name
);
npos
=
strlen
(
new_statement
);
...
...
@@ -690,13 +690,13 @@ int lobj_fd, retval;
for
(
opos
=
0
;
opos
<
oldstmtlen
;
opos
++
)
{
/
/ Squeeze carriage-return/linefeed pairs to linefeed only
/
* Squeeze carriage-return/linefeed pairs to linefeed only */
if
(
old_statement
[
opos
]
==
'\r'
&&
opos
+
1
<
oldstmtlen
&&
old_statement
[
opos
+
1
]
==
'\n'
)
{
continue
;
}
/
/ Handle literals (date, time, timestamp) and ODBC scalar functions
/
* Handle literals (date, time, timestamp) and ODBC scalar functions */
else
if
(
old_statement
[
opos
]
==
'{'
)
{
char
*
esc
;
char
*
begin
=
&
old_statement
[
opos
+
1
];
...
...
@@ -779,7 +779,7 @@ int lobj_fd, retval;
mylog
(
"copy_statement_with_params: from(fcType)=%d, to(fSqlType)=%d
\n
"
,
param_ctype
,
param_sqltype
);
/
/ replace DEFAULT with something we can use
/
* replace DEFAULT with something we can use */
if
(
param_ctype
==
SQL_C_DEFAULT
)
param_ctype
=
sqltype_to_default_ctype
(
param_sqltype
);
...
...
@@ -878,10 +878,10 @@ int lobj_fd, retval;
}
default:
/
/ error
/
* error */
stmt
->
errormsg
=
"Unrecognized C_parameter type in copy_statement_with_parameters"
;
stmt
->
errornumber
=
STMT_NOT_IMPLEMENTED_ERROR
;
new_statement
[
npos
]
=
'\0'
;
/
/ just in case
new_statement
[
npos
]
=
'\0'
;
/
* just in case */
SC_log_error
(
func
,
""
,
stmt
);
return
SQL_ERROR
;
}
...
...
@@ -1062,8 +1062,8 @@ int lobj_fd, retval;
break
;
// because of no conversion operator for bool and int4, SQL_BIT
// must be quoted (0 or 1 is ok to use inside the quotes)
/* because of no conversion operator for bool and int4, SQL_BIT */
/* must be quoted (0 or 1 is ok to use inside the quotes) */
default:
/* a numeric type or SQL_BIT */
if
(
param_sqltype
==
SQL_BIT
)
...
...
@@ -1087,7 +1087,7 @@ int lobj_fd, retval;
}
/* end, for */
/
/ make sure new_statement is always null-terminated
/
* make sure new_statement is always null-terminated */
new_statement
[
npos
]
=
'\0'
;
...
...
@@ -1194,7 +1194,7 @@ size_t i = 0, out = 0;
for
(
i
=
0
;
i
<
strlen
(
s
);
i
++
)
{
if
(
s
[
i
]
==
'$'
||
s
[
i
]
==
','
||
s
[
i
]
==
')'
)
;
/
/ skip these characters
;
/
* skip these characters */
else
if
(
s
[
i
]
==
'('
)
s
[
out
++
]
=
'-'
;
else
...
...
@@ -1358,7 +1358,7 @@ int i, y=0, val;
return
y
;
}
/
/ convert octal escapes to bytes
/
* convert octal escapes to bytes */
int
convert_from_pgbinary
(
unsigned
char
*
value
,
unsigned
char
*
rgbValue
,
int
cbValueMax
)
{
...
...
@@ -1378,7 +1378,7 @@ int o=0;
o
++
;
}
rgbValue
[
o
]
=
'\0'
;
/
/ extra protection
rgbValue
[
o
]
=
'\0'
;
/
* extra protection */
return
o
;
}
...
...
@@ -1402,7 +1402,7 @@ static char x[6];
return
x
;
}
/
/ convert non-ascii bytes to octal escape sequences
/
* convert non-ascii bytes to octal escape sequences */
int
convert_to_pgbinary
(
unsigned
char
*
in
,
char
*
out
,
int
len
)
{
...
...
src/interfaces/odbc/dlg_specific.c
View file @
ddae527c
...
...
@@ -156,7 +156,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
globals
.
fetch_max
=
GetDlgItemInt
(
hdlg
,
DRV_CACHE_SIZE
,
NULL
,
FALSE
);
globals
.
max_varchar_size
=
GetDlgItemInt
(
hdlg
,
DRV_VARCHAR_SIZE
,
NULL
,
FALSE
);
globals
.
max_longvarchar_size
=
GetDlgItemInt
(
hdlg
,
DRV_LONGVARCHAR_SIZE
,
NULL
,
TRUE
);
/
/ allows for SQL_NO_TOTAL
globals
.
max_longvarchar_size
=
GetDlgItemInt
(
hdlg
,
DRV_LONGVARCHAR_SIZE
,
NULL
,
TRUE
);
/
* allows for SQL_NO_TOTAL */
GetDlgItemText
(
hdlg
,
DRV_EXTRASYSTABLEPREFIXES
,
globals
.
extra_systable_prefixes
,
sizeof
(
globals
.
extra_systable_prefixes
));
...
...
@@ -165,7 +165,7 @@ int CALLBACK driver_optionsProc(HWND hdlg,
updateGlobals
();
/
/ fall through
/
* fall through */
case
IDCANCEL
:
EndDialog
(
hdlg
,
GET_WM_COMMAND_ID
(
wParam
,
lParam
)
==
IDOK
);
...
...
@@ -230,7 +230,7 @@ char buf[128];
switch
(
wMsg
)
{
case
WM_INITDIALOG
:
ci
=
(
ConnInfo
*
)
lParam
;
SetWindowLong
(
hdlg
,
DWL_USER
,
lParam
);
/
/ save for OK
SetWindowLong
(
hdlg
,
DWL_USER
,
lParam
);
/
* save for OK */
/* Change window caption */
if
(
ci
->
driver
[
0
])
...
...
@@ -301,7 +301,7 @@ char buf[128];
GetDlgItemText
(
hdlg
,
DS_CONNSETTINGS
,
ci
->
conn_settings
,
sizeof
(
ci
->
conn_settings
));
/
/ fall through
/
* fall through */
case
IDCANCEL
:
EndDialog
(
hdlg
,
GET_WM_COMMAND_ID
(
wParam
,
lParam
)
==
IDOK
);
...
...
@@ -389,7 +389,7 @@ copyAttributes(ConnInfo *ci, char *attribute, char *value)
else
if
(
stricmp
(
attribute
,
INI_CONNSETTINGS
)
==
0
)
{
decode
(
value
,
ci
->
conn_settings
);
/
/ strcpy(ci->conn_settings, value);
/
* strcpy(ci->conn_settings, 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
);
...
...
@@ -428,8 +428,8 @@ getDSNinfo(ConnInfo *ci, char overwrite)
char
*
DSN
=
ci
->
dsn
;
char
encoded_conn_settings
[
LARGE_REGISTRY_LEN
];
// If a driver keyword was present, then dont use a DSN and return.
// If DSN is null and no driver, then use the default datasource.
/* If a driver keyword was present, then dont use a DSN and return. */
/* If DSN is null and no driver, then use the default datasource. */
if
(
DSN
[
0
]
==
'\0'
)
{
if
(
ci
->
driver
[
0
]
!=
'\0'
)
return
;
...
...
@@ -437,10 +437,10 @@ char encoded_conn_settings[LARGE_REGISTRY_LEN];
strcpy
(
DSN
,
INI_DSN
);
}
/
/ brute-force chop off trailing blanks...
/
* brute-force chop off trailing blanks... */
while
(
*
(
DSN
+
strlen
(
DSN
)
-
1
)
==
' '
)
*
(
DSN
+
strlen
(
DSN
)
-
1
)
=
'\0'
;
/
/ Proceed with getting info for the given DSN.
/
* Proceed with getting info for the given DSN. */
if
(
ci
->
desc
[
0
]
==
'\0'
||
overwrite
)
SQLGetPrivateProfileString
(
DSN
,
INI_KDESC
,
""
,
ci
->
desc
,
sizeof
(
ci
->
desc
),
ODBC_INI
);
...
...
@@ -600,7 +600,7 @@ void getGlobalDefaults(char *section, char *filename, char override)
char
temp
[
256
];
// Fetch Count is stored in driver section
/* Fetch Count is stored in driver section */
SQLGetPrivateProfileString
(
section
,
INI_FETCH
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
{
...
...
@@ -613,7 +613,7 @@ char temp[256];
globals
.
fetch_max
=
FETCH_MAX
;
/
/ Socket Buffersize is stored in driver section
/
* Socket Buffersize is stored in driver section */
SQLGetPrivateProfileString
(
section
,
INI_SOCKET
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -622,7 +622,7 @@ char temp[256];
globals
.
socket_buffersize
=
SOCK_BUFFER_SIZE
;
/
/ Debug is stored in the driver section
/
* Debug is stored in the driver section */
SQLGetPrivateProfileString
(
section
,
INI_DEBUG
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -631,7 +631,7 @@ char temp[256];
globals
.
debug
=
DEFAULT_DEBUG
;
/
/ CommLog is stored in the driver section
/
* CommLog is stored in the driver section */
SQLGetPrivateProfileString
(
section
,
INI_COMMLOG
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -640,7 +640,7 @@ char temp[256];
globals
.
commlog
=
DEFAULT_COMMLOG
;
/
/ Optimizer is stored in the driver section only
/
* Optimizer is stored in the driver section only */
SQLGetPrivateProfileString
(
section
,
INI_OPTIMIZER
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -648,7 +648,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
disable_optimizer
=
DEFAULT_OPTIMIZER
;
/
/ KSQO is stored in the driver section only
/
* KSQO is stored in the driver section only */
SQLGetPrivateProfileString
(
section
,
INI_KSQO
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -656,7 +656,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
ksqo
=
DEFAULT_KSQO
;
/
/ Recognize Unique Index is stored in the driver section only
/
* Recognize Unique Index is stored in the driver section only */
SQLGetPrivateProfileString
(
section
,
INI_UNIQUEINDEX
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -665,7 +665,7 @@ char temp[256];
globals
.
unique_index
=
DEFAULT_UNIQUEINDEX
;
/
/ Unknown Sizes is stored in the driver section only
/
* Unknown Sizes is stored in the driver section only */
SQLGetPrivateProfileString
(
section
,
INI_UNKNOWNSIZES
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -674,7 +674,7 @@ char temp[256];
globals
.
unknown_sizes
=
DEFAULT_UNKNOWNSIZES
;
/
/ Lie about supported functions?
/
* Lie about supported functions? */
SQLGetPrivateProfileString
(
section
,
INI_LIE
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -682,7 +682,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
lie
=
DEFAULT_LIE
;
/
/ Parse statements
/
* Parse statements */
SQLGetPrivateProfileString
(
section
,
INI_PARSE
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -690,7 +690,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
parse
=
DEFAULT_PARSE
;
/
/ SQLCancel calls SQLFreeStmt in Driver Manager
/
* SQLCancel calls SQLFreeStmt in Driver Manager */
SQLGetPrivateProfileString
(
section
,
INI_CANCELASFREESTMT
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -700,7 +700,7 @@ char temp[256];
/
/ UseDeclareFetch is stored in the driver section only
/
* UseDeclareFetch is stored in the driver section only */
SQLGetPrivateProfileString
(
section
,
INI_USEDECLAREFETCH
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -709,7 +709,7 @@ char temp[256];
globals
.
use_declarefetch
=
DEFAULT_USEDECLAREFETCH
;
/
/ Max Varchar Size
/
* Max Varchar Size */
SQLGetPrivateProfileString
(
section
,
INI_MAXVARCHARSIZE
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -717,7 +717,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
max_varchar_size
=
MAX_VARCHAR_SIZE
;
/
/ Max TextField Size
/
* Max TextField Size */
SQLGetPrivateProfileString
(
section
,
INI_MAXLONGVARCHARSIZE
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -725,7 +725,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
max_longvarchar_size
=
TEXT_FIELD_SIZE
;
/
/ Text As LongVarchar
/
* Text As LongVarchar */
SQLGetPrivateProfileString
(
section
,
INI_TEXTASLONGVARCHAR
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -733,7 +733,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
text_as_longvarchar
=
DEFAULT_TEXTASLONGVARCHAR
;
/
/ Unknowns As LongVarchar
/
* Unknowns As LongVarchar */
SQLGetPrivateProfileString
(
section
,
INI_UNKNOWNSASLONGVARCHAR
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -741,7 +741,7 @@ char temp[256];
else
if
(
!
override
)
globals
.
unknowns_as_longvarchar
=
DEFAULT_UNKNOWNSASLONGVARCHAR
;
/
/ Bools As Char
/
* Bools As Char */
SQLGetPrivateProfileString
(
section
,
INI_BOOLSASCHAR
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
@@ -749,8 +749,8 @@ char temp[256];
else
if
(
!
override
)
globals
.
bools_as_char
=
DEFAULT_BOOLSASCHAR
;
/
/ Extra Systable prefixes
/
/ Use @@@ to distinguish between blank extra prefixes and no key entry
/
* Extra Systable prefixes */
/
* Use @@@ to distinguish between blank extra prefixes and no key entry */
SQLGetPrivateProfileString
(
section
,
INI_EXTRASYSTABLEPREFIXES
,
"@@@"
,
temp
,
sizeof
(
temp
),
filename
);
if
(
strcmp
(
temp
,
"@@@"
))
...
...
@@ -761,14 +761,14 @@ char temp[256];
mylog
(
"globals.extra_systable_prefixes = '%s'
\n
"
,
globals
.
extra_systable_prefixes
);
/
/ Dont allow override of an override!
/
* Dont allow override of an override! */
if
(
!
override
)
{
/
/ ConnSettings is stored in the driver section and per datasource for override
/
* ConnSettings is stored in the driver section and per datasource for override */
SQLGetPrivateProfileString
(
section
,
INI_CONNSETTINGS
,
""
,
globals
.
conn_settings
,
sizeof
(
globals
.
conn_settings
),
filename
);
/
/ Default state for future DSN's Readonly attribute
/
* Default state for future DSN's Readonly attribute */
SQLGetPrivateProfileString
(
section
,
INI_READONLY
,
""
,
temp
,
sizeof
(
temp
),
filename
);
if
(
temp
[
0
]
)
...
...
src/interfaces/odbc/dlg_specific.h
View file @
ddae527c
...
...
@@ -91,15 +91,15 @@
/* Connection Defaults */
#define DEFAULT_PORT "5432"
#define DEFAULT_READONLY 1
#define DEFAULT_PROTOCOL "6.4" /
/ the latest protocol is the default
#define DEFAULT_PROTOCOL "6.4"
/
* the latest protocol is the default */
#define DEFAULT_USEDECLAREFETCH 0
#define DEFAULT_TEXTASLONGVARCHAR 1
#define DEFAULT_UNKNOWNSASLONGVARCHAR 0
#define DEFAULT_BOOLSASCHAR 1
#define DEFAULT_OPTIMIZER 1 /
/ disable
#define DEFAULT_KSQO 1 /
/ on
#define DEFAULT_UNIQUEINDEX 0 /
/ dont recognize
#define DEFAULT_COMMLOG 0 /
/ dont log
#define DEFAULT_OPTIMIZER 1
/
* disable */
#define DEFAULT_KSQO 1
/
* on */
#define DEFAULT_UNIQUEINDEX 0
/
* dont recognize */
#define DEFAULT_COMMLOG 0
/
* dont log */
#define DEFAULT_DEBUG 0
#define DEFAULT_UNKNOWNSIZES UNKNOWNS_AS_MAX
...
...
@@ -107,7 +107,7 @@
#define DEFAULT_FAKEOIDINDEX 0
#define DEFAULT_SHOWOIDCOLUMN 0
#define DEFAULT_ROWVERSIONING 0
#define DEFAULT_SHOWSYSTEMTABLES 0 /
/ dont show system tables
#define DEFAULT_SHOWSYSTEMTABLES 0
/
* dont show system tables */
#define DEFAULT_LIE 0
#define DEFAULT_PARSE 0
...
...
src/interfaces/odbc/drvconn.c
View file @
ddae527c
...
...
@@ -103,15 +103,15 @@ int len = 0;
ci
=
&
(
conn
->
connInfo
);
/
/ Parse the connect string and fill in conninfo for this hdbc.
/
* Parse the connect string and fill in conninfo for this hdbc. */
dconn_get_connect_attributes
(
connStrIn
,
ci
);
/
/ If the ConnInfo in the hdbc is missing anything,
/
/ this function will fill them in from the registry (assuming
/
/ of course there is a DSN given -- if not, it does nothing!)
/
* If the ConnInfo in the hdbc is missing anything, */
/
* this function will fill them in from the registry (assuming */
/
* of course there is a DSN given -- if not, it does nothing!) */
getDSNinfo
(
ci
,
CONN_DONT_OVERWRITE
);
/
/ Fill in any default parameters if they are not there.
/
* Fill in any default parameters if they are not there. */
getDSNdefaults
(
ci
);
#ifdef WIN32
...
...
@@ -164,13 +164,13 @@ dialog:
ci
->
server
[
0
]
==
'\0'
||
ci
->
database
[
0
]
==
'\0'
||
ci
->
port
[
0
]
==
'\0'
)
{
/
/ (password_required && ci->password[0] == '\0'))
/
* (password_required && ci->password[0] == '\0')) */
return
SQL_NO_DATA_FOUND
;
}
/
/ do the actual connect
/
* do the actual connect */
retval
=
CC_connect
(
conn
,
password_required
);
if
(
retval
<
0
)
{
/* need a password */
if
(
fDriverCompletion
==
SQL_DRIVER_NOPROMPT
)
{
...
...
@@ -187,7 +187,7 @@ dialog:
}
}
else
if
(
retval
==
0
)
{
/
/ error msg filled in above
/
* error msg filled in above */
CC_log_error
(
func
,
"Error from CC_Connect"
,
conn
);
return
SQL_ERROR
;
}
...
...
@@ -273,7 +273,7 @@ ConnInfo *ci;
ShowWindow
(
GetDlgItem
(
hdlg
,
IDC_DESCTEXT
),
SW_HIDE
);
ShowWindow
(
GetDlgItem
(
hdlg
,
IDC_DESC
),
SW_HIDE
);
SetWindowLong
(
hdlg
,
DWL_USER
,
lParam
);
/
/ Save the ConnInfo for the "OK"
SetWindowLong
(
hdlg
,
DWL_USER
,
lParam
);
/
* Save the ConnInfo for the "OK" */
SetDlgStuff
(
hdlg
,
ci
);
...
...
@@ -354,15 +354,15 @@ char *strtok_arg;
continue
;
*
equals
=
'\0'
;
attribute
=
pair
;
/
/ ex. DSN
value
=
equals
+
1
;
/
/ ex. 'CEO co1'
attribute
=
pair
;
/
* ex. DSN */
value
=
equals
+
1
;
/
* ex. 'CEO co1' */
mylog
(
"attribute = '%s', value = '%s'
\n
"
,
attribute
,
value
);
if
(
!
attribute
||
!
value
)
continue
;
/
/ Copy the appropriate value to the conninfo
/
* Copy the appropriate value to the conninfo */
copyAttributes
(
ci
,
attribute
,
value
);
}
...
...
src/interfaces/odbc/environ.c
View file @
ddae527c
...
...
@@ -57,7 +57,7 @@ mylog("**** in SQLFreeEnv: env = %u ** \n", env);
return
SQL_ERROR
;
}
/
/ Returns the next SQL error information.
/
* Returns the next SQL error information. */
RETCODE
SQL_API
SQLError
(
HENV
henv
,
...
...
@@ -75,7 +75,7 @@ int status;
mylog
(
"**** SQLError: henv=%u, hdbc=%u, hstmt=%u
\n
"
,
henv
,
hdbc
,
hstmt
);
if
(
SQL_NULL_HSTMT
!=
hstmt
)
{
// CC: return an error of a hstmt
/* CC: return an error of a hstmt */
StatementClass
*
stmt
=
(
StatementClass
*
)
hstmt
;
if
(
SC_get_error
(
stmt
,
&
status
,
&
msg
))
{
...
...
@@ -102,47 +102,47 @@ int status;
if
(
NULL
!=
szSqlState
)
switch
(
status
)
{
// now determine the SQLSTATE to be returned
/* now determine the SQLSTATE to be returned */
case
STMT_TRUNCATED
:
strcpy
(
szSqlState
,
"01004"
);
/
/ data truncated
/
* data truncated */
break
;
case
STMT_INFO_ONLY
:
strcpy
(
szSqlState
,
"00000"
);
/
/ just information that is returned, no error
/
* just information that is returned, no error */
break
;
case
STMT_BAD_ERROR
:
strcpy
(
szSqlState
,
"08S01"
);
/
/ communication link failure
/
* communication link failure */
break
;
case
STMT_CREATE_TABLE_ERROR
:
strcpy
(
szSqlState
,
"S0001"
);
/
/ table already exists
/
* table already exists */
break
;
case
STMT_STATUS_ERROR
:
case
STMT_SEQUENCE_ERROR
:
strcpy
(
szSqlState
,
"S1010"
);
/
/ Function sequence error
/
* Function sequence error */
break
;
case
STMT_NO_MEMORY_ERROR
:
strcpy
(
szSqlState
,
"S1001"
);
/
/ memory allocation failure
/
* memory allocation failure */
break
;
case
STMT_COLNUM_ERROR
:
strcpy
(
szSqlState
,
"S1002"
);
/
/ invalid column number
/
* invalid column number */
break
;
case
STMT_NO_STMTSTRING
:
strcpy
(
szSqlState
,
"S1001"
);
/
/ having no stmtstring is also a malloc problem
/
* having no stmtstring is also a malloc problem */
break
;
case
STMT_ERROR_TAKEN_FROM_BACKEND
:
strcpy
(
szSqlState
,
"S1000"
);
/
/ general error
/
* general error */
break
;
case
STMT_INTERNAL_ERROR
:
strcpy
(
szSqlState
,
"S1000"
);
/
/ general error
/
* general error */
break
;
case
STMT_ROW_OUT_OF_RANGE
:
strcpy
(
szSqlState
,
"S1107"
);
...
...
@@ -153,7 +153,7 @@ int status;
break
;
case
STMT_NOT_IMPLEMENTED_ERROR
:
strcpy
(
szSqlState
,
"S1C00"
);
/
/ == 'driver not capable'
strcpy
(
szSqlState
,
"S1C00"
);
/
* == 'driver not capable' */
break
;
case
STMT_OPTION_OUT_OF_RANGE_ERROR
:
strcpy
(
szSqlState
,
"S1092"
);
...
...
@@ -181,7 +181,7 @@ int status;
break
;
case
STMT_INVALID_ARGUMENT_NO
:
strcpy
(
szSqlState
,
"S1009"
);
/
/ invalid argument value
/
* invalid argument value */
break
;
case
STMT_INVALID_CURSOR_POSITION
:
strcpy
(
szSqlState
,
"S1109"
);
...
...
@@ -198,7 +198,7 @@ int status;
case
STMT_EXEC_ERROR
:
default:
strcpy
(
szSqlState
,
"S1000"
);
/
/ also a general error
/
* also a general error */
break
;
}
...
...
@@ -250,15 +250,15 @@ int status;
case
STMT_TRUNCATED
:
case
CONN_TRUNCATED
:
strcpy
(
szSqlState
,
"01004"
);
/
/ data truncated
/
* data truncated */
break
;
case
CONN_INIREAD_ERROR
:
strcpy
(
szSqlState
,
"IM002"
);
/
/ data source not found
/
* data source not found */
break
;
case
CONN_OPENDB_ERROR
:
strcpy
(
szSqlState
,
"08001"
);
/
/ unable to connect to data source
/
* unable to connect to data source */
break
;
case
CONN_INVALID_AUTHENTICATION
:
case
CONN_AUTH_TYPE_UNSUPPORTED
:
...
...
@@ -266,23 +266,23 @@ int status;
break
;
case
CONN_STMT_ALLOC_ERROR
:
strcpy
(
szSqlState
,
"S1001"
);
/
/ memory allocation failure
/
* memory allocation failure */
break
;
case
CONN_IN_USE
:
strcpy
(
szSqlState
,
"S1000"
);
/
/ general error
/
* general error */
break
;
case
CONN_UNSUPPORTED_OPTION
:
strcpy
(
szSqlState
,
"IM001"
);
/
/ driver does not support this function
/
* driver does not support this function */
case
CONN_INVALID_ARGUMENT_NO
:
strcpy
(
szSqlState
,
"S1009"
);
/
/ invalid argument value
/
* invalid argument value */
break
;
case
CONN_TRANSACT_IN_PROGRES
:
strcpy
(
szSqlState
,
"S1010"
);
/
/ when the user tries to switch commit mode in a transaction
/
/ -> function sequence error
/
* when the user tries to switch commit mode in a transaction */
/
* -> function sequence error */
break
;
case
CONN_NO_MEMORY_ERROR
:
strcpy
(
szSqlState
,
"S1001"
);
...
...
@@ -299,7 +299,7 @@ int status;
default:
strcpy
(
szSqlState
,
"S1000"
);
/
/ general error
/
* general error */
break
;
}
...
...
@@ -341,12 +341,12 @@ int status;
if
(
szSqlState
)
{
switch
(
status
)
{
case
ENV_ALLOC_ERROR
:
// memory allocation failure
/* memory allocation failure */
strcpy
(
szSqlState
,
"S1001"
);
break
;
default:
strcpy
(
szSqlState
,
"S1000"
);
/
/ general error
/
* general error */
break
;
}
}
...
...
@@ -405,8 +405,8 @@ char rv = 1;
mylog
(
"in EN_Destructor, self=%u
\n
"
,
self
);
// the error messages are static strings distributed throughout
// the source--they should not be freed
/* the error messages are static strings distributed throughout */
/* the source--they should not be freed */
/* Free any connections belonging to this environment */
for
(
lf
=
0
;
lf
<
MAX_CONNECTIONS
;
lf
++
)
{
...
...
src/interfaces/odbc/execute.c
View file @
ddae527c
...
...
@@ -39,7 +39,7 @@
extern
GLOBAL_VALUES
globals
;
/
/ Perform a Prepare on the SQL statement
/
* Perform a Prepare on the SQL statement */
RETCODE
SQL_API
SQLPrepare
(
HSTMT
hstmt
,
UCHAR
FAR
*
szSqlStr
,
SDWORD
cbSqlStr
)
...
...
@@ -108,7 +108,7 @@ StatementClass *self = (StatementClass *) hstmt;
self
->
prepare
=
TRUE
;
self
->
statement_type
=
statement_type
(
self
->
statement
);
/
/ Check if connection is onlyread (only selects are allowed)
/
* Check if connection is onlyread (only selects are allowed) */
if
(
CC_is_onlyread
(
self
->
hdbc
)
&&
STMT_UPDATE
(
self
))
{
self
->
errornumber
=
STMT_EXEC_ERROR
;
self
->
errormsg
=
"Connection is readonly, only select statements are allowed."
;
...
...
@@ -121,9 +121,9 @@ StatementClass *self = (StatementClass *) hstmt;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Performs the equivalent of SQLPrepare, followed by SQLExecute.
/
* Performs the equivalent of SQLPrepare, followed by SQLExecute. */
RETCODE
SQL_API
SQLExecDirect
(
HSTMT
hstmt
,
...
...
@@ -144,8 +144,8 @@ static char *func = "SQLExecDirect";
if
(
stmt
->
statement
)
free
(
stmt
->
statement
);
/
/ keep a copy of the un-parametrized statement, in case
/
/ they try to execute this statement again
/
* keep a copy of the un-parametrized statement, in case */
/
* they try to execute this statement again */
stmt
->
statement
=
make_string
(
szSqlStr
,
cbSqlStr
,
NULL
);
if
(
!
stmt
->
statement
)
{
stmt
->
errornumber
=
STMT_NO_MEMORY_ERROR
;
...
...
@@ -158,15 +158,15 @@ static char *func = "SQLExecDirect";
stmt
->
prepare
=
FALSE
;
/
/ If an SQLPrepare was performed prior to this, but was left in
/
/ the premature state because an error occurred prior to SQLExecute
/
/ then set the statement to finished so it can be recycled.
/
* If an SQLPrepare was performed prior to this, but was left in */
/
* the premature state because an error occurred prior to SQLExecute */
/
* then set the statement to finished so it can be recycled. */
if
(
stmt
->
status
==
STMT_PREMATURE
)
stmt
->
status
=
STMT_FINISHED
;
stmt
->
statement_type
=
statement_type
(
stmt
->
statement
);
/
/ Check if connection is onlyread (only selects are allowed)
/
* Check if connection is onlyread (only selects are allowed) */
if
(
CC_is_onlyread
(
stmt
->
hdbc
)
&&
STMT_UPDATE
(
stmt
))
{
stmt
->
errornumber
=
STMT_EXEC_ERROR
;
stmt
->
errormsg
=
"Connection is readonly, only select statements are allowed."
;
...
...
@@ -182,7 +182,7 @@ static char *func = "SQLExecDirect";
return
result
;
}
/
/ Execute a prepared SQL statement
/
* Execute a prepared SQL statement */
RETCODE
SQL_API
SQLExecute
(
HSTMT
hstmt
)
{
...
...
@@ -272,15 +272,15 @@ int i, retval;
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 the statement.
/
* If there are some data at execution parameters, return need data */
/
* SQLParamData and SQLPutData will be used to send params and execute the statement. */
if
(
stmt
->
data_at_exec
>
0
)
return
SQL_NEED_DATA
;
mylog
(
"%s: copying statement params: trans_status=%d, len=%d, stmt='%s'
\n
"
,
func
,
conn
->
transact_status
,
strlen
(
stmt
->
statement
),
stmt
->
statement
);
/
/ Create the statement with parameters substituted.
/
* Create the statement with parameters substituted. */
retval
=
copy_statement_with_parameters
(
stmt
);
if
(
retval
!=
SQL_SUCCESS
)
/* error msg passed from above */
...
...
@@ -296,7 +296,7 @@ int i, retval;
/
/ - - - - - - - - -
/
* - - - - - - - - - */
RETCODE
SQL_API
SQLTransact
(
HENV
henv
,
HDBC
hdbc
,
...
...
@@ -355,7 +355,7 @@ int lf;
CC_set_no_trans
(
conn
);
if
(
!
res
)
{
/
/ error msg will be in the connection
/
* error msg will be in the connection */
CC_log_error
(
func
,
""
,
conn
);
return
SQL_ERROR
;
}
...
...
@@ -371,10 +371,10 @@ int lf;
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
RETCODE
SQL_API
SQLCancel
(
HSTMT
hstmt
)
/
/ Statement to cancel.
HSTMT
hstmt
)
/
* Statement to cancel. */
{
static
char
*
func
=
"SQLCancel"
;
StatementClass
*
stmt
=
(
StatementClass
*
)
hstmt
;
...
...
@@ -386,13 +386,13 @@ FARPROC addr;
mylog
(
"%s: entering...
\n
"
,
func
);
/
/ Check if this can handle canceling in the middle of a SQLPutData?
/
* Check if this can handle canceling in the middle of a SQLPutData? */
if
(
!
stmt
)
{
SC_log_error
(
func
,
""
,
NULL
);
return
SQL_INVALID_HANDLE
;
}
/
/ Not in the middle of SQLParamData/SQLPutData so cancel like a close.
/
* Not in the middle of SQLParamData/SQLPutData so cancel like a close. */
if
(
stmt
->
data_at_exec
<
0
)
{
...
...
@@ -423,9 +423,9 @@ FARPROC addr;
return
SQL_SUCCESS
;
}
/
/ In the middle of SQLParamData/SQLPutData, so cancel that.
/
/ Note, any previous data-at-exec buffers will be freed in the recycle
/
/ if they call SQLExecDirect or SQLExecute again.
/
* In the middle of SQLParamData/SQLPutData, so cancel that. */
/
* Note, any previous data-at-exec buffers will be freed in the recycle */
/
* if they call SQLExecDirect or SQLExecute again. */
stmt
->
data_at_exec
=
-
1
;
stmt
->
current_exec_param
=
-
1
;
...
...
@@ -435,11 +435,11 @@ FARPROC addr;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Returns the SQL string as modified by the driver.
/
/ Currently, just copy the input string without modification
/
/ observing buffer limits and truncation.
/
* 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
SQLNativeSql
(
HDBC
hdbc
,
UCHAR
FAR
*
szSqlStrIn
,
...
...
@@ -485,10 +485,10 @@ RETCODE result;
return
result
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Supplies parameter data at execution time. Used in conjuction with
/
/ SQLPutData.
/
* Supplies parameter data at execution time. Used in conjuction with */
/
* SQLPutData. */
RETCODE
SQL_API
SQLParamData
(
HSTMT
hstmt
,
...
...
@@ -583,10 +583,10 @@ int i, retval;
return
SQL_NEED_DATA
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Supplies parameter data at execution time. Used in conjunction with
/
/ SQLParamData.
/
* Supplies parameter data at execution time. Used in conjunction with */
/
* SQLParamData. */
RETCODE
SQL_API
SQLPutData
(
HSTMT
hstmt
,
...
...
src/interfaces/odbc/gpps.c
View file @
ddae527c
This diff is collapsed.
Click to expand it.
src/interfaces/odbc/gpps.h
View file @
ddae527c
/
/ GetPrivateProfileString
/
/ for UNIX use
/
* GetPrivateProfileString */
/
* for UNIX use */
#ifndef GPPS_H
#define GPPS_H
...
...
@@ -17,18 +17,18 @@ extern "C" {
#endif
DWORD
GetPrivateProfileString
(
char
*
theSection
,
/
/ section name
char
*
theKey
,
// search key name
char
*
theDefault
,
// default value if not found
char
*
theReturnBuffer
,
// return valuse stored here
size_t
theBufferLength
,
// byte length of return buffer
char
*
theIniFileName
);
// pathname of ini file to search
GetPrivateProfileString
(
char
*
theSection
,
/
* section name */
char
*
theKey
,
/* search key name */
char
*
theDefault
,
/* default value if not found */
char
*
theReturnBuffer
,
/* return valuse stored here */
size_t
theBufferLength
,
/* byte length of return buffer */
char
*
theIniFileName
);
/* pathname of ini file to search */
DWORD
WritePrivateProfileString
(
char
*
theSection
,
/
/ section name
char
*
theKey
,
// write key name
char
*
theBuffer
,
// input buffer
char
*
theIniFileName
);
// pathname of ini file to write
WritePrivateProfileString
(
char
*
theSection
,
/
* section name */
char
*
theKey
,
/* write key name */
char
*
theBuffer
,
/* input buffer */
char
*
theIniFileName
);
/* pathname of ini file to write */
#ifdef __cplusplus
}
...
...
src/interfaces/odbc/info.c
View file @
ddae527c
This diff is collapsed.
Click to expand it.
src/interfaces/odbc/lobj.c
View file @
ddae527c
...
...
@@ -27,7 +27,7 @@ int retval, result_len;
argv
[
0
].
u
.
integer
=
mode
;
if
(
!
CC_send_function
(
conn
,
LO_CREAT
,
&
retval
,
&
result_len
,
1
,
argv
,
1
))
return
0
;
/
/ invalid oid
return
0
;
/
* invalid oid */
else
return
retval
;
...
...
src/interfaces/odbc/misc.c
View file @
ddae527c
...
...
@@ -169,10 +169,10 @@ my_strcpy(char *dst, int dst_len, char *src, int src_len)
return
strlen
(
dst
);
}
/
/ strncpy copies up to len characters, and doesn't terminate
/
/ the destination string if src has len characters or more.
/
/ instead, I want it to copy up to len-1 characters and always
/
/ terminate the destination string.
/
* strncpy copies up to len characters, and doesn't terminate */
/
* the destination string if src has len characters or more. */
/
* instead, I want it to copy up to len-1 characters and always */
/
* terminate the destination string. */
char
*
strncpy_null
(
char
*
dst
,
const
char
*
src
,
int
len
)
{
int
i
;
...
...
@@ -199,9 +199,9 @@ int i;
return
dst
;
}
/
/ Create a null terminated string (handling the SQL_NTS thing):
/
/ 1. If buf is supplied, place the string in there (assumes enough space) and return buf.
/
/ 2. If buf is not supplied, malloc space and return this string
/
* Create a null terminated string (handling the SQL_NTS thing): */
/
* 1. If buf is supplied, place the string in there (assumes enough space) and return buf. */
/
* 2. If buf is not supplied, malloc space and return this string */
char
*
make_string
(
char
*
s
,
int
len
,
char
*
buf
)
{
...
...
@@ -227,10 +227,10 @@ char *str;
return
NULL
;
}
/
/ Concatenate a single formatted argument to a given buffer handling the SQL_NTS thing.
/
/ "fmt" must contain somewhere in it the single form '%.*s'
/
/ This is heavily used in creating queries for info routines (SQLTables, SQLColumns).
/
/ This routine could be modified to use vsprintf() to handle multiple arguments.
/
* Concatenate a single formatted argument to a given buffer handling the SQL_NTS thing. */
/
* "fmt" must contain somewhere in it the single form '%.*s' */
/
* This is heavily used in creating queries for info routines (SQLTables, SQLColumns). */
/
* This routine could be modified to use vsprintf() to handle multiple arguments. */
char
*
my_strcat
(
char
*
buf
,
char
*
fmt
,
char
*
s
,
int
len
)
{
...
...
src/interfaces/odbc/misc.h
View file @
ddae527c
...
...
@@ -50,7 +50,7 @@
#ifndef WIN32
#define mylog(args...)
/* GNU convention for variable arguments */
#else
#define mylog /
/ mylog
#define mylog
/
* mylog */
#endif
#endif
...
...
@@ -66,7 +66,7 @@
#ifndef WIN32
#define qlog(args...)
/* GNU convention for variable arguments */
#else
#define qlog /
/ qlog
#define qlog
/
* qlog */
#endif
#endif
...
...
src/interfaces/odbc/options.c
View file @
ddae527c
...
...
@@ -110,8 +110,8 @@ char changed = FALSE;
else
{
if
(
vParam
==
SQL_CURSOR_FORWARD_ONLY
||
vParam
==
SQL_CURSOR_STATIC
)
{
if
(
conn
)
conn
->
stmtOptions
.
cursor_type
=
vParam
;
/
/ valid type
if
(
stmt
)
stmt
->
options
.
cursor_type
=
vParam
;
/
/ valid type
if
(
conn
)
conn
->
stmtOptions
.
cursor_type
=
vParam
;
/
* valid type */
if
(
stmt
)
stmt
->
options
.
cursor_type
=
vParam
;
/
* valid type */
}
else
{
...
...
@@ -161,7 +161,7 @@ char changed = FALSE;
case
SQL_QUERY_TIMEOUT
:
/* ignored */
mylog
(
"SetStmtOption: SQL_QUERY_TIMEOUT, vParam = %d
\n
"
,
vParam
);
/
/ "0" returned in SQLGetStmtOption
/
* "0" returned in SQLGetStmtOption */
break
;
case
SQL_RETRIEVE_DATA
:
/* ignored, but saved */
...
...
@@ -390,7 +390,7 @@ int i;
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/* This function just can tell you whether you are in Autcommit mode or not */
RETCODE
SQL_API
SQLGetConnectOption
(
...
...
@@ -465,7 +465,7 @@ ConnectionClass *conn = (ConnectionClass *) hdbc;
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
RETCODE
SQL_API
SQLSetStmtOption
(
HSTMT
hstmt
,
...
...
@@ -477,9 +477,9 @@ StatementClass *stmt = (StatementClass *) hstmt;
mylog
(
"%s: entering...
\n
"
,
func
);
// thought we could fake Access out by just returning SQL_SUCCESS
// all the time, but it tries to set a huge value for SQL_MAX_LENGTH
// and expects the driver to reduce it to the real value
/* thought we could fake Access out by just returning SQL_SUCCESS */
/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
/* and expects the driver to reduce it to the real value */
if
(
!
stmt
)
{
SC_log_error
(
func
,
""
,
NULL
);
...
...
@@ -490,7 +490,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
RETCODE
SQL_API
SQLGetStmtOption
(
HSTMT
hstmt
,
...
...
@@ -503,9 +503,9 @@ QResultClass *res;
mylog
(
"%s: entering...
\n
"
,
func
);
// thought we could fake Access out by just returning SQL_SUCCESS
// all the time, but it tries to set a huge value for SQL_MAX_LENGTH
// and expects the driver to reduce it to the real value
/* thought we could fake Access out by just returning SQL_SUCCESS */
/* all the time, but it tries to set a huge value for SQL_MAX_LENGTH */
/* and expects the driver to reduce it to the real value */
if
(
!
stmt
)
{
SC_log_error
(
func
,
""
,
NULL
);
...
...
@@ -519,7 +519,7 @@ QResultClass *res;
res
=
stmt
->
result
;
if
(
stmt
->
manual_result
||
!
globals
.
use_declarefetch
)
{
/
/ make sure we're positioned on a valid row
/
* make sure we're positioned on a valid row */
if
((
stmt
->
currTuple
<
0
)
||
(
stmt
->
currTuple
>=
QR_get_num_tuples
(
res
)))
{
stmt
->
errormsg
=
"Not positioned on a valid row."
;
...
...
@@ -618,4 +618,4 @@ QResultClass *res;
return
SQL_SUCCESS
;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
src/interfaces/odbc/parse.c
View file @
ddae527c
...
...
@@ -56,7 +56,7 @@ char qc, in_escape = FALSE;
/* skip leading delimiters */
while
(
isspace
(
s
[
i
])
||
s
[
i
]
==
','
)
{
/
/ mylog("skipping '%c'\n", s[i]);
/
* mylog("skipping '%c'\n", s[i]); */
i
++
;
}
...
...
@@ -128,7 +128,7 @@ char qc, in_escape = FALSE;
i
++
;
}
/
/ mylog("done -- s[%d] = '%c'\n", i, s[i]);
/
* mylog("done -- s[%d] = '%c'\n", i, s[i]); */
token
[
out
]
=
'\0'
;
...
...
@@ -156,7 +156,7 @@ char qc, in_escape = FALSE;
}
/*
#if 0
QR_set_num_fields(stmt->result, 14);
QR_set_field_info(stmt->result, 0, "TABLE_QUALIFIER", PG_TYPE_TEXT, MAX_INFO_STRING);
QR_set_field_info(stmt->result, 1, "TABLE_OWNER", PG_TYPE_TEXT, MAX_INFO_STRING);
...
...
@@ -170,10 +170,10 @@ QR_set_field_info(stmt->result, 8, "SCALE", PG_TYPE_INT2, 2);
QR_set_field_info(stmt->result, 9, "RADIX", PG_TYPE_INT2, 2);
QR_set_field_info(stmt->result, 10, "NULLABLE", PG_TYPE_INT2, 2);
QR_set_field_info(stmt->result, 11, "REMARKS", PG_TYPE_TEXT, 254);
/
/ User defined fields
/
* User defined fields */
QR_set_field_info(stmt->result, 12, "DISPLAY_SIZE", PG_TYPE_INT4, 4);
QR_set_field_info(stmt->result, 13, "FIELD_TYPE", PG_TYPE_INT4, 4);
*/
#endif
void
getColInfo
(
COL_INFO
*
col_info
,
FIELD_INFO
*
fi
,
int
k
)
...
...
@@ -676,7 +676,7 @@ RETCODE result;
total_cols
--
;
/* makes up for the star */
/* Allocate some more field pointers if necessary */
/
/-------------------------------------------------------------
/
*------------------------------------------------------------- */
old_size
=
(
stmt
->
nfld
/
FLD_INCR
*
FLD_INCR
+
FLD_INCR
);
need
=
total_cols
-
(
old_size
-
stmt
->
nfld
);
...
...
@@ -692,22 +692,22 @@ RETCODE result;
}
}
/
/-------------------------------------------------------------
/
/ copy any other fields (if there are any) up past the expansion
/
*------------------------------------------------------------- */
/
* copy any other fields (if there are any) up past the expansion */
for
(
j
=
stmt
->
nfld
-
1
;
j
>
i
;
j
--
)
{
mylog
(
"copying field %d to %d
\n
"
,
j
,
total_cols
+
j
);
fi
[
total_cols
+
j
]
=
fi
[
j
];
}
mylog
(
"done copying fields
\n
"
);
/
/-------------------------------------------------------------
/
/ Set the new number of fields
/
*------------------------------------------------------------- */
/
* Set the new number of fields */
stmt
->
nfld
+=
total_cols
;
mylog
(
"stmt->nfld now at %d
\n
"
,
stmt
->
nfld
);
/
/-------------------------------------------------------------
/
/ copy the new field info
/
*------------------------------------------------------------- */
/
* copy the new field info */
do_all_tables
=
(
fi
[
i
]
->
ti
?
FALSE
:
TRUE
);
...
...
@@ -720,7 +720,7 @@ RETCODE result;
for
(
n
=
0
;
n
<
cols
;
n
++
)
{
mylog
(
"creating field info: n=%d
\n
"
,
n
);
/
/ skip malloc (already did it for the Star)
/
* skip malloc (already did it for the Star) */
if
(
k
>
0
||
n
>
0
)
{
mylog
(
"allocating field info at %d
\n
"
,
n
+
i
);
fi
[
n
+
i
]
=
(
FIELD_INFO
*
)
malloc
(
sizeof
(
FIELD_INFO
));
...
...
@@ -744,7 +744,7 @@ RETCODE result;
mylog
(
"i now at %d
\n
"
,
i
);
}
/
/-------------------------------------------------------------
/
*------------------------------------------------------------- */
}
/* We either know which table the field was in because it was qualified
...
...
src/interfaces/odbc/pgtypes.c
View file @
ddae527c
...
...
@@ -737,8 +737,8 @@ char *pgtype_create_params(StatementClass *stmt, Int4 type)
Int2
sqltype_to_default_ctype
(
Int2
sqltype
)
{
/
/ from the table on page 623 of ODBC 2.0 Programmer's Reference
/
/ (Appendix D)
/
* from the table on page 623 of ODBC 2.0 Programmer's Reference */
/
* (Appendix D) */
switch
(
sqltype
)
{
case
SQL_CHAR
:
case
SQL_VARCHAR
:
...
...
src/interfaces/odbc/pgtypes.h
View file @
ddae527c
...
...
@@ -16,7 +16,9 @@
/* in table pg_type */
// #define PG_TYPE_LO ???? /* waiting for permanent type */
#if 0
#define PG_TYPE_LO ???? /* waiting for permanent type */
#endif
#define PG_TYPE_BOOL 16
#define PG_TYPE_BYTEA 17
...
...
src/interfaces/odbc/psqlodbc.h
View file @
ddae527c
...
...
@@ -83,7 +83,7 @@ typedef UInt4 Oid;
/* Info limits */
#define MAX_INFO_STRING 128
#define MAX_KEYPARTS 20
#define MAX_KEYLEN 512 /
/ max key of the form "date+outlet+invoice"
#define MAX_KEYLEN 512
/
* max key of the form "date+outlet+invoice" */
#define MAX_STATEMENT_LEN MAX_MESSAGE_LEN
...
...
src/interfaces/odbc/qresult.c
View file @
ddae527c
...
...
@@ -125,14 +125,14 @@ QR_Destructor(QResultClass *self)
if
(
self
->
manual_tuples
)
TL_Destructor
(
self
->
manual_tuples
);
/
/ If conn is defined, then we may have used "backend_tuples",
/
/ so in case we need to, free it up. Also, close the cursor.
/
* If conn is defined, then we may have used "backend_tuples", */
/
* so in case we need to, free it up. Also, close the cursor. */
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 */
QR_free_memory
(
self
);
/
/ safe to call anyway
QR_free_memory
(
self
);
/
* safe to call anyway */
/
/ Should have been freed in the close() but just in case...
/
* Should have been freed in the close() but just in case... */
if
(
self
->
cursor
)
free
(
self
->
cursor
);
...
...
@@ -192,7 +192,7 @@ int num_fields = self->num_fields;
free
(
tuple
[
lf
].
value
);
}
}
tuple
+=
num_fields
;
/
/ next row
tuple
+=
num_fields
;
/
* next row */
}
free
(
self
->
backend_tuples
);
...
...
@@ -204,17 +204,17 @@ int num_fields = self->num_fields;
mylog
(
"QResult: free memory out
\n
"
);
}
/
/ This function is called by send_query()
/
* This function is called by send_query() */
char
QR_fetch_tuples
(
QResultClass
*
self
,
ConnectionClass
*
conn
,
char
*
cursor
)
{
int
tuple_size
;
/
/ If called from send_query the first time (conn != NULL),
/
/ then set the inTuples state,
/
/ and read the tuples. If conn is NULL,
/
/ it implies that we are being called from next_tuple(),
/
/ like to get more rows so don't call next_tuple again!
/
* If called from send_query the first time (conn != NULL), */
/
* then set the inTuples state, */
/
* and read the tuples. If conn is NULL, */
/
* it implies that we are being called from next_tuple(), */
/
* like to get more rows so don't call next_tuple again! */
if
(
conn
!=
NULL
)
{
self
->
conn
=
conn
;
...
...
@@ -232,8 +232,8 @@ int tuple_size;
self
->
cursor
=
strdup
(
cursor
);
}
/
/ Read the field attributes.
/
/ $$$$ Should do some error control HERE! $$$$
/
* Read the field attributes. */
/
* $$$$ Should do some error control HERE! $$$$ */
if
(
CI_read_fields
(
self
->
fields
,
self
->
conn
))
{
self
->
status
=
PGRES_FIELDS_OK
;
self
->
num_fields
=
CI_get_num_fields
(
self
->
fields
);
...
...
@@ -272,8 +272,8 @@ int tuple_size;
}
else
{
/
/ Always have to read the field attributes.
/
/ But we dont have to reallocate memory for them!
/
* Always have to read the field attributes. */
/
* But we dont have to reallocate memory for them! */
if
(
!
CI_read_fields
(
NULL
,
self
->
conn
))
{
self
->
status
=
PGRES_BAD_RESPONSE
;
...
...
@@ -284,8 +284,8 @@ int tuple_size;
}
}
/
/ Close the cursor and end the transaction (if no cursors left)
/
/ We only close cursor/end the transaction if a cursor was used.
/
* Close the cursor and end the transaction (if no cursors left) */
/
* We only close cursor/end the transaction if a cursor was used. */
int
QR_close
(
QResultClass
*
self
)
{
...
...
@@ -331,7 +331,7 @@ QResultClass *res;
return
TRUE
;
}
/
/ This function is called by fetch_tuples() AND SQLFetch()
/
* This function is called by fetch_tuples() AND SQLFetch() */
int
QR_next_tuple
(
QResultClass
*
self
)
{
...
...
@@ -346,7 +346,7 @@ int end_tuple = self->rowset_size + self->base;
char
corrected
=
FALSE
;
TupleField
*
the_tuples
=
self
->
backend_tuples
;
static
char
msgbuffer
[
MAX_MESSAGE_LEN
+
1
];
char
cmdbuffer
[
MAX_MESSAGE_LEN
+
1
];
/
/ QR_set_command() dups this string so dont need static
char
cmdbuffer
[
MAX_MESSAGE_LEN
+
1
];
/
* QR_set_command() dups this string so dont need static */
char
fetch
[
128
];
QueryInfo
qi
;
...
...
@@ -357,7 +357,7 @@ QueryInfo qi;
return
TRUE
;
}
else
if
(
self
->
fcount
<
self
->
cache_size
)
{
/* last row from cache */
// We are done because we didn't even get CACHE_SIZE tuples
/* We are done because we didn't even get CACHE_SIZE tuples */
mylog
(
"next_tuple: fcount < CACHE_SIZE: fcount = %d, fetch_count = %d
\n
"
,
fcount
,
fetch_count
);
self
->
tupleField
=
NULL
;
self
->
status
=
PGRES_END_TUPLES
;
...
...
@@ -417,7 +417,7 @@ QueryInfo qi;
mylog
(
"next_tuple: sending actual fetch (%d) query '%s'
\n
"
,
fetch_size
,
fetch
);
/
/ don't read ahead for the next tuple (self) !
/
* don't read ahead for the next tuple (self) ! */
qi
.
row_size
=
self
->
cache_size
;
qi
.
result_in
=
self
;
qi
.
cursor
=
NULL
;
...
...
@@ -479,7 +479,7 @@ QueryInfo qi;
}
self
->
fcount
++
;
break
;
/
/ continue reading
break
;
/
* continue reading */
case
'C'
:
/* End of tuple list */
...
...
@@ -498,7 +498,7 @@ QueryInfo qi;
self
->
tupleField
=
self
->
backend_tuples
+
(
offset
*
self
->
num_fields
);
return
TRUE
;
}
else
{
/
/ We are surely done here (we read 0 tuples)
else
{
/
* We are surely done here (we read 0 tuples) */
qlog
(
" [ fetched 0 rows ]
\n
"
);
mylog
(
"_next_tuple: 'C': DONE (fcount == 0)
\n
"
);
return
-
1
;
/* end of tuples */
...
...
@@ -546,7 +546,7 @@ Int2 bitmap_pos;
Int2
bitcnt
;
Int4
len
;
char
*
buffer
;
int
num_fields
=
self
->
num_fields
;
/
/ speed up access
int
num_fields
=
self
->
num_fields
;
/
* speed up access */
SocketClass
*
sock
=
CC_get_socket
(
self
->
conn
);
ColumnInfoClass
*
flds
;
...
...
src/interfaces/odbc/qresult.h
View file @
ddae527c
...
...
@@ -37,31 +37,31 @@ typedef enum QueryResultCode_ QueryResultCode;
struct
QResultClass_
{
ColumnInfoClass
*
fields
;
/
/ the Column information
TupleListClass
*
manual_tuples
;
/
/ manual result tuple list
ConnectionClass
*
conn
;
/
/ the connection this result is using (backend)
ColumnInfoClass
*
fields
;
/
* the Column information */
TupleListClass
*
manual_tuples
;
/
* manual result tuple list */
ConnectionClass
*
conn
;
/
* the connection this result is using (backend) */
/
/ Stuff for declare/fetch tuples
int
fetch_count
;
/
/ logical rows read so far
int
fcount
;
/
/ actual rows read in the fetch
/
* Stuff for declare/fetch tuples */
int
fetch_count
;
/
* logical rows read so far */
int
fcount
;
/
* actual rows read in the fetch */
int
currTuple
;
int
base
;
int
num_fields
;
/
/ number of fields in the result
int
num_fields
;
/
* number of fields in the result */
int
cache_size
;
int
rowset_size
;
QueryResultCode
status
;
char
*
message
;
char
*
cursor
;
/
/ The name of the cursor for select statements
char
*
cursor
;
/
* The name of the cursor for select statements */
char
*
command
;
char
*
notice
;
TupleField
*
backend_tuples
;
/
/ data from the backend (the tuple cache)
TupleField
*
tupleField
;
/
/ current backend tuple being retrieved
TupleField
*
backend_tuples
;
/
* data from the backend (the tuple cache) */
TupleField
*
tupleField
;
/
* current backend tuple being retrieved */
char
inTuples
;
/
/ is a fetch of rows from the backend in progress?
char
inTuples
;
/
* is a fetch of rows from the backend in progress? */
};
#define QR_get_fields(self) (self->fields)
...
...
@@ -97,7 +97,7 @@ struct QResultClass_ {
#define QR_get_notice(self) (self->notice)
#define QR_get_status(self) (self->status)
/
/ Core Functions
/
* Core Functions */
QResultClass
*
QR_Constructor
(
void
);
void
QR_Destructor
(
QResultClass
*
self
);
char
QR_read_tuple
(
QResultClass
*
self
,
char
binary
);
...
...
src/interfaces/odbc/resource.h
View file @
ddae527c
/
/{{NO_DEPENDENCIES}}
/
/ Microsoft Developer Studio generated include file.
/
/ Used by psqlodbc.rc
//
/
*{{NO_DEPENDENCIES}} */
/
* Microsoft Developer Studio generated include file. */
/
* Used by psqlodbc.rc */
/
* *
/
#define IDS_BADDSN 1
#define IDS_MSGTITLE 2
#define DLG_OPTIONS_DRV 102
...
...
@@ -50,8 +50,8 @@
#define DS_PG64 1057
#define DS_PG63 1058
/
/ Next default values for new objects
/
/
/
* Next default values for new objects */
/
* */
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104
...
...
src/interfaces/odbc/results.c
View file @
ddae527c
...
...
@@ -78,7 +78,7 @@ char *msg, *ptr;
if
(
res
&&
pcrow
)
{
msg
=
QR_get_command
(
res
);
mylog
(
"*** msg = '%s'
\n
"
,
msg
);
trim
(
msg
);
/
/ get rid of trailing spaces
trim
(
msg
);
/
* get rid of trailing spaces */
ptr
=
strrchr
(
msg
,
' '
);
if
(
ptr
)
{
*
pcrow
=
atoi
(
ptr
+
1
);
...
...
@@ -99,8 +99,8 @@ char *msg, *ptr;
}
/
/ This returns the number of columns associated with the database
/
/ attached to "hstmt".
/
* This returns the number of columns associated with the database */
/
* attached to "hstmt". */
RETCODE
SQL_API
SQLNumResultCols
(
...
...
@@ -155,12 +155,12 @@ char parse_ok;
}
/
/ - - - - - - - - -
/
* - - - - - - - - - */
/
/ Return information about the database column the user wants
/
/ information about.
/
* Return information about the database column the user wants */
/
* information about. */
RETCODE
SQL_API
SQLDescribeCol
(
HSTMT
hstmt
,
UWORD
icol
,
...
...
@@ -264,7 +264,7 @@ RETCODE result;
col_name
=
QR_get_fieldname
(
res
,
icol
);
fieldtype
=
QR_get_field_type
(
res
,
icol
);
precision
=
pgtype_precision
(
stmt
,
fieldtype
,
icol
,
globals
.
unknown_sizes
);
/
/ atoi(ci->unknown_sizes)
precision
=
pgtype_precision
(
stmt
,
fieldtype
,
icol
,
globals
.
unknown_sizes
);
/
* atoi(ci->unknown_sizes) */
}
mylog
(
"describeCol: col %d fieldname = '%s'
\n
"
,
icol
,
col_name
);
...
...
@@ -308,7 +308,7 @@ RETCODE result;
if
(
pcbColDef
)
{
if
(
precision
<
0
)
precision
=
0
;
/
/ "I dont know"
precision
=
0
;
/
* "I dont know" */
*
pcbColDef
=
precision
;
...
...
@@ -339,7 +339,7 @@ RETCODE result;
return
result
;
}
/
/ Returns result column descriptor information for a result set.
/
* Returns result column descriptor information for a result set. */
RETCODE
SQL_API
SQLColAttributes
(
HSTMT
hstmt
,
...
...
@@ -377,8 +377,8 @@ int len = 0, value = 0;
icol
--
;
unknown_sizes
=
globals
.
unknown_sizes
;
/
/ atoi(ci->unknown_sizes);
if
(
unknown_sizes
==
UNKNOWNS_AS_DONTKNOW
)
/
/ not appropriate for SQLColAttributes()
unknown_sizes
=
globals
.
unknown_sizes
;
/
* atoi(ci->unknown_sizes); */
if
(
unknown_sizes
==
UNKNOWNS_AS_DONTKNOW
)
/
* not appropriate for SQLColAttributes() */
unknown_sizes
=
UNKNOWNS_AS_MAX
;
parse_ok
=
FALSE
;
...
...
@@ -483,7 +483,7 @@ int len = 0, value = 0;
mylog
(
"SQLColAttr: COLUMN_LABEL = '%s'
\n
"
,
p
);
break
;
}
/
/ otherwise same as column name -- FALL THROUGH!!!
}
/
* otherwise same as column name -- FALL THROUGH!!! */
case
SQL_COLUMN_NAME
:
...
...
@@ -593,7 +593,7 @@ int len = 0, value = 0;
return
result
;
}
/
/ Returns result data for a single column in the current row.
/
* Returns result data for a single column in the current row. */
RETCODE
SQL_API
SQLGetData
(
HSTMT
hstmt
,
...
...
@@ -657,10 +657,10 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
else
{
/
/ use zero-based column numbers
/
* use zero-based column numbers */
icol
--
;
/
/ make sure the column number is valid
/
* make sure the column number is valid */
num_cols
=
QR_NumResultCols
(
res
);
if
(
icol
>=
num_cols
)
{
stmt
->
errormsg
=
"Invalid column number."
;
...
...
@@ -671,7 +671,7 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
}
if
(
stmt
->
manual_result
||
!
globals
.
use_declarefetch
)
{
/
/ make sure we're positioned on a valid row
/
* make sure we're positioned on a valid row */
num_rows
=
QR_get_num_tuples
(
res
);
if
((
stmt
->
currTuple
<
0
)
||
(
stmt
->
currTuple
>=
num_rows
))
{
...
...
@@ -765,8 +765,8 @@ mylog("SQLGetData: enter, stmt=%u\n", stmt);
/
/ Returns data for bound columns in the current row ("hstmt->iCursor"),
/
/ advances the cursor.
/
* Returns data for bound columns in the current row ("hstmt->iCursor"), */
/
* advances the cursor. */
RETCODE
SQL_API
SQLFetch
(
HSTMT
hstmt
)
...
...
@@ -815,8 +815,8 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
}
if
(
stmt
->
bindings
==
NULL
)
{
/
/ just to avoid a crash if the user insists on calling this
/
/ function even if SQL_ExecDirect has reported an Error
/
* just to avoid a crash if the user insists on calling this */
/
* function even if SQL_ExecDirect has reported an Error */
stmt
->
errormsg
=
"Bindings were not allocated properly."
;
stmt
->
errornumber
=
STMT_SEQUENCE_ERROR
;
SC_log_error
(
func
,
""
,
stmt
);
...
...
@@ -829,7 +829,7 @@ mylog("SQLFetch: stmt = %u, stmt->result= %u\n", stmt, stmt->result);
return
SC_fetch
(
stmt
);
}
/
/ This fetchs a block of data (rowset).
/
* This fetchs a block of data (rowset). */
RETCODE
SQL_API
SQLExtendedFetch
(
HSTMT
hstmt
,
...
...
@@ -892,8 +892,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
}
if
(
stmt
->
bindings
==
NULL
)
{
/
/ just to avoid a crash if the user insists on calling this
/
/ function even if SQL_ExecDirect has reported an Error
/
* just to avoid a crash if the user insists on calling this */
/
* function even if SQL_ExecDirect has reported an Error */
stmt
->
errormsg
=
"Bindings were not allocated properly."
;
stmt
->
errornumber
=
STMT_SEQUENCE_ERROR
;
SC_log_error
(
func
,
""
,
stmt
);
...
...
@@ -1050,7 +1050,7 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
truncated
=
error
=
FALSE
;
for
(
i
=
0
;
i
<
stmt
->
options
.
rowset_size
;
i
++
)
{
stmt
->
bind_row
=
i
;
/
/ set the binding location
stmt
->
bind_row
=
i
;
/
* set the binding location */
result
=
SC_fetch
(
stmt
);
/* Determine Function status */
...
...
@@ -1100,8 +1100,8 @@ mylog("SQLExtendedFetch: stmt=%u\n", stmt);
}
/
/ This determines whether there are more results sets available for
/
/ the "hstmt".
/
* This determines whether there are more results sets available for */
/
* the "hstmt". */
/* CC: return SQL_NO_DATA_FOUND since we do not support multiple result sets */
RETCODE
SQL_API
SQLMoreResults
(
...
...
@@ -1110,8 +1110,8 @@ RETCODE SQL_API SQLMoreResults(
return
SQL_NO_DATA_FOUND
;
}
/
/ This positions the cursor within a rowset, that was positioned using SQLExtendedFetch.
/
/ This will be useful (so far) only when using SQLGetData after SQLExtendedFetch.
/
* 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
SQLSetPos
(
HSTMT
hstmt
,
UWORD
irow
,
...
...
@@ -1172,7 +1172,7 @@ BindInfoClass *bindings = stmt->bindings;
}
/
/ Sets options that control the behavior of cursors.
/
* Sets options that control the behavior of cursors. */
RETCODE
SQL_API
SQLSetScrollOptions
(
HSTMT
hstmt
,
...
...
@@ -1187,7 +1187,7 @@ static char *func = "SQLSetScrollOptions";
}
/
/ Set the cursor name on a statement handle
/
* Set the cursor name on a statement handle */
RETCODE
SQL_API
SQLSetCursorName
(
HSTMT
hstmt
,
...
...
@@ -1218,7 +1218,7 @@ mylog("SQLSetCursorName: hstmt=%u, szCursor=%u, cbCursorMax=%d\n", hstmt, szCurs
return
SQL_SUCCESS
;
}
/
/ Return the cursor name for a statement handle
/
* Return the cursor name for a statement handle */
RETCODE
SQL_API
SQLGetCursorName
(
HSTMT
hstmt
,
...
...
src/interfaces/odbc/setup.c
View file @
ddae527c
This diff is collapsed.
Click to expand it.
src/interfaces/odbc/socket.c
View file @
ddae527c
...
...
@@ -277,8 +277,8 @@ SOCK_get_next_byte(SocketClass *self)
{
if
(
self
->
buffer_read_in
>=
self
->
buffer_filled_in
)
{
// there are no more bytes left in the buffer ->
// reload the buffer
/* there are no more bytes left in the buffer -> */
/* reload the buffer */
self
->
buffer_read_in
=
0
;
self
->
buffer_filled_in
=
recv
(
self
->
socket
,
(
char
*
)
self
->
buffer_in
,
globals
.
socket_buffersize
,
0
);
...
...
@@ -308,7 +308,7 @@ int bytes_sent;
self
->
buffer_out
[
self
->
buffer_filled_out
++
]
=
next_byte
;
if
(
self
->
buffer_filled_out
==
globals
.
socket_buffersize
)
{
/
/ buffer is full, so write it out
/
* buffer is full, so write it out */
bytes_sent
=
send
(
self
->
socket
,
(
char
*
)
self
->
buffer_out
,
globals
.
socket_buffersize
,
0
);
if
(
bytes_sent
!=
globals
.
socket_buffersize
)
{
self
->
errornumber
=
SOCKET_WRITE_ERROR
;
...
...
src/interfaces/odbc/statement.c
View file @
ddae527c
...
...
@@ -152,7 +152,7 @@ StatementClass *stmt = (StatementClass *) hstmt;
/* this should discard all the results, but leave the statement */
/* itself in place (it can be executed again) */
if
(
!
SC_recycle_statement
(
stmt
))
{
// errormsg passed in above
/* errormsg passed in above */
SC_log_error
(
func
,
""
,
stmt
);
return
SQL_ERROR
;
}
...
...
@@ -178,10 +178,10 @@ StatementClass *stmt = (StatementClass *) hstmt;
void
InitializeStatementOptions
(
StatementOptions
*
opt
)
{
opt
->
maxRows
=
0
;
/
/ driver returns all rows
opt
->
maxLength
=
0
;
/
/ driver returns all data for char/binary
opt
->
maxRows
=
0
;
/
* driver returns all rows */
opt
->
maxLength
=
0
;
/
* driver returns all data for char/binary */
opt
->
rowset_size
=
1
;
opt
->
keyset_size
=
0
;
/
/ fully keyset driven is the default
opt
->
keyset_size
=
0
;
/
* fully keyset driven is the default */
opt
->
scroll_concurrency
=
SQL_CONCUR_READ_ONLY
;
opt
->
cursor_type
=
SQL_CURSOR_FORWARD_ONLY
;
opt
->
bind_size
=
0
;
/* default is to bind by column */
...
...
@@ -447,7 +447,7 @@ mylog("recycle statement: self= %u\n", self);
/****************************************************************/
self
->
status
=
STMT_READY
;
self
->
manual_result
=
FALSE
;
/
/ very important
self
->
manual_result
=
FALSE
;
/
* very important */
self
->
currTuple
=
-
1
;
self
->
rowset_start
=
-
1
;
...
...
@@ -461,9 +461,9 @@ mylog("recycle statement: self= %u\n", self);
self
->
lobj_fd
=
-
1
;
/
/ Free any data at exec params before the statement is executed
/
/ again. If not, then there will be a memory leak when
/
/ the next SQLParamData/SQLPutData is called.
/
* Free any data at exec params before the statement is executed */
/
* again. If not, then there will be a memory leak when */
/
* the next SQLParamData/SQLPutData is called. */
SC_free_params
(
self
,
STMT_FREE_PARAMS_DATA_AT_EXEC_ONLY
);
return
TRUE
;
...
...
@@ -517,8 +517,8 @@ SC_clear_error(StatementClass *self)
}
/
/ This function creates an error msg which is the concatenation
/
/ of the result, statement, connection, and socket messages.
/
* This function creates an error msg which is the concatenation */
/
* of the result, statement, connection, and socket messages. */
char
*
SC_create_errormsg
(
StatementClass
*
self
)
{
...
...
@@ -557,7 +557,7 @@ SC_get_error(StatementClass *self, int *number, char **message)
{
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
)
{
self
->
errormsg
=
SC_create_errormsg
(
self
);
self
->
errormsg_created
=
TRUE
;
...
...
@@ -595,7 +595,7 @@ Int2 num_cols, lf;
Oid
type
;
char
*
value
;
ColumnInfoClass
*
ci
;
/
/ TupleField *tupleField;
/
* TupleField *tupleField; */
self
->
last_fetch_count
=
0
;
ci
=
QR_get_fields
(
res
);
/* the column info */
...
...
@@ -619,14 +619,14 @@ ColumnInfoClass *ci;
}
else
{
/
/ read from the cache or the physical next tuple
/
* read from the cache or the physical next tuple */
retval
=
QR_next_tuple
(
res
);
if
(
retval
<
0
)
{
mylog
(
"**** SQLFetch: end_tuples
\n
"
);
return
SQL_NO_DATA_FOUND
;
}
else
if
(
retval
>
0
)
(
self
->
currTuple
)
++
;
/
/ all is well
(
self
->
currTuple
)
++
;
/
* all is well */
else
{
mylog
(
"SQLFetch: error
\n
"
);
...
...
@@ -663,9 +663,9 @@ ColumnInfoClass *ci;
self
->
bindings
[
lf
].
data_left
=
-
1
;
if
(
self
->
bindings
[
lf
].
buffer
!=
NULL
)
{
// this column has a binding
/* this column has a binding */
// type = QR_get_field_type(res, lf);
/* type = QR_get_field_type(res, lf); */
type
=
CI_get_oid
(
ci
,
lf
);
/* speed things up */
mylog
(
"type = %d
\n
"
,
type
);
...
...
@@ -783,9 +783,9 @@ QueryInfo qi;
self
->
status
=
STMT_EXECUTING
;
/
/ If it's a SELECT statement, use a cursor.
/
/ Note that the declare cursor has already been prepended to the statement
/
/ in copy_statement...
/
* If it's a SELECT statement, use a cursor. */
/
* Note that the declare cursor has already been prepended to the statement */
/
* in copy_statement... */
if
(
self
->
statement_type
==
STMT_TYPE_SELECT
)
{
char
fetch
[
128
];
...
...
@@ -821,11 +821,11 @@ QueryInfo qi;
}
else
{
/
/ not a SELECT statement so don't use a cursor
else
{
/
* not a SELECT statement so don't use a cursor */
mylog
(
" it's NOT a select statement: stmt=%u
\n
"
,
self
);
self
->
result
=
CC_send_query
(
conn
,
self
->
stmt_with_params
,
NULL
);
/
/ If we are in autocommit, we must send the commit.
/
* If we are in autocommit, we must send the commit. */
if
(
!
self
->
internal
&&
CC_is_in_autocommit
(
conn
)
&&
STMT_UPDATE
(
self
))
{
res
=
CC_send_query
(
conn
,
"COMMIT"
,
NULL
);
QR_Destructor
(
res
);
...
...
@@ -929,7 +929,7 @@ SC_log_error(char *func, char *desc, StatementClass *self)
qlog
(
" status=%d, inTuples=%d
\n
"
,
res
->
status
,
res
->
inTuples
);
}
/
/ Log the connection error if there is one
/
* Log the connection error if there is one */
CC_log_error
(
func
,
desc
,
self
->
hdbc
);
}
else
...
...
src/interfaces/odbc/tuple.c
View file @
ddae527c
...
...
@@ -22,7 +22,7 @@
void
set_tuplefield_null
(
TupleField
*
tuple_field
)
{
tuple_field
->
len
=
0
;
tuple_field
->
value
=
NULL
;
/
/ strdup("");
tuple_field
->
value
=
NULL
;
/
* strdup(""); */
}
void
set_tuplefield_string
(
TupleField
*
tuple_field
,
char
*
string
)
...
...
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