Prevent an infinite loop of error reporting.
authorHiroshi Inoue
Wed, 10 Apr 2002 08:18:54 +0000 (08:18 +0000)
committerHiroshi Inoue
Wed, 10 Apr 2002 08:18:54 +0000 (08:18 +0000)
src/interfaces/odbc/connection.c
src/interfaces/odbc/descriptor.h
src/interfaces/odbc/info.c
src/interfaces/odbc/psqlodbc.h
src/interfaces/odbc/statement.c

index 7cee671e2b6ba3efe145dc0979250f6c26c38c2b..b0dd575fb95e6a25238c60a9cdbf55c95942dc50 100644 (file)
@@ -610,7 +610,7 @@ CC_connect(ConnectionClass *self, char do_password)
    int         areq = -1;
    int         beresp;
    static char     msgbuffer[ERROR_MSG_LENGTH];
-   char        salt[5];
+   char        salt[5], notice[512];
    static char *func = "CC_connect";
 
 #ifdef MULTIBYTE
@@ -893,6 +893,9 @@ another_version_retry:
                case 'Z':       /* Backend is ready for new query (6.4) */
                    ReadyForQuery = TRUE;
                    break;
+               case 'N':   /* Notices may come */
+                   while (SOCK_get_string(sock, notice, sizeof(notice) - 1)) ;
+                   break;
                default:
                    self->errormsg = "Unexpected protocol character during authentication";
                    self->errornumber = CONN_INVALID_AUTHENTICATION;
index fe90a2cbd3aa670d07bd73cedc90c39d06bb9106..59e4212ed63b04147991777e6ff06faa9b84334f 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Comments:       See "notice.txt" for copyright and license information.
  *
- * $Id: descriptor.h,v 1.3 2002/04/02 10:50:44 inoue Exp $
+ * $Id: descriptor.h,v 1.4 2002/04/10 08:18:54 inoue Exp $
  *
  */
 
@@ -17,7 +17,7 @@
 typedef struct
 {
    COL_INFO    *col_info; /* cached SQLColumns info for this table */
-   char        schema[MAX_TABLE_LEN + 1];
+   char        schema[MAX_SCHEMA_LEN + 1];
    char        name[MAX_TABLE_LEN + 1];
    char        alias[MAX_TABLE_LEN + 1];
 } TABLE_INFO;
index 2dce375f78b55d50808c850c17b5e4d5d926211b..07f42372842a2e8b03b8b3e13d81ccdf2644b1c9 100644 (file)
@@ -342,6 +342,8 @@ PGAPI_GetInfo(
        case SQL_MAX_OWNER_NAME_LEN:    /* ODBC 1.0 */
            len = 2;
            value = 0;
+           if (conn->schema_support)
+               value = MAX_SCHEMA_LEN;
            break;
 
        case SQL_MAX_PROCEDURE_NAME_LEN:        /* ODBC 1.0 */
@@ -484,12 +486,21 @@ PGAPI_GetInfo(
            break;
 
        case SQL_OWNER_TERM:    /* ODBC 1.0 */
-           p = "owner";
+           if (conn->schema_support)
+               p = "schema";
+           else
+               p = "owner";
            break;
 
        case SQL_OWNER_USAGE:   /* ODBC 2.0 */
            len = 4;
            value = 0;
+           if (conn->schema_support)
+               value = SQL_OU_DML_STATEMENTS
+                   | SQL_OU_TABLE_DEFINITION
+                   | SQL_OU_INDEX_DEFINITION
+                   | SQL_OU_PRIVILEGE_DEFINITION
+                   ;
            break;
 
        case SQL_POS_OPERATIONS:        /* ODBC 2.0 */
index f9bb1581d994016e66970b865620ddbb0a424158..3cc09113f6f2fee2ba75ff7b30d0ea86f767f092 100644 (file)
@@ -5,7 +5,7 @@
  *
  * Comments:       See "notice.txt" for copyright and license information.
  *
- * $Id: psqlodbc.h,v 1.63 2002/04/02 10:50:49 inoue Exp $
+ * $Id: psqlodbc.h,v 1.64 2002/04/10 08:18:53 inoue Exp $
  *
  */
 
@@ -124,6 +124,7 @@ typedef UInt4 Oid;
 #define BYTELEN                        8
 #define VARHDRSZ                   sizeof(Int4)
 
+#define MAX_SCHEMA_LEN             32
 #define MAX_TABLE_LEN              32
 #define MAX_COLUMN_LEN             32
 #define MAX_CURSOR_LEN             32
index 6bdac480872929beb87e9c2185d4b06c43415187..cf3db03ead30665b635b846d748f49ecd8ca676e 100644 (file)
@@ -301,6 +301,7 @@ SC_Constructor(void)
        rv->inaccurate_result = FALSE;
        rv->miscinfo = 0;
        rv->updatable = FALSE;
+       rv->error_recsize = -1;
    }
    return rv;
 }