1) Fixed pretty many 'if (..);' lines(my fault sorry).
authorHiroshi Inoue <inoue@tpf.co.jp>
Wed, 13 Nov 2002 23:42:05 +0000 (23:42 +0000)
committerHiroshi Inoue <inoue@tpf.co.jp>
Wed, 13 Nov 2002 23:42:05 +0000 (23:42 +0000)
2) Add a few #include lines(config.h pthread,h) for *nix.
3) Supress automatic client_encoding setting in some cases.

bind.c
environ.h
gpps.c
multibyte.c
odbcapi30w.c
odbcapiw.c
win32_30.mak

diff --git a/bind.c b/bind.c
index 46a646e41fa538fab42cb3a859243403766cfb9d..fdee467f97347839ca5f596098b1ab97c1f0be7a 100644 (file)
--- a/bind.c
+++ b/bind.c
@@ -521,7 +521,7 @@ APD_free_params(APDFields *self, char option)
 
    if (option == STMT_FREE_PARAMS_ALL)
    {
-       if (self->parameters);
+       if (self->parameters)
            free(self->parameters);
        self->parameters = NULL;
        self->allocated = 0;
index 8926eb116ec7e3727d9b9e51ed5cf19ed05aa486..95debf3d5c2d5760f47ad881a42072f31d147d78 100644 (file)
--- a/environ.h
+++ b/environ.h
 
 #include "psqlodbc.h"
 
+#if defined (POSIX_MULTITHREAD_SUPPORT)
+#include <pthread.h>
+#endif
+
 #define ENV_ALLOC_ERROR 1
 
 /**********        Environment Handle  *************/
diff --git a/gpps.c b/gpps.c
index 5f6be62907277b3ac8982dccd3618fd8870fb1ed..c4351bce5ddf529633acaf0e164ee792194e360a 100644 (file)
--- a/gpps.c
+++ b/gpps.c
@@ -19,6 +19,7 @@
  *-------
  */
 
+#include "config.h"
 #if !defined(WIN32) && !defined(WITH_UNIXODBC) && !defined(WITH_IODBC)
 
 #include "gpps.h"
index b737911b2d5ead65993ad8d97017ff42637e45cf..a61163d1747f928d390e76a12b072b79553e8ee0 100644 (file)
@@ -386,10 +386,12 @@ CC_lookup_characterset(ConnectionClass *self)
                wenc = "SJIS";
                break;
            case 936:
-               wenc = "GBK";
+               if (!encstr || PG_VERSION_LE(self, 7.2))
+                   wenc = "GBK";
                break;
            case 949:
-               if (!encstr || stricmp(encstr, "EUC_KR"))  
+               if (!encstr || PG_VERSION_LE(self, 7.2) ||
+                   stricmp(encstr, "EUC_KR"))  
                    wenc = "UHC";
                break;
            case 950:
index cf86135c091148a17cf6ffe702e978da86492225..89e53934fd230e0def6eb200f9c4f84c9ee48821 100644 (file)
@@ -219,7 +219,7 @@ RETCODE SQL_API SQLGetDiagRecW(SWORD fHandleType,
        if (pcbErrorMsg)
                *pcbErrorMsg = tlen;
    }
-        if (qstr);
+        if (qstr)
            free(qstr);
    if (mtxt)
            free(mtxt);
index 96bb7b0a2f3429daef74fe6341a81588c21aa8c7..48cbcf08200bd2b2bd92f0165b167d093136254b 100644 (file)
@@ -47,11 +47,11 @@ RETCODE  SQL_API SQLColumnsW(HSTMT StatementHandle,
    LEAVE_STMT_CS((StatementClass *) StatementHandle);
    if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
    if (tbName)
        free(tbName);
-   if (clName);
+   if (clName)
        free(clName);
    return ret;
 }
@@ -75,11 +75,11 @@ RETCODE  SQL_API SQLConnectW(HDBC ConnectionHandle,
    ret = PGAPI_Connect(ConnectionHandle, svName, (SWORD) nmlen1,
                usName, (SWORD) nmlen2, auth, (SWORD) nmlen3);
    LEAVE_CONN_CS((ConnectionClass *) ConnectionHandle);
-   if (svName);
+   if (svName)
        free(svName);
-   if (usName);
+   if (usName)
        free(usName);
-   if (auth);
+   if (auth)
        free(auth);
    return ret;
 }
@@ -114,7 +114,7 @@ RETCODE SQL_API SQLDriverConnectW(HDBC hdbc,
            *pcbConnStrOut = outlen;
    }
    free(szOut);
-   if (szIn);
+   if (szIn)
        free(szIn);
    return ret;
 }
@@ -147,7 +147,7 @@ RETCODE SQL_API SQLBrowseConnectW(
            *pcbConnStrOut = outlen;
    }
    free(szOut);
-   if (szIn);
+   if (szIn)
        free(szIn);
    return ret;
 }
@@ -213,7 +213,7 @@ RETCODE  SQL_API SQLExecDirectW(HSTMT StatementHandle,
    ENTER_STMT_CS((StatementClass *) StatementHandle);
    ret = PGAPI_ExecDirect(StatementHandle, stxt, slen);
    LEAVE_STMT_CS((StatementClass *) StatementHandle);
-   if (stxt);
+   if (stxt)
        free(stxt);
    return ret;
 }
@@ -295,7 +295,7 @@ RETCODE  SQL_API SQLPrepareW(HSTMT StatementHandle,
    ENTER_STMT_CS((StatementClass *) StatementHandle);
    ret = PGAPI_Prepare(StatementHandle, stxt, slen);
    LEAVE_STMT_CS((StatementClass *) StatementHandle);
-   if (stxt);
+   if (stxt)
        free(stxt);
    return ret;
 }
