diff options
author | Hiroshi Inoue <inoue@tpf.co.jp> | 2002-02-27 01:43:24 +0000 |
---|---|---|
committer | Hiroshi Inoue <inoue@tpf.co.jp> | 2002-02-27 01:43:24 +0000 |
commit | fc3726b4b97f1ad8cf061e4eab3a7d284ffc10a2 (patch) | |
tree | 416f3b79a8359231af96e8cc8cd32ed04e415ad1 /src/interfaces/odbc/convert.c | |
parent | 21f9a654f0d3b7ecb2023797df54abc52da4350e (diff) | |
download | postgresql-fc3726b4b97f1ad8cf061e4eab3a7d284ffc10a2.tar.gz postgresql-fc3726b4b97f1ad8cf061e4eab3a7d284ffc10a2.zip |
Improve the handling of ODBC escape(a request from Marcelo Aceto).
Change SQLGetFunctions() to reply not yet implemented ODBC 3.0
functions precisely.
Diffstat (limited to 'src/interfaces/odbc/convert.c')
-rw-r--r-- | src/interfaces/odbc/convert.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c index 1f3c89981ee..4291e36c34c 100644 --- a/src/interfaces/odbc/convert.c +++ b/src/interfaces/odbc/convert.c @@ -1402,6 +1402,8 @@ copy_statement_with_parameters(StatementClass *stmt) } opos = end - old_statement; /* positioned at the last } */ new_statement = stmt->stmt_with_params; + if (isalnum(end[1])) + CVT_APPEND_CHAR(' '); continue; } /* End of a procedure call */ @@ -2015,7 +2017,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value, char valnts[1024], params[1024]; char key[33], *end; const char *valptr; - UInt4 vlen, prtlen, input_consumed, param_consumed; + UInt4 vlen, prtlen, input_consumed, param_consumed, extra_len; Int4 param_pos[16][2]; valptr = value; @@ -2042,6 +2044,20 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value, *input_resume = valptr + vlen; /* resume from the last } */ mylog("%s: key='%s', val='%s'\n", func, key, valnts); + extra_len = 0; + if (isalnum(result[-1])) /* Avoid the concatenation of the function name with the previous word. Aceto */ + { + if (1 >= maxLen) + { + mylog("%s %d bytes buffer overflow\n", func, maxLen); + return CONVERT_ESCAPE_OVERFLOW; + } + *result = ' '; + result++; + *result = '\0'; + maxLen--; + extra_len++; + } if (strcmp(key, "d") == 0) { /* Literal; return the escape part adding type cast */ @@ -2185,7 +2201,7 @@ int inner_convert_escape(const ConnectionClass *conn, const char *value, } if (count) - *count = prtlen; + *count = prtlen + extra_len; if (prtlen < 0 || prtlen >= maxLen) /* buffer overflow */ { mylog("%s %d bytes buffer overflow\n", func, maxLen); |