pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
[issue?] SQLDriverConnect will clear existing connect attribute setting.
2+ messages / 2 participants
[nested] [flat]

* [issue?] SQLDriverConnect will clear existing connect attribute setting.
@ 2015-01-04 06:11 Ivan Zhang <w.s.zhang@motorolasolutions.com>
  2015-01-15 08:53 ` Re: [issue?] SQLDriverConnect will clear existing connect attribute setting. Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Ivan Zhang @ 2015-01-04 06:11 UTC (permalink / raw)
  To: pgsql-odbc

Hi,

I have a library to connect different database with ODBC. Found it's not work on postgresql by setting autocommit off.

            SQLSetConnectAttr(hDbc,
                SQL_ATTR_AUTOCOMMIT,
                (SQLPOINTER) SQL_AUTOCOMMIT_OFF,
                0)

        SQLDriverConnect(hDbc,
                         GetDesktopWindow(),
                         wszConnStr,
                         SQL_NTS,
                         NULL,
                         0,
                         NULL,
                         SQL_DRIVER_COMPLETE);

After checked the source, found that

PGAPI_Connect init the connection attribute/option in CC_conninfo_init.

So I have to set connect Attribute  after Connect. Is this expected?

SQLDriverConnect -> SQLSetConnectAttr

It's different with ODBC interface expected(allocate -> set -> connect).

Thanks

Best Regards
Ivan

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [issue?] SQLDriverConnect will clear existing connect attribute setting.
  2015-01-04 06:11 [issue?] SQLDriverConnect will clear existing connect attribute setting. Ivan Zhang <w.s.zhang@motorolasolutions.com>
@ 2015-01-15 08:53 ` Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Heikki Linnakangas @ 2015-01-15 08:53 UTC (permalink / raw)
  To: Ivan Zhang <w.s.zhang@motorolasolutions.com>; pgsql-odbc

On 01/04/2015 08:11 AM, Ivan Zhang wrote:
> I have a library to connect different database with ODBC. Found it's not work on postgresql by setting autocommit off.
>
>              SQLSetConnectAttr(hDbc,
>                  SQL_ATTR_AUTOCOMMIT,
>                  (SQLPOINTER) SQL_AUTOCOMMIT_OFF,
>                  0)
>
>          SQLDriverConnect(hDbc,
>                           GetDesktopWindow(),
>                           wszConnStr,
>                           SQL_NTS,
>                           NULL,
>                           0,
>                           NULL,
>                           SQL_DRIVER_COMPLETE);
>
> After checked the source, found that
>
> PGAPI_Connect init the connection attribute/option in CC_conninfo_init.
>
> So I have to set connect Attribute  after Connect. Is this expected?
>
> SQLDriverConnect -> SQLSetConnectAttr
>
> It's different with ODBC interface expected(allocate -> set -> connect).

It's a bug. It should be possible to set SQL_ATTR_AUTOCOMMIT before 
establishing connection.

Fixed, thanks for the report!

- Heikki



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2015-01-15 08:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-01-04 06:11 [issue?] SQLDriverConnect will clear existing connect attribute setting. Ivan Zhang <w.s.zhang@motorolasolutions.com>
2015-01-15 08:53 ` Heikki Linnakangas <hlinnakangas@vmware.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox