Re: Source code cleanup

From: Hiroshi Inoue <inoue(at)tpf(dot)co(dot)jp>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Source code cleanup
Date: 2013-01-11 03:40:17
Message-ID: 50EF89A1.7040800@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi Heikki,

(2013/01/10 12:58), Inoue, Hiroshi wrote:
> Hi Heikki,
>
> (2013/01/09 3:25), Heikki Linnakangas wrote:
>> I'm getting a bunch of compiler warnings when I compile the latest
>> psqlodbc sources from CVS. I spent some time cleaning those up.
>>
>> I also got access to a report of a Coverity scan over psqlodbc source
>> tree. That found a bunch of additional issues, some of which were
>> genuine (minor) bugs. I'm still in the process of going through the
>> report, but I fixed some bugs already.
>
> Thanks.
>
>>
>> I also wrote a small regression test suite to test with. It only tests a
>> few of the ODBC functions at the moment, but it's better than nothing,
>> and it can be easily extended. What do others use for testing psqlodbc?
>>
>> I pushed the result to a git repository at
>> git(at)github(dot)com:hlinnaka/psqlodbc.git. It contains the psqlodbc CVS
>> history, as converted by git cvsimport, and my changes as commits on top
>> of that.
>
> I would check the git repository.

The 1st question I have is about the change

commit 80b3eb35ab1428949f7ab8fbd567d5d49655dc02
Author: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Date: Sat Jan 5 00:35:39 2013 +0200

Silence Coverity warnings about passing negative param to
SQLExecDirect.
It doesn't know about the psqlodbc extension to that function that
passing SQL_NTS means it's a C-style null-terminated string.

The type of the 3rd parameter of SQLExecDirect() is SQLINTEGER.
What kind od warnings does Coverity scan show?
SQL_NTS is generally used in ODBC and I could hardly remember the
examples which use parameters other than SQL_NTS.

In addition the change doesn't seem correct to me.
The 3rd parameter of the following SQLExecDirect call is the
string length of a Statement Handle.

ret = SQLExecDirect(stmt, (SQLCHAR *) "select gid from
pg_prepared_xacts", strlen(stmt));

regards,
Hiroshi Inoue

In response to

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message j.letzel@t-online.de 2013-01-17 09:31:05 Bug in SQLRowCount ?
Previous Message Inoue, Hiroshi 2013-01-10 03:58:30 Re: Source code cleanup