Thread: old testlo example code

old testlo example code

From
Josh Kupershmidt
Date:
This documentation page:
  http://www.postgresql.org/docs/current/static/lo-examplesect.html

contains a hardcoded copy of ./src/test/examples/testlo.c, and it
seems like this version hasn't been updated along with its source. The
version from the docs no longer compiles for me, at least not when I
drop it into the place of the current ./src/test/examples/testlo.c.
That's easy enough to fix, though I have a historical question about
this code.

Building the unmodified code in ./src/test/examples, I see:

  testlo.c:35: warning: ‘importFile’ defined but not used
  testlo.c:151: warning: ‘exportFile’ defined but not used
  ...
  testlo64.c:35: warning: ‘importFile’ defined but not used
  testlo64.c:173: warning: ‘exportFile’ defined but not used

since the calls to those functions are commented out in favor of
lo_import() and lo_export(). I'm wondering if there is some reason to
leave those importFile() and exportFile() definitions in this example
code if they're not used? The code has apparently been like this (at
least for testlo.c, and I guess testlo64.c just copy-pasted from its
older sibling) since the first commit, d31084e9.

Josh


Re: old testlo example code

From
Magnus Hagander
Date:
On Sat, Jan 5, 2013 at 3:27 AM, Josh Kupershmidt <schmiddy@gmail.com> wrote:
> This documentation page:
>   http://www.postgresql.org/docs/current/static/lo-examplesect.html
>
> contains a hardcoded copy of ./src/test/examples/testlo.c, and it
> seems like this version hasn't been updated along with its source. The
> version from the docs no longer compiles for me, at least not when I
> drop it into the place of the current ./src/test/examples/testlo.c.
> That's easy enough to fix, though I have a historical question about
> this code.

ISTM we should either remove the example programs and replace them
with just a reference, or find a way to include the source code into
the documentation with some kind of include statement instead of
haivng a copy of it. That should be done the same way for all the
example programs, not just the testlo ones of course.

Not sure if it's possible to create such an include though - someone
who knows our toolchain better can hopefully comment on that?

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: old testlo example code

From
Dmitriy Igrishin
Date:



2013/1/5 Magnus Hagander <magnus@hagander.net>
On Sat, Jan 5, 2013 at 3:27 AM, Josh Kupershmidt <schmiddy@gmail.com> wrote:
> This documentation page:
>   http://www.postgresql.org/docs/current/static/lo-examplesect.html
>
> contains a hardcoded copy of ./src/test/examples/testlo.c, and it
> seems like this version hasn't been updated along with its source. The
> version from the docs no longer compiles for me, at least not when I
> drop it into the place of the current ./src/test/examples/testlo.c.
> That's easy enough to fix, though I have a historical question about
> this code.

ISTM we should either remove the example programs and replace them
with just a reference, or find a way to include the source code into
the documentation with some kind of include statement instead of
haivng a copy of it. That should be done the same way for all the
example programs, not just the testlo ones of course.

Not sure if it's possible to create such an include though - someone
who knows our toolchain better can hopefully comment on that?
I think it's possible with Doxygen. 

--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


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



--
// Dmitriy.

Re: old testlo example code

From
Magnus Hagander
Date:
On Sun, Jan 6, 2013 at 10:12 AM, Dmitriy Igrishin <dmitigr@gmail.com> wrote:
>
>
>
> 2013/1/5 Magnus Hagander <magnus@hagander.net>
>>
>> On Sat, Jan 5, 2013 at 3:27 AM, Josh Kupershmidt <schmiddy@gmail.com>
>> wrote:
>> > This documentation page:
>> >   http://www.postgresql.org/docs/current/static/lo-examplesect.html
>> >
>> > contains a hardcoded copy of ./src/test/examples/testlo.c, and it
>> > seems like this version hasn't been updated along with its source. The
>> > version from the docs no longer compiles for me, at least not when I
>> > drop it into the place of the current ./src/test/examples/testlo.c.
>> > That's easy enough to fix, though I have a historical question about
>> > this code.
>>
>> ISTM we should either remove the example programs and replace them
>> with just a reference, or find a way to include the source code into
>> the documentation with some kind of include statement instead of
>> haivng a copy of it. That should be done the same way for all the
>> example programs, not just the testlo ones of course.
>>
>> Not sure if it's possible to create such an include though - someone
>> who knows our toolchain better can hopefully comment on that?
>
> I think it's possible with Doxygen.

I was referring to the SGML documentation here, so that won't actually help.


--
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/


Re: old testlo example code

From
Peter Eisentraut
Date:
On Sat, 2013-01-05 at 15:14 +0100, Magnus Hagander wrote:
> ISTM we should either remove the example programs and replace them
> with just a reference, or find a way to include the source code into
> the documentation with some kind of include statement instead of
> haivng a copy of it. That should be done the same way for all the
> example programs, not just the testlo ones of course.
>
> Not sure if it's possible to create such an include though - someone
> who knows our toolchain better can hopefully comment on that?

I've been looking into this.  It's not easily possible with the current
SGML setup.  (XInclude with XML would probably work.)  So for now it
would be best if someone could just sync up the docs with the code until
we figure out a better way.



Re: old testlo example code

From
Josh Kupershmidt
Date:
On Thu, Feb 14, 2013 at 7:30 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On Sat, 2013-01-05 at 15:14 +0100, Magnus Hagander wrote:
>> ISTM we should either remove the example programs and replace them
>> with just a reference, or find a way to include the source code into
>> the documentation with some kind of include statement instead of
>> haivng a copy of it. That should be done the same way for all the
>> example programs, not just the testlo ones of course.
>>
>> Not sure if it's possible to create such an include though - someone
>> who knows our toolchain better can hopefully comment on that?
>
> I've been looking into this.  It's not easily possible with the current
> SGML setup.  (XInclude with XML would probably work.)  So for now it
> would be best if someone could just sync up the docs with the code until
> we figure out a better way.

OK, here's a patch to update the example code in the docs to match the
example programs in ./src/test/examples . In addition to the testlo
example discussed, I updated the libpq examples as well. There's a
fair amount of whitespace churn in the diff, though I assume that's
from a pgindent change of the test code at some point.

Josh

Attachment

Re: old testlo example code

From
Bruce Momjian
Date:
On Tue, Feb 26, 2013 at 08:18:40PM -0700, Josh Kupershmidt wrote:
> On Thu, Feb 14, 2013 at 7:30 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> > On Sat, 2013-01-05 at 15:14 +0100, Magnus Hagander wrote:
> >> ISTM we should either remove the example programs and replace them
> >> with just a reference, or find a way to include the source code into
> >> the documentation with some kind of include statement instead of
> >> haivng a copy of it. That should be done the same way for all the
> >> example programs, not just the testlo ones of course.
> >>
> >> Not sure if it's possible to create such an include though - someone
> >> who knows our toolchain better can hopefully comment on that?
> >
> > I've been looking into this.  It's not easily possible with the current
> > SGML setup.  (XInclude with XML would probably work.)  So for now it
> > would be best if someone could just sync up the docs with the code until
> > we figure out a better way.
>
> OK, here's a patch to update the example code in the docs to match the
> example programs in ./src/test/examples . In addition to the testlo
> example discussed, I updated the libpq examples as well. There's a
> fair amount of whitespace churn in the diff, though I assume that's
> from a pgindent change of the test code at some point.

Patch applied, and tabs converted to 4 spaces.  Thanks.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +