From: Hiroshi Inoue Date: Thu, 13 Sep 2001 00:27:11 +0000 (+0000) Subject: 1) Not export ODBC 3.0 functions. X-Git-Tag: REL7_2_BETA1~419 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9f990a73c13a17faf87417eee9e17faabfa00179;p=postgresql 1) Not export ODBC 3.0 functions. 2) (Maybe) fix a bug reported by Mika Muntila. --- diff --git a/src/interfaces/odbc/convert.c b/src/interfaces/odbc/convert.c index 8052709fda..84f99b40e3 100644 --- a/src/interfaces/odbc/convert.c +++ b/src/interfaces/odbc/convert.c @@ -1674,12 +1674,19 @@ copy_statement_with_parameters(StatementClass *stmt) if (buf) { - CVT_APPEND_DATA(buf, used); + switch (used) + { + case SQL_NULL_DATA: + break; + case SQL_NTS: + CVT_APPEND_STR(buf); + break; + default: + CVT_APPEND_DATA(buf, used); + } } else - { CVT_APPEND_STR(param_string); - } if (param_sqltype == SQL_BIT) CVT_APPEND_CHAR('\''); /* Close Quote */ diff --git a/src/interfaces/odbc/drvconn.c b/src/interfaces/odbc/drvconn.c index e1eee25de5..80f1d69b7d 100644 --- a/src/interfaces/odbc/drvconn.c +++ b/src/interfaces/odbc/drvconn.c @@ -230,6 +230,9 @@ dialog: if (len >= cbConnStrOutMax) { + int clen; + for (clen = strlen(szConnStrOut) - 1; clen >= 0 && szConnStrOut[clen] != ';'; clen--) + szConnStrOut[clen] = '\0'; result = SQL_SUCCESS_WITH_INFO; conn->errornumber = CONN_TRUNCATED; conn->errormsg = "The buffer was too small for the ConnStrOut."; diff --git a/src/interfaces/odbc/environ.c b/src/interfaces/odbc/environ.c index 8e9156d2d0..0471e1f428 100644 --- a/src/interfaces/odbc/environ.c +++ b/src/interfaces/odbc/environ.c @@ -92,6 +92,8 @@ PGAPI_Error( { char *msg; int status; + BOOL once_again = FALSE; + SWORD msglen; mylog("**** PGAPI_Error: henv=%u, hdbc=%u, hstmt=%u <%d>\n", henv, hdbc, hstmt, cbErrorMsgMax); @@ -101,8 +103,6 @@ PGAPI_Error( { /* CC: return an error of a hstmt */ StatementClass *stmt = (StatementClass *) hstmt; - SWORD msglen; - BOOL once_again = FALSE; if (SC_get_error(stmt, &status, &msg)) { @@ -306,8 +306,15 @@ PGAPI_Error( return SQL_NO_DATA_FOUND; } + msglen = strlen(msg); if (NULL != pcbErrorMsg) - *pcbErrorMsg = (SWORD) strlen(msg); + { + *pcbErrorMsg = msglen; + if (cbErrorMsgMax == 0) + once_again = TRUE; + else if (msglen >= cbErrorMsgMax) + *pcbErrorMsg = cbErrorMsgMax - 1; + } if ((NULL != szErrorMsg) && (cbErrorMsgMax > 0)) strncpy_null(szErrorMsg, msg, cbErrorMsgMax); if (NULL != pfNativeError) @@ -391,7 +398,13 @@ PGAPI_Error( return SQL_NO_DATA_FOUND; } - return SQL_SUCCESS; + if (once_again) + { + conn->errornumber = status; + return SQL_SUCCESS_WITH_INFO; + } + else + return SQL_SUCCESS; } else if (SQL_NULL_HENV != henv) { diff --git a/src/interfaces/odbc/info.c b/src/interfaces/odbc/info.c index 1f458ba043..54d97304bc 100644 --- a/src/interfaces/odbc/info.c +++ b/src/interfaces/odbc/info.c @@ -3614,9 +3614,29 @@ PGAPI_Procedures( SWORD cbProcName) { static char *func = "PGAPI_Procedures"; + StatementClass *stmt = (StatementClass *) hstmt; + Int2 result_cols; mylog("%s: entering...\n", func); + /* + * a statement is actually executed, so we'll have to do this + * ourselves. + */ + result_cols = 8; + extend_bindings(stmt, result_cols); + + /* set the field names */ + QR_set_num_fields(stmt->result, result_cols); + QR_set_field_info(stmt->result, 0, "PROCEDURE_CAT", PG_TYPE_TEXT, MAX_INFO_STRING); + QR_set_field_info(stmt->result, 1, "PROCEDURE_SCHEM", PG_TYPE_TEXT, MAX_INFO_STRING); + QR_set_field_info(stmt->result, 2, "PROCEDURE_NAME", PG_TYPE_TEXT, MAX_INFO_STRING); + QR_set_field_info(stmt->result, 3, "NUM_INPUT_PARAMS", PG_TYPE_TEXT, MAX_INFO_STRING); + QR_set_field_info(stmt->result, 4, "NUM_OUTPUT_PARAMS", PG_TYPE_TEXT, MAX_INFO_STRING); + QR_set_field_info(stmt->result, 5, "NUM_RESULT_SET", PG_TYPE_TEXT, MAX_INFO_STRING); + QR_set_field_info(stmt->result, 6, "REMARKS", PG_TYPE_TEXT, MAX_INFO_STRING); + QR_set_field_info(stmt->result, 7, "PROCEDURE_TYPE", PG_TYPE_INT2, 2); + SC_log_error(func, "Function not implemented", (StatementClass *) hstmt); return SQL_ERROR; } diff --git a/src/interfaces/odbc/pgtypes.c b/src/interfaces/odbc/pgtypes.c index f2b1853590..97a6ff8201 100644 --- a/src/interfaces/odbc/pgtypes.c +++ b/src/interfaces/odbc/pgtypes.c @@ -698,7 +698,15 @@ pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_ /* Character types (and NUMERIC) use the default precision */ case PG_TYPE_VARCHAR: case PG_TYPE_BPCHAR: +#ifdef MULTIBYTE + /* after 7.2 */ + if (PG_VERSION_GE(SC_get_conn(stmt), 7.2) + return 3 * pgtype_precision(stmt, type, col, handle_unknown_size_as); + else +#else + /* CR -> CR/LF */ return 2 * pgtype_precision(stmt, type, col, handle_unknown_size_as); +#endif /* MULTIBYTE */ default: return pgtype_precision(stmt, type, col, handle_unknown_size_as); } diff --git a/src/interfaces/odbc/psqlodbc_win32.def b/src/interfaces/odbc/psqlodbc_win32.def index 25cd554745..23a5a82b39 100644 --- a/src/interfaces/odbc/psqlodbc_win32.def +++ b/src/interfaces/odbc/psqlodbc_win32.def @@ -53,28 +53,6 @@ SQLSetPos @68 SQLSetScrollOptions @69 SQLTablePrivileges @70 SQLBindParameter @72 - -SQLAllocHandle @80 -SQLBindParam @81 -SQLCloseCursor @82 -SQLColAttribute @83 -SQLCopyDesc @84 -SQLEndTran @85 -SQLFetchScroll @86 -SQLFreeHandle @87 -SQLGetDescField @88 -SQLGetDescRec @89 -SQLGetDiagField @90 -SQLGetDiagRec @91 -SQLGetEnvAttr @92 -SQLGetConnectAttr @93 -SQLGetStmtAttr @94 -SQLSetConnectAttr @95 -SQLSetDescField @96 -SQLSetDescRec @97 -SQLSetEnvAttr @98 -SQLSetStmtAttr @99 - SQLDummyOrdinal @199 dconn_FDriverConnectProc @200 DllMain @201