Thread: ODBC Patch

ODBC Patch

From
Dave Page
Date:
This patch fixes resource.h which is generated automatically by MS VC++ and
broken by pgindent :-(

Regards,

Dave.

RE: ODBC Patch

From
Dave Page
Date:
Helps if I actually attach it!

> -----Original Message-----
> From: Dave Page [mailto:dpage@vale-housing.co.uk]
> Sent: 12 February 2001 08:00
> To: pgsql-patches@postgresql.org
> Subject: [PATCHES] ODBC Patch
>
>
> This patch fixes resource.h which is generated automatically
> by MS VC++ and
> broken by pgindent :-(
>
> Regards,
>
> Dave.
>


Attachment

Re: ODBC Patch

From
Bruce Momjian
Date:
Dave, can you test the attached patch?  I assume the problem was that
pgindent does not recognize // as comments, and in fact, we don't want
to use them.

This should fix the problem.

[ Charset ISO-8859-1 unsupported, converting... ]
> Helps if I actually attach it!
>
> > -----Original Message-----
> > From: Dave Page [mailto:dpage@vale-housing.co.uk]
> > Sent: 12 February 2001 08:00
> > To: pgsql-patches@postgresql.org
> > Subject: [PATCHES] ODBC Patch
> >
> >
> > This patch fixes resource.h which is generated automatically
> > by MS VC++ and
> > broken by pgindent :-(
> >
> > Regards,
> >
> > Dave.
> >
>

[ Attachment, skipping... ]


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
? libpsqlodbc.so.0.26
Index: resource.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/odbc/resource.h,v
retrieving revision 1.15
diff -c -r1.15 resource.h
*** resource.h    2001/02/11 04:56:58    1.15
--- resource.h    2001/02/12 12:57:08
***************
*** 1,13 ****
! //
! {
!     {
!         NO_DEPENDENCIES
!     }
! }

- //Microsoft Developer Studio generated include file.
- // Used by psqlodbc.rc
- //
  #define IDS_BADDSN                        1
  #define IDS_MSGTITLE                    2
  #define DLG_OPTIONS_DRV                    102
--- 1,9 ----
! /*
!  * {{NO_DEPENDENCIES}}
!  * Microsoft Developer Studio generated include file.
!  * Used by psqlodbc.rc
!  */

  #define IDS_BADDSN                        1
  #define IDS_MSGTITLE                    2
  #define DLG_OPTIONS_DRV                    102

RE: ODBC Patch

From
Dave Page
Date:
> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: 12 February 2001 12:59
> To: Dave Page
> Cc: 'pgsql-patches@postgresql.org'
> Subject: Re: [PATCHES] ODBC Patch
>
>
> Dave, can you test the attached patch?  I assume the problem was that
> pgindent does not recognize // as comments, and in fact, we don't want
> to use them.
>
> This should fix the problem.

I've not tested it (I'm just configuring my new laptop :-) ) but that should
work (and has done - if you look back in CVS I made that mod before). The
problem is that MS VC++ autogenerates resource.h whenever psqlodbc.rc is
updated in the IDE. Is it possible to get pgindent to ignore that file or
would that cause more problems?

Regards, Dave.

Re: ODBC Patch

From
Bruce Momjian
Date:
> > Dave, can you test the attached patch?  I assume the problem was that
> > pgindent does not recognize // as comments, and in fact, we don't want
> > to use them.
> >
> > This should fix the problem.
>
> I've not tested it (I'm just configuring my new laptop :-) ) but that should
> work (and has done - if you look back in CVS I made that mod before). The
> problem is that MS VC++ autogenerates resource.h whenever psqlodbc.rc is
> updated in the IDE. Is it possible to get pgindent to ignore that file or
> would that cause more problems?

Sure, we can ignore it, but do we want an MS-generated file to be
tracked in our CVS, and especially one with // comments?

If resource.h was included only by MS compilers, that would be better,
but I see every platform including the file.

Can you send me that resource.h file again, and I will merge in any
change made by *.rc, but keep the /* */ comments, OK?

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: ODBC Patch

From
Tom Lane
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
>> problem is that MS VC++ autogenerates resource.h whenever psqlodbc.rc is
>> updated in the IDE. Is it possible to get pgindent to ignore that file or
>> would that cause more problems?

> Sure, we can ignore it, but do we want an MS-generated file to be
> tracked in our CVS, and especially one with // comments?
> If resource.h was included only by MS compilers, that would be better,
> but I see every platform including the file.

Good point.  This will not be buildable on machines whose compilers do
not like //.

> Can you send me that resource.h file again, and I will merge in any
> change made by *.rc, but keep the /* */ comments, OK?

I don't think that's a feasible long-term maintenance approach either.
Will you or Dave remember to do this any time psqlodbc.rc changes?

Seems like the correct answer is for pgindent to automatically transform
"// comment" to "/* comment */".

            regards, tom lane