@@ -312,7 +312,7 @@ RETCODE  SQL_API SQLSetCursorNameW(HSTMT StatementHandle,
    ENTER_STMT_CS((StatementClass *) StatementHandle);
    ret = PGAPI_SetCursorName(StatementHandle, crName, (SWORD) nlen);
    LEAVE_STMT_CS((StatementClass *) StatementHandle);
-   if (crName);
+   if (crName)
        free(crName);
    return ret;
 }
@@ -337,11 +337,11 @@ RETCODE  SQL_API SQLSpecialColumnsW(HSTMT StatementHandle,
            (SWORD) nmlen1, scName, (SWORD) nmlen2, tbName, (SWORD) nmlen3,
        Scope, Nullable);
    LEAVE_STMT_CS((StatementClass *) StatementHandle);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (tbName);
+   if (tbName)
        free(tbName);
    return ret;
 }
@@ -365,11 +365,11 @@ RETCODE  SQL_API SQLStatisticsW(HSTMT StatementHandle,
            scName, (SWORD) nmlen2, tbName, (SWORD) nmlen3, Unique,
        Reserved);
    LEAVE_STMT_CS((StatementClass *) StatementHandle);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (tbName);
+   if (tbName)
        free(tbName);
    return ret;
 }
@@ -394,13 +394,13 @@ RETCODE  SQL_API SQLTablesW(HSTMT StatementHandle,
            scName, (SWORD) nmlen2, tbName, (SWORD) nmlen3,
            tbType, (SWORD) nmlen4);
    LEAVE_STMT_CS((StatementClass *) StatementHandle);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (tbName);
+   if (tbName)
        free(tbName);
-   if (tbType);
+   if (tbType)
        free(tbType);
    return ret;
 }
@@ -430,13 +430,13 @@ RETCODE SQL_API SQLColumnPrivilegesW(
        scName, (SWORD) nmlen2, tbName, (SWORD) nmlen3,
        clName, (SWORD) nmlen4);
    LEAVE_STMT_CS((StatementClass *) hstmt);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (tbName);
+   if (tbName)
        free(tbName);
-   if (clName);
+   if (clName)
        free(clName);
    return ret;
 }
@@ -473,17 +473,17 @@ RETCODE SQL_API SQLForeignKeysW(
        fkctName, (SWORD) nmlen4, fkscName, (SWORD) nmlen5,
        fktbName, (SWORD) nmlen6);
    LEAVE_STMT_CS((StatementClass *) hstmt);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (tbName);
+   if (tbName)
        free(tbName);
-   if (fkctName);
+   if (fkctName)
        free(fkctName);
-   if (fkscName);
+   if (fkscName)
        free(fkscName);
-   if (fktbName);
+   if (fktbName)
        free(fktbName);
    return ret;
 }
@@ -509,7 +509,7 @@ RETCODE SQL_API SQLNativeSqlW(
    szOut = malloc(buflen);
    ret = PGAPI_NativeSql(hdbc, szIn, (SQLINTEGER) slen,
        szOut, buflen, &olen);
-   if (szIn);
+   if (szIn)
        free(szIn);
    if (ret == SQL_SUCCESS)
    {
@@ -550,11 +550,11 @@ RETCODE SQL_API SQLPrimaryKeysW(
    ret = PGAPI_PrimaryKeys(hstmt, ctName, (SWORD) nmlen1,
        scName, (SWORD) nmlen2, tbName, (SWORD) nmlen3);
    LEAVE_STMT_CS((StatementClass *) hstmt);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (tbName);
+   if (tbName)
        free(tbName);
    return ret;
 }
@@ -584,13 +584,13 @@ RETCODE SQL_API SQLProcedureColumnsW(
        scName, (SWORD) nmlen2, prName, (SWORD) nmlen3,
        clName, (SWORD) nmlen4);
    LEAVE_STMT_CS((StatementClass *) hstmt);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (prName);
+   if (prName)
        free(prName);
-   if (clName);
+   if (clName)
        free(clName);
    return ret;
 }
@@ -616,11 +616,11 @@ RETCODE SQL_API SQLProceduresW(
    ret = PGAPI_Procedures(hstmt, ctName, (SWORD) nmlen1,
        scName, (SWORD) nmlen2, prName, (SWORD) nmlen3);
    LEAVE_STMT_CS((StatementClass *) hstmt);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (prName);
+   if (prName)
        free(prName);
    return ret;
 }
@@ -646,11 +646,11 @@ RETCODE SQL_API SQLTablePrivilegesW(
    ret = PGAPI_TablePrivileges(hstmt, ctName, (SWORD) nmlen1,
        scName, (SWORD) nmlen2, tbName, (SWORD) nmlen3, 0);
    LEAVE_STMT_CS((StatementClass *) hstmt);
-   if (ctName);
+   if (ctName)
        free(ctName);
-   if (scName);
+   if (scName)
        free(scName);
-   if (tbName);
+   if (tbName)
        free(tbName);
    return ret;
 }
index dbbd561780aff65e866ed9a3e715c4fa9ceab5c9..221475df09c9f7a2b40d80d6a9bfe649fbde064b 100755 (executable)
@@ -528,9 +528,9 @@ SOURCE=odbcapi30.c
 "$(INTDIR)\odbcapi30.obj" : $(SOURCE) "$(INTDIR)"
    $(CPP) $(CPP_PROJ) $(SOURCE)
 
-SOURCE=pgcapi30.c
+SOURCE=pgapi30.c
 
-"$(INTDIR)\pgcapi30.obj" : $(SOURCE) "$(INTDIR)"
+"$(INTDIR)\pgapi30.obj" : $(SOURCE) "$(INTDIR)"
    $(CPP) $(CPP_PROJ) $(SOURCE)