pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Extracting client code
4+ messages / 3 participants
[nested] [flat]

* Extracting client code
@ 2006-09-28 14:08  Jon Earle <jepg@kronos.honk.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Jon Earle @ 2006-09-28 14:08 UTC (permalink / raw)
  To: pgsql-interfaces

Hi folks,

I have a need to extract the postgres client code from the tarball for
inclusion into a separate application.  This app will talk to a PG database
(obviously) over a network and will be the only app that will be
communicating with the database (aside from a PHP application on the same box
as the PG server).  This app will be compiled on various platforms - AIX,
HPUX, Solaris, Linux and Unixware are the main ones that come to mind.  I
have no specific need to keep the PG code in a library so compiling the PG
client code together with my application code module is not only acceptable,
it would be preferred.

Currently, the app is using mysql client code in this precise fashion - I'd
like to "simply" replace the mysql code with postgres code for our own
consistency.

Before I get too far into working this up, at this point, I'm really just
curious if this is doable.  Can I just take the src/interface/libpq dir
contents, parachute them into the same dir as my app, then just compile it
all together (after making the appropriate changes to my own app, of course)?

Thanks for any insight!




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

* Re: Extracting client code
@ 2006-09-28 14:55  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Jon Earle <jepg@kronos.honk.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Tom Lane @ 2006-09-28 14:55 UTC (permalink / raw)
  To: Jon Earle <jepg@kronos.honk.org>; +Cc: pgsql-interfaces

"Jon Earle" <jepg@kronos.honk.org> writes:
> Can I just take the src/interface/libpq dir
> contents, parachute them into the same dir as my app, then just compile it
> all together (after making the appropriate changes to my own app, of course)?

No.  At minimum you're going to need the configure script and src/port/
as well.  My inclination would just be to ship the unmodified tarball
and do

	unpack tarball
	cd top-dir
	configure ...
	cd src/interfaces/libpq
	make
	make install

Obviously you could strip large parts of the tarball out, but then you'd
have to redo that work every time we update.

Also keep in mind the possibility that libpq is already installed on the
machine you're on.

			regards, tom lane



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

* Re: Extracting client code
@ 2006-09-28 16:49  Jon Earle <jepg@kronos.honk.org>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 4+ messages in thread

From: Jon Earle @ 2006-09-28 16:49 UTC (permalink / raw)
  To: pgsql-interfaces

Tom Lane wrote:
> "Jon Earle" <jepg@kronos.honk.org> writes:
>> Can I just take the src/interface/libpq dir
>> contents, parachute them into the same dir as my app, then just compile it
>> all together (after making the appropriate changes to my own app, of
>> course)?
>
> No.  At minimum you're going to need the configure script and src/port/
> as well.  My inclination would just be to ship the unmodified tarball
> and do

I noticed the makefile in the libpq dir made symlinks to a handful of .c
files in src/port and references one .h.  Aside from those, which I could
simply copy into the libpq dir, is there anything inside the libpq dir that
is changed by the configure script that I can't manage myself?  Honestly,
this really doesn't need to be fancy - (hold your nose) it's fine/preferable
to have all the libpq .o's can be linked with myapp.c into a single binary
myapp.

> Obviously you could strip large parts of the tarball out, but then you'd
> have to redo that work every time we update.

I don't see this as an issue... the mysql code in place now is very old -
from the 3.2x days - but works fine to connect to an up-to-date mysql server.
 Unless there is a serious enough issue that demands an update (and perhaps
not even then - the app will always run on a protected network), it will
likely remain as-is until the app is overhauled, replaced or abandoned.

> Also keep in mind the possibility that libpq is already installed on the
> machine you're on.

Possibly, but very unlikely.




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

* Re: Extracting client code
@ 2006-09-28 16:52  Bruce Momjian <bruce@momjian.us>
  parent: Jon Earle <jepg@kronos.honk.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Bruce Momjian @ 2006-09-28 16:52 UTC (permalink / raw)
  To: Jon Earle <jepg@kronos.honk.org>; +Cc: pgsql-interfaces

Jon Earle wrote:
> Tom Lane wrote:
> > "Jon Earle" <jepg@kronos.honk.org> writes:
> >> Can I just take the src/interface/libpq dir
> >> contents, parachute them into the same dir as my app, then just compile it
> >> all together (after making the appropriate changes to my own app, of
> >> course)?
> >
> > No.  At minimum you're going to need the configure script and src/port/
> > as well.  My inclination would just be to ship the unmodified tarball
> > and do
> 
> I noticed the makefile in the libpq dir made symlinks to a handful of .c
> files in src/port and references one .h.  Aside from those, which I could
> simply copy into the libpq dir, is there anything inside the libpq dir that
> is changed by the configure script that I can't manage myself?  Honestly,

Yes, include/pg_config.h is used by libpq, for example.

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

  + If your life is a hard drive, Christ can be your backup. +



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


end of thread, other threads:[~2006-09-28 16:52 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-09-28 14:08 Extracting client code Jon Earle <jepg@kronos.honk.org>
2006-09-28 14:55 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-09-28 16:49   ` Jon Earle <jepg@kronos.honk.org>
2006-09-28 16:52     ` Bruce Momjian <bruce@momjian.us>

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