RE: ODBC Patch

From
Dave Page
Date:

> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: 12 February 2001 14:12
> To: Dave Page
> Cc: 'pgsql-patches@postgresql.org'
> Subject: Re: [PATCHES] ODBC Patch
>
>
> > > Dave, can you test the attached patch?  I assume the
> problem was that
> > > pgindent does not recognize // as comments, and in fact,
> we don't want
> > > to use them.
> > >
> > > This should fix the problem.
> >
> > I've not tested it (I'm just configuring my new laptop :-)
> ) but that should
> > work (and has done - if you look back in CVS I made that
> mod before). The
> > problem is that MS VC++ autogenerates resource.h whenever
> psqlodbc.rc is
> > updated in the IDE. Is it possible to get pgindent to
> ignore that file or
> > would that cause more problems?
>
> Sure, we can ignore it, but do we want an MS-generated file to be
> tracked in our CVS, and especially one with // comments?
>
> If resource.h was included only by MS compilers, that would be better,
> but I see every platform including the file.
>
> Can you send me that resource.h file again, and I will merge in any
> change made by *.rc, but keep the /* */ comments, OK?

Here's the (working) file with C style comments.

I've made comments on the subject in a reply to Tom's message...

Regards, Dave.


Attachment

RE: ODBC Patch

From
Dave Page
Date:

> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 12 February 2001 15:19
> To: Bruce Momjian
> Cc: Dave Page; 'pgsql-patches@postgresql.org'
> Subject: Re: [PATCHES] ODBC Patch
>
>
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> >> problem is that MS VC++ autogenerates resource.h whenever
> psqlodbc.rc is
> >> updated in the IDE. Is it possible to get pgindent to
> ignore that file or
> >> would that cause more problems?
>
> > Sure, we can ignore it, but do we want an MS-generated file to be
> > tracked in our CVS, and especially one with // comments?
> > If resource.h was included only by MS compilers, that would
> be better,
> > but I see every platform including the file.
>
> Good point.  This will not be buildable on machines whose compilers do
> not like //.
>
> > Can you send me that resource.h file again, and I will merge in any
> > change made by *.rc, but keep the /* */ comments, OK?
>
> I don't think that's a feasible long-term maintenance approach either.
> Will you or Dave remember to do this any time psqlodbc.rc changes?

I can certainly do this anytime I update the driver, but I obviously can't
keep track of other people who change it. IMHO it (psqlodbc.rc) should be
updated for every patch submitted as it (along with psqlodbc.h) contain the
revision number which is essential for the ODBC driver which is often
updated outside of the main PostgreSQL releases.

> Seems like the correct answer is for pgindent to
> automatically transform
> "// comment" to "/* comment */".

This sounds much more sensible.

Regards,

Dave.

Re: ODBC Patch

From
Bruce Momjian
Date:
Applied.  Thanks.


[ Charset ISO-8859-1 unsupported, converting... ]
>
>
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > Sent: 12 February 2001 14:12
> > To: Dave Page
> > Cc: 'pgsql-patches@postgresql.org'
> > Subject: Re: [PATCHES] ODBC Patch
> >
> >
> > > > Dave, can you test the attached patch?  I assume the
> > problem was that
> > > > pgindent does not recognize // as comments, and in fact,
> > we don't want
> > > > to use them.
> > > >
> > > > This should fix the problem.
> > >
> > > I've not tested it (I'm just configuring my new laptop :-)
> > ) but that should
> > > work (and has done - if you look back in CVS I made that
> > mod before). The
> > > problem is that MS VC++ autogenerates resource.h whenever
> > psqlodbc.rc is
> > > updated in the IDE. Is it possible to get pgindent to
> > ignore that file or
> > > would that cause more problems?
> >
> > Sure, we can ignore it, but do we want an MS-generated file to be
> > tracked in our CVS, and especially one with // comments?
> >
> > If resource.h was included only by MS compilers, that would be better,
> > but I see every platform including the file.
> >
> > Can you send me that resource.h file again, and I will merge in any
> > change made by *.rc, but keep the /* */ comments, OK?
>
> Here's the (working) file with C style comments.
>
> I've made comments on the subject in a reply to Tom's message...
>
> Regards, Dave.
>

[ Attachment, skipping... ]


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: ODBC Patch

From
Bruce Momjian
Date:
> > > Can you send me that resource.h file again, and I will merge in any
> > > change made by *.rc, but keep the /* */ comments, OK?
> >
> > I don't think that's a feasible long-term maintenance approach either.
> > Will you or Dave remember to do this any time psqlodbc.rc changes?
>
> I can certainly do this anytime I update the driver, but I obviously can't
> keep track of other people who change it. IMHO it (psqlodbc.rc) should be
> updated for every patch submitted as it (along with psqlodbc.h) contain the
> revision number which is essential for the ODBC driver which is often
> updated outside of the main PostgreSQL releases.

It is my understanding that resource.h is changed only when a new
option is added t psqlodbc.rc.  It does not change with a version number
change because resource.h doesn't contain a version number.

>
> > Seems like the correct answer is for pgindent to
> > automatically transform
> > "// comment" to "/* comment */".
>
> This sounds much more sensible.

Sure, I can do that.  I can have pgindent convert:

    // comment

to

    /* comment */

Dave, can you send me the MS-generated resource.h for me to test with
and cvs commit?  Thanks.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

RE: ODBC Patch

From
Dave Page
Date:

> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: 12 February 2001 18:32
> To: Dave Page
> Cc: 'Tom Lane'; 'pgsql-patches@postgresql.org'
> Subject: Re: [PATCHES] ODBC Patch
>
>
>
> It is my understanding that resource.h is changed only when a new
> option is added t psqlodbc.rc.  It does not change with a
> version number
> change because resource.h doesn't contain a version number.
>

I've just tested with MS VC++ SP4 and it will not update psqlodbc.rc without
rewriting resource.h even if you only change the version number. If you say
No when prompted to update resource.h, it then doesn't update psqlodbc.rc
either.

> Dave, can you send me the MS-generated resource.h for me to test with
> and cvs commit?  Thanks.

Attached.

Regards, Dave.


Attachment

Re: ODBC Patch

From
Bruce Momjian
Date:
OK, attached is the resource.h file, run through pgindent.  Looks good.
Committed.


[ Charset ISO-8859-1 unsupported, converting... ]
>
>
> > -----Original Message-----
> > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> > Sent: 12 February 2001 18:32
> > To: Dave Page
> > Cc: 'Tom Lane'; 'pgsql-patches@postgresql.org'
> > Subject: Re: [PATCHES] ODBC Patch
> >
> >
> >
> > It is my understanding that resource.h is changed only when a new
> > option is added t psqlodbc.rc.  It does not change with a
> > version number
> > change because resource.h doesn't contain a version number.
> >
>
> I've just tested with MS VC++ SP4 and it will not update psqlodbc.rc without
> rewriting resource.h even if you only change the version number. If you say
> No when prompted to update resource.h, it then doesn't update psqlodbc.rc
> either.
>
> > Dave, can you send me the MS-generated resource.h for me to test with
> > and cvs commit?  Thanks.
>
> Attached.
>
> Regards, Dave.
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
/* {{NO_DEPENDENCIES}} */
/*    Microsoft Developer Studio generated include file. */
/*    Used by psqlodbc.rc */
/*    */
#define IDS_BADDSN                        1
#define IDS_MSGTITLE                    2
#define DLG_OPTIONS_DRV                    102
#define DLG_OPTIONS_DS                    103
#define IDC_DSNAME                        400
#define IDC_DSNAMETEXT                    401
#define IDC_DESC                        404
#define IDC_SERVER                        407
#define IDC_DATABASE                    408
#define DLG_CONFIG                        1001
#define IDC_PORT                        1002
#define IDC_USER                        1006
#define IDC_PASSWORD                    1009
#define DS_READONLY                        1011
#define DS_SHOWOIDCOLUMN                1012
#define DS_FAKEOIDINDEX                    1013
#define DRV_COMMLOG                        1014
#define IDC_DATASOURCE                    1018
#define DRV_OPTIMIZER                    1019
#define DS_CONNSETTINGS                    1020
#define IDC_DRIVER                        1021
#define DRV_CONNSETTINGS                1031
#define DRV_UNIQUEINDEX                    1032
#define DRV_UNKNOWN_MAX                    1035
#define DRV_UNKNOWN_DONTKNOW            1036
#define DRV_READONLY                    1037
#define IDC_DESCTEXT                    1039
#define DRV_MSG_LABEL                    1040
#define DRV_UNKNOWN_LONGEST                1041
#define DRV_TEXT_LONGVARCHAR            1043
#define DRV_UNKNOWNS_LONGVARCHAR        1044
#define DRV_CACHE_SIZE                    1045
#define DRV_VARCHAR_SIZE                1046
#define DRV_LONGVARCHAR_SIZE            1047
#define IDDEFAULTS                        1048
#define DRV_USEDECLAREFETCH                1049
#define DRV_BOOLS_CHAR                    1050
#define DS_SHOWSYSTEMTABLES                1051
#define DRV_EXTRASYSTABLEPREFIXES        1051
#define DS_ROWVERSIONING                1052
#define DRV_PARSE                        1052
#define DRV_CANCELASFREESTMT            1053
#define IDC_OPTIONS                        1054
#define DRV_KSQO                        1055
#define DS_PG64                            1057

/*    Next default values for new objects */
/*     */
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        104
#define _APS_NEXT_COMMAND_VALUE            40001
#define _APS_NEXT_CONTROL_VALUE            1060
#define _APS_NEXT_SYMED_VALUE            101
#endif
#endif